1.0.3 • Published 1 year ago

@oneforx/react-translator v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@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>
    );
  }

Optimisation

Support for translation in webworker to minimize work done by main web worker, cool for large file. Not fun for old browser that don't support webworker :p

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.3

1 year ago

0.0.10

2 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago