Skip to content

oneforx/react-translator

Repository files navigation

This library was generated with Nx.

@oneforx/react-translator

This library is intent to be used as a translator of predefined json file that can be created with react-translator-gui website

locales.json

{"translate_key":{"fr":"Je suis une traduction","au":"I'm a translation"}}

Example of initialisation

import locales from './locales.json'

  const ExampleComponent = () => {
    const translateKey = useTranslator("translate_key");

    return (
      <div>{translateKey}<div>
    )
  }
  const ExampleComponent2 = () => {
    const translated = useTranslator();

    return (
      <div>{translated["translate_key"]}<div>
    )
  }
  const App = () => {
    return (
      <ReactTranslatorContextProvider locales={locales}>
        {/**Your components*/}
      </ReactTranslatorContextProvider>
    );
  }

About

A powerful tool for creating translating file. Web worker enabled

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published