Create Translations
How to create translations.
Categories:
Setup Languages
Setup your Translations by creating a YAML file containing the default translation, the list of languages you want to translate, and the output formats for the Translations.
See Translations for details on the format.
Here is an example script:
cat > translations.yaml <<EOF
defaultCode: en
iso639Codes:
de: Deutsch
en: English
outputs:
- format: typescript
package: index
path: ../web/src/lib/yaml8n
translations:
EOF
Add Translations
You can add translations to this file by creating a new key under translations:
:
translations:
HelloWorld:
context: Greeting
en: Hello World
Note
Start by copying strings from your existing codebase into this file when converting an existing codebase to use YAML8n. Give the translations meaningful, specific names like WebModalPayment. If you start sharing translations, add a prefix like Global.You don’t have to add every language code (in the example above, de
is missing). YAML8n will warn on missing translations so you can add them later.