1.0.3 • Published 8 months ago

@oneforx/react-translator v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months 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

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

1.0.3

8 months ago

0.0.10

1 year ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago