Translation files
Each locale has its own YAML files inside:
<world>/narrativecraft/locales/<locale>/For example:
<world>/narrativecraft/locales/en_us/chapter_1.yml
<world>/narrativecraft/locales/fr_fr/chapter_1.ymlRun /nc locale sync to add missing keys to all existing locales, or /nc locale add <locale> to create a new locale with every key currently used by the story.
Fill the generated values
New entries have an empty value:
chapter_1.market.welcome: ""
chapter_1.market.buy: ""
chapter_1.market.leave: ""Keep each key unchanged and write its translation after :.
English:
chapter_1.market.welcome: "Welcome to the market, %user%!"
chapter_1.market.buy: "Buy apples"
chapter_1.market.leave: "Leave the market"
chapter_1.market.apples_left: "There are %count% apples left."
chapter_1.market.title: "The market"French:
chapter_1.market.welcome: "Bienvenue au marché, %user% !"
chapter_1.market.buy: "Acheter des pommes"
chapter_1.market.leave: "Quitter le marché"
chapter_1.market.apples_left: "Il reste %count% pommes."
chapter_1.market.title: "Le marché"Putting text between double quotes is recommended. It prevents characters such as : or # from being interpreted as YAML syntax.
WARNING
Do not translate the key on the left. The same key must be used in the Ink file and in every locale.
Nested YAML
NarrativeCraft generates flat keys, but nested YAML is also supported.
These two formats are equivalent:
chapter_1.market.welcome: "Welcome!"chapter_1:
market:
welcome: "Welcome!"Using the generated flat format is usually simpler, especially when synchronizing several languages.
Both .yml and .yaml files are supported. You can also organize them in subfolders inside the locale folder.
Missing translations
When NarrativeCraft displays a key, it looks for the text in this order:
- The locale selected by the player.
- The default locale.
- The translation key itself.
An empty value is considered missing. This means you can publish a partially translated locale and let its missing entries use the default language.
For example, if fr_fr contains:
chapter_1.market.welcome: ""The English value is displayed when en_us is the default locale. If the English value is also empty or missing, the player sees:
chapter_1.market.welcomeSeeing a translation key in game usually means that its value is missing from both the selected and default locales.
Apply your changes
After editing only YAML files, run:
/nc locale reloadThis reloads translations without recompiling the story.
After editing an Ink file, run:
/nc story reloadThis recompiles the story and reloads the translations at the same time.
The currently displayed dialog or choices are refreshed when translations are reloaded. A text overlay that is already visible keeps its current text and uses the new translation the next time it is displayed.