Difference between revisions of "Localization"

From Imperator Wiki
Jump to navigation Jump to search
(Localisation modding)
(Expanded on encoding, formatting, and color codes)
Line 1: Line 1:
{{Version|1.0}}
+
{{Version|1.4}}
{{Expand}}
+
 
 +
== Localization modding==
 +
Localization is handled by .yml files in the game/localization folder.  An advanced text editor like [https://www.notepad-plus-plus.org/ Notepad++] and [https://code.visualstudio.com/ Visual Studio Code] is recommended, however, if those aren't available, even standard Notepad will work. The naming convention for .yml files is '''<file>_l_<language>.yml''' where <file> is the name given for this group of localizations, and <language> is the language the localization is for.  Supported languages currently include English (''english''), French (''french''), German (''german''), Russian (''russian''), Spanish (''spanish''), and simplified Chinese (''simp_chinese'').
 +
 
 +
=== Creating Localization Files ===
 +
* In the root mod folder (not in common), create a folder named "''localization''" (Note: Imperator uses localization with z, not an s).
 +
* Optionally, create language subfolders within the "''localization''" folder. This is organizationally helpful but not required.
 +
* Localization files are encoded as UTF-8-BOM. The easiest way to get the correct encoding is to copy an existing .yml file and modify it.
 +
* Alternatively, simply create a standard text file and save it as .yml with UTF-8 with BOM encoding. Various text editors, such as [https://www.notepad-plus-plus.org/ Notepad++] and [https://code.visualstudio.com/ Visual Studio Code], will allow you to manually save with encoding UTF-8 with BOM
 +
* The file name must end in "''_l_<language>''", with the language setting it will appear for
 +
* The first line of any localization file must also be <code>l_<language>:</code>.
 +
* Vanilla localization files do not need to be replaced, instead, simply add a new file with new entries
 +
* If you wish to change a vanilla localization, save your file within the "''replace''" folder. Any file in localization/replace will load after other localization files, and will overwrite any duplicate entries.
 +
* The number seen in vanilla files right after the colon can be omitted, as it is only useful for Paradox's internal translation tracking.<ref>https://twitter.com/Martin_Anward/status/1039175213773144066 </ref>
 +
* Each string to be displayed in game is encased in quotation marks. To display quotation marks in game, input a backslash before each quotation mark (for example: <code>text \"name\"</code>)
 +
* Note that the following unicode characters are invalid inside the localisation file and will generate a "?" instead: <code>„ “ ‚ ‘ – ” ’ … —</code>
  
== Localisation modding==
 
Localization modding is very simple, all localization is handled by .yml files in the localization folders which can be edited by advanced text editors like notepad++, if you want to mod existing localization, you have to search through .yml files however you can to find the game code whose localization you want to edit, but if you made new game code and want to include that's even easier. Just make a new .yml file while keeping the text syntax the same.
 
 
<pre>
 
<pre>
 
l_english:
 
l_english:
Line 15: Line 28:
 
  wonder_library_of_alexandria:0 "Library of Alexandria"
 
  wonder_library_of_alexandria:0 "Library of Alexandria"
 
</pre>
 
</pre>
 +
  
 
== Color Codes==
 
== Color Codes==

Revision as of 00:29, 23 May 2020

Localization modding

Localization is handled by .yml files in the game/localization folder. An advanced text editor like Notepad++ and Visual Studio Code is recommended, however, if those aren't available, even standard Notepad will work. The naming convention for .yml files is <file>_l_<language>.yml where <file> is the name given for this group of localizations, and <language> is the language the localization is for. Supported languages currently include English (english), French (french), German (german), Russian (russian), Spanish (spanish), and simplified Chinese (simp_chinese).

Creating Localization Files

  • In the root mod folder (not in common), create a folder named "localization" (Note: Imperator uses localization with z, not an s).
  • Optionally, create language subfolders within the "localization" folder. This is organizationally helpful but not required.
  • Localization files are encoded as UTF-8-BOM. The easiest way to get the correct encoding is to copy an existing .yml file and modify it.
  • Alternatively, simply create a standard text file and save it as .yml with UTF-8 with BOM encoding. Various text editors, such as Notepad++ and Visual Studio Code, will allow you to manually save with encoding UTF-8 with BOM
  • The file name must end in "_l_<language>", with the language setting it will appear for
  • The first line of any localization file must also be l_<language>:.
  • Vanilla localization files do not need to be replaced, instead, simply add a new file with new entries
  • If you wish to change a vanilla localization, save your file within the "replace" folder. Any file in localization/replace will load after other localization files, and will overwrite any duplicate entries.
  • The number seen in vanilla files right after the colon can be omitted, as it is only useful for Paradox's internal translation tracking.[1]
  • Each string to be displayed in game is encased in quotation marks. To display quotation marks in game, input a backslash before each quotation mark (for example: text \"name\")
  • Note that the following unicode characters are invalid inside the localisation file and will generate a "?" instead: „ “ ‚ ‘ – ” ’ … —
l_english:
 wonder_lighthouse_of_pharos:0 "Lighthouse of Alexandria"
 wonder_giza:0 "Giza Pyramid Complex"
 wonder_halicarnassus:0 "Mausoleum at Halicarnassus"
 wonder_tomb_of_alexander:0 "Mausoleum of Alexander"
 wonder_tomb_of_alexander_entity:0 "Mausoleum of Alexander"
 wonder_colossus:0 "Colossus of Rhodes"
 wonder_dodona_oracle:0 "Oracle of Dodona"
 wonder_library_of_alexandria:0 "Library of Alexandria"


Color Codes

Inserting a hastag(#) followed by a letter and a space will change the text color in any localization string, #! will reset the color to the default. Definitions for # codes can be found in jomini/gui/jomini/basetextformatting.txt

Code Color
#Y Blue
#G Green
#R Red
#TF Light grey
#T Gold
#! Default


Documentation EffectsTriggersModifiersScopesVariablesData TypesLocalisationCustomizable localization
Scripting AIBuildingsCasus belliCharacterCharacter InteractionsCombat TacticsCountriesCultureDecisionsDefinesEconomic PoliciesEventsEthnicitiesGovernmentGovernor PoliciesIdeasModifiersMilitary TraditionsOfficesOn ActionsPartiesPricesPopsProvince setupReligionScript ValuesScript ModifiersSubject TypesTechnologyTrade goodsTraitsUnits
Map MapTerrain
Graphics 3D ModelsInterfaceCoat of armsGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumMod structureTroubleshooting