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

Support ICUString with placeholders #47

Open
michael-wirth opened this issue Oct 13, 2022 · 2 comments
Open

Support ICUString with placeholders #47

michael-wirth opened this issue Oct 13, 2022 · 2 comments

Comments

@michael-wirth
Copy link

Plurals class fails to parse ICU strings with placeholders correctly.
https://github.com/transifex/transifex-java/blob/devel/TransifexNativeSDK/common/src/main/java/com/transifex/common/Plurals.java#L50

Source: {???, plural, one {{{count }} ONE } other {{{count }} OTHER }}

Actual:

Result: Plurals{zero='null', one='{{count', two='null', few='null', many='null', other='{{count'}

Expected:

Result: Plurals{zero='null', one='{{count}} ONE', two='null', few='null', many='null', other='{{count'}} OTHER}

@michael-wirth
Copy link
Author

The following regex pattern with a positive lookahead might fix the issue.

"(zero|one|two|few|many|other)\\s+\\{(.+?)\\}(?:(?=\\s+(?:zero|one|two|few|many|other) \\{)|\\}\$)"

@Petrakeas
Copy link
Contributor

The plurals ICU string implementation in the SDK is a really simple one to allow the conversion between Android's plurals and the ICU plural format used by Transifex.

If the implementation improved to support placeholders, how would they be utilized in Android?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants