nexys-system / react-i18n

i18n small library for react. Integrates easily with any backend

Home Page:https://nexys-system.github.io/react-i18n/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I18n for React

NPM package NPM package Prettier Test Package Publish Deploy

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 = () => <p>{i18n.translate('myStringToBeTranslated')}</p>;

export default Wrapper(i18n, UI);

see https://github.com/nexys-system/react-i18n/blob/master/src/app.tsx for more information.

About

i18n small library for react. Integrates easily with any backend

https://nexys-system.github.io/react-i18n/


Languages

Language:TypeScript 94.4%Language:HTML 5.2%Language:JavaScript 0.4%