fabriciovergara / react-native-localizable

Let the platform take care of internationalization! ...and reduce your bundle.js
MIT License
4 stars 0 forks source link

Super cool, plurals? #1

Open Noitidart opened 6 years ago

Noitidart commented 6 years ago

Very cool lib. Does it have plans for support for plurals?

fabriciovergara commented 6 years ago

Plurals feature would be great, but since iOS doesn't have native support I'm still trying to figure out a good way implement it.

I was thinking to follow Android way but using a prefix in the string: https://developer.android.com/guide/topics/resources/string-resource.html?hl=pt-br#Plurals

"PLURALS_ZERO_MY_LABEL_NAME" = "No song found";
"PLURALS_ONE_MY_LABEL_NAME" = "%d song found"";
"PLURALS_OTHER_MY_LABEL_NAME" = "%d songs found"";
Localizable.MY_LABEL_NAME(0) // No sound found
Localizable.MY_LABEL_NAME(1) // 1 song found
Localizable.MY_LABEL_NAME(2) // 2 songs found

I'm open for any suggestion :)

Noitidart commented 6 years ago

Thanks for your optimism and giving hope here! I dont have experience with localizing in native, but I agree with you it totally makes sense to follow the Android way if iOS doesn't.