Usage
Components
<MercurioProvider>
Wrap you app with the MercurioProvider
component:
locale
(optional)
Provides a current locale in case you don't want to use the internal context.
initialLocale
(required)
Must be one of the previously configurated in babel plugin
defaultMessage
(optional)
A default message in case of missing translation.
<Mercurio>
The translation itself:
id
(required)
The id of the translation.
extra
(optional)
An object to be injected into the translated message.
children (optional)
The children is the default value for the ID. It'll be copied to all locales files (only on creation of the variable, don't worry, it won't mess with your translations).
useLocale
hook
A hook to get and set the locale:
Generated files
Locales files
To edit the translations, just edit the locales files located in the locales
folder, inside the folder specified in the Babel plugin (or in projectRoot/mercurio/locales
if no path was specified).
Translations file
This is a file located in the root of your Mercurio's filesOutput
path. It's autogenerated and you shouldn't change anything in it. If you do, it'll recompile and revert what you did.