Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Percentages on iOS in strings with vs. without arguments #47

Open
johankool opened this issue Feb 18, 2021 · 0 comments
Open

Percentages on iOS in strings with vs. without arguments #47

johankool opened this issue Feb 18, 2021 · 0 comments

Comments

@johankool
Copy link
Contributor

Due to the guard on the number of translationArgs, if a string contains a percentage sign, but not any placeholders, the percentage encoding isn't removed because it isn't used as a String format.

So it the yaml contains '42%', it shows up in Localizable.strings as '42%%' and in the UI as '42%%' too, but '%1{{s}} is 42%' comes true correctly.

Removing the guard fixes it.

        let translationArgs = self.translationArgs ?? []
        guard translationArgs.count > 0 else { return value }

        return String(format: value, arguments: translationArgs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant