AlexanderZaytsev / react-native-i18n

React Native + i18n.js
MIT License
2.18k stars 493 forks source link

How to use Angular i18n json syntax translation file in react native. #274

Closed akunal1 closed 3 years ago

akunal1 commented 3 years ago

Hi,

in our angular website we are using i18n . Now we are creating react native app for the same website and instead of using different translation file we are planning to use same .

issue: Angular i18n syntax for plural and selection is totally different than react native i18n. is there any way to use angular i18n syntax in react native app.

Please find bellow json format and kindly help if we have any solution or work-around for react native.

// en_en.json

{
"has-expired": "<ph name=\"INTERPOLATION\"><ex>{{alert.uniqueId}}</ex>{{alert.uniqueId}}</ph> has expired.",
"sent-msg": "Message was sent to the phone: <ph name=\"INTERPOLATION\"><ex>{{mb1}}</ex>{{mb1}}</ph> *** *** <ph name=\"INTERPOLATION_1\"><ex>{{mb2}}</ex>{{mb2}}</ph>",

 "your-profile": "{VAR_SELECT, select, en_GB {Your Profile} de_DE {Ihr Profil} fr_FR {Votre profil} }",
"select-country-language": "{VAR_SELECT, select, en_GB {Please select country and language} de_DE {Bitte wählen Sie Land und Sprache aus} fr_FR {Veuillez sélectionner votre pays et votre langue} }",

"search-results-count": "<ph name=\"INTERPOLATION\"><ex>{{searchCount}}</ex>{{searchCount}}</ph> <ph name=\"ICU\"><ex>{searchCount, plural, =1 {...} other {...}}</ex>{searchCount, plural, =1 {...} other {...}}</ph>",
  "search-results": " <ph name=\"INTERPOLATION\"><ex>{{searchResults}}</ex>{{searchResults}}</ph> <ph name=\"ICU\"><ex>{searchResults, plural, =1 {...} other {...}}</ex>{searchResults, plural, =1 {...} other {...}}</ph>",

}
akunal1 commented 3 years ago

I found out that above extracted syntax are done Angular i18n. can not be used in react native.