Tutorial; Localization - HWRM/KarosGraveyard GitHub Wiki

How to Add Language Localizations to HW2 by IcePirate

Adding language localization to your new game type or mod is a nice touch that will allow people of other languages to play your mod with dialog and options that they can understand. Using localizations will not cause sync errors, according to the RDN documentation.

Language localization requires that your string text be referenced in a separate ".dat" file -- one for each language.

Assuming you are using "\moddata" for you mod directory (as described here), add a new subdirectory for each language as follows:

"\moddata\locale\english"
"\moddata\locale\french"
etc.

Within each of these subdirectories, create a new text language file and save it with the extension ".dat". Within these new files you will reference your string text to the actual text in it's native language.

A snipped example taken from "\moddata\locale\english\mp_strikers.dat" (note that 8000-8999 is reserved space for game type mods):

filerange 8000 8999
rangestart 8000 8999
8000 MP Strikers 1.5
8001 No combat capital ships allowed.
8010 Welcome to the MP Strikers Mod !
8011 No combat capital ships are available for construction.
8012 Beware - the swarm is coming !
rangeend

And, its translated French cousin, courtesy of fil:

filerange 8000 8999
rangestart 8000 8999
8000 Attaquants MP 1.5
8001 Aucun vaisseau de combat de classe "capitale" n'est autorisé.
8010 Bienvenue au Mod des Attaquants MP
8011 Aucune unité lourde de combat n'est disponible pour la construction.
8012 Attention -- Une formation arrive!!
rangeend

Getting it to work

Note: you can skip this part of the tutorial and read the Mod Packager Tutorial instead, as the information here is a bit outdated. -Mikali

To get localization to work properly, your ".big" file's "compile.list" must be expanded for multiple Tables Of Content. Why this is, I am unclear, and beat myself over the head for several hours until I got it right. Call me dense.

To add in localization TOCs, have a look at my example below and customize your own "compile.list", similarly. Note that your localization TOC name must be unique so as not to collide with other localization tables in memory.

An example of a "compile.list" with multiple TOCs for Locale use:

Archive name="mp_strikers"

TOCStart name="mp_strikers" alias="Data" relativeroot=""

FileSettingsStart defcompression="1"
Override wildcard="*.*" minsize="-1" maxsize="100" ct="0"
Override wildcard="*.mp3" minsize="-1" maxsize="-1" ct="0"
Override wildcard="*.wav" minsize="-1" maxsize="-1" ct="0"
Override wildcard="*.jpg" minsize="-1" maxsize="-1" ct="0"
Override wildcard="*.fda" minsize="-1" maxsize="-1" ct="0"
Override wildcard="*.lua" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.txt" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.ship" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.resource" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.pebble" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.level" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.wepn" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.subs" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.miss" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.events" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.madstate" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.script" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.ti" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.st" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.vp" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.wf" minsize="-1" maxsize="-1" ct="2"
SkipFile wildcard="*emptyfile.txt" minsize="-1" maxsize="-1"
SkipFile wildcard="*.avi" minsize="-1" maxsize="-1"
SkipFile wildcard="keeper.txt" minsize="-1" maxsize="-1"
SkipFile wildcard="*.big" minsize="-1" maxsize="-1"
SkipFile wildcard="*.sfap0" minsize="-1" maxsize="-1"
SkipFile wildcard="C:\Progra~1\games\Homeworld2\Data\Locale\English\" minsize="-1" maxsize="-1"
SkipFile wildcard="C:\Progra~1\games\Homeworld2\Data\Sound\Speech\
" minsize="-1" maxsize="-1"
SkipFile wildcard="C:\Progra~1\games\Homeworld2\Data\Sound\Music\*" minsize="-1" maxsize="-1"
FileSettingsEnd
C:\Progra~1\games\Homeworld2\moddata\LevelData
C:\Progra~1\games\Homeworld2\moddata\LevelData\Multiplayer
C:\Progra~1\games\Homeworld2\moddata\LevelData\Multiplayer\mp_strikers.lua
C:\Progra~1\games\Homeworld2\moddata\scripts\unitcaps
C:\Progra~1\games\Homeworld2\moddata\scripts\unitcaps\strikers_large.lua
C:\Progra~1\games\Homeworld2\moddata\scripts\unitcaps\strikers_medium.lua
C:\Progra~1\games\Homeworld2\moddata\scripts\unitcaps\strikers_small.lua
TOCEnd

English Locale TOC:

TOCStart name="STR_English" alias="Locale" relativeroot="Locale\English"

FileSettingsStart defcompression="1"

Override wildcard="*.*" minsize="-1" maxsize="100" ct="0"
Override wildcard="*.mp3" minsize="-1" maxsize="-1" ct="0"
Override wildcard="*.wav" minsize="-1" maxsize="-1" ct="0"
Override wildcard="*.fda" minsize="-1" maxsize="-1" ct="0"
Override wildcard="*.lua" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.dat" minsize="-1" maxsize="-1" ct="2"
SkipFile wildcard="*.big" minsize="-1" maxsize="-1"
SkipFile wildcard="*.sfap0" minsize="-1" maxsize="-1"
FileSettingsEnd
C:\Progra~1\games\Homeworld2\moddata\locale\english\mp_strikers.dat
TOCEnd

French Locale TOC:

TOCStart name="STR_French" alias="Locale" relativeroot="Locale\French"

FileSettingsStart defcompression="1"

Override wildcard="*.*" minsize="-1" maxsize="100" ct="0"
Override wildcard="*.mp3" minsize="-1" maxsize="-1" ct="0"
Override wildcard="*.wav" minsize="-1" maxsize="-1" ct="0"
Override wildcard="*.fda" minsize="-1" maxsize="-1" ct="0"
Override wildcard="*.lua" minsize="-1" maxsize="-1" ct="2"
Override wildcard="*.dat" minsize="-1" maxsize="-1" ct="2"
SkipFile wildcard="*.big" minsize="-1" maxsize="-1"
SkipFile wildcard="*.sfap0" minsize="-1" maxsize="-1"
FileSettingsEnd
C:\Progra~1\games\Homeworld2\moddata\locale\french\mp_strikers.dat
TOCEnd

Happy modding ! Make your mods international so more people can play them.

Related Pages

Tutorials

TutorialBigFileCreator

Discussion

Comments

Page Status

Updated Formatting? Initial
Updated for HWRM? Initial