Modding: Localization
Localization files are used to provide the different languages in which the game can be played.
It is possible to create a similar file structure in your own Add-on or Adventure.
This way, you can alter existing languages or provide your own.
File structure
In ~DivinityEngineDataPath~\Data\Editor\Localization\English you can find example files that show the file structure:
- Gender/Female/english.xml: contains specific lines when the speaker's gender is taken into account (speaker is female).
- Gender/Female/english_to_F.xml: contains specific lines when the speaker's gender and the person they're talking to are taken into account (both known female). [Does not exist for English example files]
- Subtitles/...: Contains subtitle files for all videos. Videos files themselves are not provided due to size. You can also add new files here if your project has custom movies.
- english.xml: Contains all regular lines for the specific language (English in this example)
- english_to_F.xml: Contains specific lines when the addressee's gender is female (male addressing female). [Does not exist for English example files]
- language.lsx: Defines the language by name. This is a copy of the file in ~DivinityEngineDataPath~\Data\Localization. The file in that location determines which language is active in-game.
Language Spreadsheet
The spreadsheet at ~DivinityEngineDataPath~\Data\Editor\Localization\loca_full.xls contains all the game's english lines.
It is recommended to use this file for translating a language, opposed to manually editing the language.xml files.
The spreadsheat has columns for the different types of translations, which can be exported:
- column F: translation - male to male or default translation
- column G: translation_F - female speaker to male or to anyone if H not filled in
- column H: translation_to_F - male to female or any to female if I not filled in
- column I: translation_F_to_F - female speaker to female speaker
Best Practice
- Do not sort or reorder anything. Only type in columns F to I.
- Developer comments, context and other information is available in columns J, K, L, etc.
- In "DIALOGUES" tabs, if you are wondering who says the line, look at column N and O.
- Columns G, H and I are only for "DIALOGUES" tabs and are not taken into account in any other tab.
Exporting
The translations from the different columns go to the following files:
- column F: ~DivinityEngineDataPath~\Data\Editor\Mods\YourMod\Localization\YourLanguage\YourLanguage.xml
- column G: ~DivinityEngineDataPath~\Data\Editor\Mods\YourMod\Localization\YourLanguage\YourLanguage_to_F.xml
- column H: ~DivinityEngineDataPath~\Data\Editor\Mods\YourMod\Localization\YourLanguage\Gender\Female\YourLanguage.xml
- column I: ~DivinityEngineDataPath~\Data\Editor\Mods\YourMod\Localization\YourLanguage\Gender\Female\YourLanguage_to_F.xml
The Visual Basic script, at ~DivinityEngineDataPath~\Data\Editor\Localization\export.vb can be used to automate this process for Microsoft Excel:
- Be sure to rename the language in the script to your desired language.
- When running the script, make sure the folder structure (YourLanguage/ and YourLanguage/Gender/Female) exists at the file location of the spreadsheet, or the export will be canceled.