https://github.com/nexys-system/react-i18n
i18n small library for react. Integrates easily with any backend
https://github.com/nexys-system/react-i18n
i18n i18n-react javascript nexys nodependence react typescript
Last synced: 2 months ago
JSON representation
i18n small library for react. Integrates easily with any backend
- Host: GitHub
- URL: https://github.com/nexys-system/react-i18n
- Owner: nexys-system
- Created: 2021-08-20T13:12:27.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-31T00:02:34.000Z (over 2 years ago)
- Last Synced: 2025-01-24T02:59:32.358Z (over 1 year ago)
- Topics: i18n, i18n-react, javascript, nexys, nodependence, react, typescript
- Language: TypeScript
- Homepage: https://nexys-system.github.io/react-i18n/
- Size: 444 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# I18n for React
[](https://www.npmjs.com/package/@nexys/react-i18n)
[](https://www.npmjs.com/package/@nexys/react-i18n)
[](https://prettier.io/)
[](https://github.com/nexys-system/react-i18n/actions/workflows/test.yml)
[](https://github.com/nexys-system/react-i18n/actions/workflows/publish.yml)
[](https://github.com/nexys-system/react-i18n/actions/workflows/deploy.yml)
I18n implementation.
## Features
- get strings from a backend
- strings are cached in the local store
- untranslated strings are added to the local store
## Get Started
### Installation
`yarn add @nexys/react-i18n`
### Intialization
```
import I18nService from '@nexys/react-i18n';
const i18n = new I18n(); // this needs to be done once
i18n.init(); // gets the strings
i18n.translate('myStringToBeTranslated')
```
#### With wrapper
```
import I18nService from '@nexys/react-i18n';
const i18n = new I18n(); // this needs to be done once
const UI = () =>
{i18n.translate('myStringToBeTranslated')}
;
export default Wrapper(i18n, UI);
```
see https://github.com/nexys-system/react-i18n/blob/master/src/app.tsx for more information.