https://github.com/pimuzzo/rx-i18n
Plugin for ReactXP that provides i18n
https://github.com/pimuzzo/rx-i18n
i18n internationalization l10n localization plugin reactxp translate
Last synced: 11 days ago
JSON representation
Plugin for ReactXP that provides i18n
- Host: GitHub
- URL: https://github.com/pimuzzo/rx-i18n
- Owner: pimuzzo
- License: mit
- Created: 2018-06-19T19:34:16.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-11T13:51:14.000Z (almost 2 years ago)
- Last Synced: 2025-04-20T11:36:12.055Z (about 1 month ago)
- Topics: i18n, internationalization, l10n, localization, plugin, reactxp, translate
- Language: TypeScript
- Size: 14.8 MB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# reactxp-i18n
This module provides cross-platform support for i18n within the [ReactXP](https://microsoft.github.io/reactxp/) library.This module uses [react-native-i18n](https://github.com/AlexanderZaytsev/react-native-i18n) and [i18n-js](https://github.com/fnando/i18n-js)
## Install
`yarn add reactxp-i18n` or `npm install reactxp-i18n`
## Examples
### Basic usage
```
import { default as RXI18n } from 'reactxp-i18n';const translations = {
it: {
greeting: 'Ciao!',
},
en: {
greeting: 'Hi!',
},
fr: {
greeting: 'Bonjour!',
},
};
```
You can pass additional parameters in `customization` object to enforce some properties as `{locale: 'en'}` or for value interpolation.
### String locale
If you need the string that represents the user's locale you can use
```
import { getCurrentLocale } from 'reactxp-i18n';const locale = getCurrentLocale();
```