If you did not find specific instructions for a framework that you are using, you can still integrate mooi following these general steps.
Step 1 - Create a translations file
Create a mooi directory
mkdirmooi
Within that directory, create a translations.yaml file with your strings
# ./mooi/translations.yamllanguages:# English is assumed by default, you don't need to list it-de-fr-ru # etc.entries:-key:my_string_idvalue:Hello Worlddescription:A message that is shown on the main screen of the app # etc.
Step 2 - Define an output format
Within mooi directory, create a config.yaml file and define an output format that you would like to have. The format declaration is made using HandlebarsJS template engine where, among other syntax features, the following keywords are commonly used:
key - key of your translated string
value - value of your translated string
languageCode - language code that the format is being applied for.
Furthermore, you specify an outputPath (that will be created for you automatically) where the output will be written.
For the sake of example, let's assume that we want to have our translations in the following files:
outputs/translations_en.json
outputs/translations_de.json
etc
You would define the following format in config.yaml
We are using HandlebarJS syntax features like #unless and @last just to make sure that we are not adding a trailing coma at the end of JSON.
As the output we will then get the following output in outputs/translations_de.json
Step 3 - Run mooi
Run the following command:
You are good to go! Use the generated translations as you normally would.