1.0.14 • Published 4 months ago

@coxy/i18n v1.0.14

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

@coxy/i18n

Component localization for react. Allows you to translate components individually, without storing huge localization files. Try. It's comfortable.

You can upload all translations with one command into one or several files. Then create a new translation file and import back into all files.

Install

yarn add @coxy/i18n

Setup

  1. Wrap main component I18nProvider
<I18nProvider fallback="en" language="es">  
    <AppComponent />
</I18nProvider>
  1. In AppComponent

Create index.i18n.json file in a component folder and include.

import locales from './index.i18n.json'

const { t } = useI18n(locales)

return <div>{t('title', {test: 123})}</div>

in index.i18n.json write

{
  "en": {
    "title": "Title string {{test}}"
  },
  "es": {
    "title": "Cadena de título {{test}}"
  }
}

Dump all translations

yarn i18n-dump --path ./ --output localizations --mode split

Restore all translations

yarn i18n-restore --path ./ --baseDir localizations --mode split
1.0.14

4 months ago

1.0.13

4 months ago

1.0.9

8 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.11

8 months ago

1.0.10

8 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago