i18ncloud
  • Introduction
  • Getting Started
  • React
    • Getting Started
    • Keys and Values
  • Commands
    • i18ncloud init
    • i18ncloud Push
    • i18ncloud Pull
    • i18ncloud Language
    • i18ncloud Key
Powered by GitBook
On this page

Was this helpful?

  1. React

Keys and Values

To use the keys with the react-i18next syntax

{t('key_name')}

you will need to have a value for it; otherwise, the value key_name will be used as default.

To have the text you wish (to replace the keys you are using in your app), you just need to change the files with those texts.

After the init command, the i18ncloud creates the directory i18n in the src directory. Inside this directory, you can find the files of all the languages you added with the i18ncloud Tool.

Each file should have the following structure:

{
    translation:{
    }
}

The next step is rather simple: either you use the command i18ncloud key which will add the input key with the input value to each language file, or you can manually add them.

The end result should be something like this:

{
    translation:{
        "key_name": "key_value",
    }
}

Remember that the language files are JSON. Therefore, both key and value have to be in between".

The language that the tool will use as default is present in the file index, inside the i18n directory, in the field lng . If you wish to change the language in which the texts will be displayed, simply change this field manually or use the i18n.changeLanguage("target_language")

PreviousGetting StartedNexti18ncloud init

Last updated 5 years ago

Was this helpful?