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

Question on plurals #6

Closed
jleclanche opened this issue Jan 3, 2019 · 3 comments
Closed

Question on plurals #6

jleclanche opened this issue Jan 3, 2019 · 3 comments
Labels
question Further information is requested

Comments

@jleclanche
Copy link

Hi! Thanks for open sourcing this. Looks exciting!

Plural handling jumped out at me as very basic:
https://facebookincubator.github.io/fbt/docs/plurals

As is, it looks like a simplistic-yet-very-specific one/many handling with support for showing a counter.
Since fbt is used at Facebook (a product with a pretty involved translation) I'm curious if that is actually enough for Facebook itself?

For context, several languages (Russian for example) have many types of plurals. The ICU message syntax is my go-to for supporting these cases:
http://userguide.icu-project.org/formatparse/messages (it is used by FormatJS so should be familiar to users of formatjs projects).

@jrwats
Copy link
Contributor

jrwats commented Jan 3, 2019

The magic is tucked away in translations actually (we need to improve our documentation surrounding this). The CLDR number type corresponding to "RU" is IntlCLDRNumberType30. A translator can variate your individual source for a translation for any given token in the source. In the example's case, this would be {number of likes} in "You have {number of likes} likes on your photos". So we could have 3 separate translations for each variation: ONE, FEW, or MANY.

You can see some examples of gender variations for the hidden token, __viewer_gender__ in our translation_input.json.

I also suspect we're missing number variations in our Arabic translation for d47b9415c39a6e5e042244d77c23bb13, but I'm checking on that internally.

I'll work on making this clearer in documentation!

@jrwats jrwats added the question Further information is requested label Jan 3, 2019
@jrwats
Copy link
Contributor

jrwats commented Jan 3, 2019

You can see all the variation types available for any given translation leaf here:
https://facebookincubator.github.io/fbt/docs/translating#variation-types

@jrwats
Copy link
Contributor

jrwats commented Jan 10, 2019

OK. Pulled in more accurate AR translations to highlight number variations. https://github.com/facebookincubator/fbt/blob/master/demo-app/translation_input.json#L1932-L1979
You can see how they are variated in the demo itself as well.

Let me know if you have any more questions around this!

@jrwats jrwats closed this as completed Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants