Multilanguage map prototype (Translation Tutorial)

Status
Not open for further replies.
Level 20
Joined
Jan 3, 2022
Messages
347
I'm going to write down stuff here, maybe I will turn it into a tutorial, maybe not.

First, it's important to understand how MPQs work​

MPQs are like ZIP files. But the way the game accesses them makes it easy to create patches without actually changing the old file. It'll help if you look up what "patch" means in your language.
Let's have Warcraft 3 ROC as an example here. The game released with "war3.mpq" and it was never changed, even with patches released. Instead, it's contents were overshadowed by "war3patch.mpq" - this file contained all the changed files. How does it work? The game loads files by looking in different folders/MPQs for them. The first correct file it finds is loaded.
  1. Priority HIGHEST: Local Files ("Allow Local Files") - if your game folder has any files, they'll be preferred for loading
  2. Priority HIGH: Map files - your map file always overrides the default game files
  3. Priority MEDIUM: war3patch.mpq - because this is loaded before war3.mpq, the patches override 1.0-release files
  4. Priority LOW: war3.mpq - contains base models etc.
The game doesn't actually work with priorities, files are processed in order. Game's MPQs are always last and user files are first. This way it is possible to override the default language file of a map, because if a translated file is found, it is loaded for the player.

PS: Don't quote me on the above order. Idk if Local files are checked before map files.

Second, war3map.wts​

This file contains all strings that WorldEditor knows about: GUI triggers, object data, map name... Each string gets a unique numeric ID when you edit+save the map. Again, these IDs change. TRIGSTR_1234 is how they're referred to in war3map.j (converted within game API automatically). You can translate each text string in notepad by hand, but it will be too much work to keep the IDs updated between versions.
TODO: Scripts for conversion, translation system integration?

Reforged multilingual maps:​

Similar to game patches, Reforged checks different folders to load files from, before taking a map's default text string file (.wts). To make per-localization language files, for example: text translations, audio, textures (will war3map.j work?) you must place them in the correct folder within the map's MPQ archive. Here's the hierarchy:
Code:
.
├── _Locales
│   ├── deDE.w3mod
│   │   └── war3map.wts (LOADED FOR GERMAN PLAYERS)
│   ├── enUS.w3mod
│   │   └── war3map.wts (LOADED FOR ENGLISH PLAYERS)
│   ├── esES.w3mod (CHECKED FOR SPANISH/España players)
│   ├── esMX.w3mod (CHECKED FOR SPANISH/Latinamerica players)
│   ├── frFR.w3mod
│   ├── itIT.w3mod
│   ├── koKR.w3mod
│   ├── plPL.w3mod
│   ├── ptBR.w3mod
│   ├── ruRU.w3mod
│   │   └── war3map.wts (LOADED FOR RUSSIAN PLAYERS)
│   ├── zhCN.w3mod (Chinese, Mainland)
│   └── zhTW.w3mod (Chinese, Taiwan)
├── conversation.json
├── war3map.doo
├── war3map.imp
├── war3map.lua
├── ... etc etc.
├── war3map.wts (THIS IS THE MAP'S DEFAULT STRING FILE! LOADED IF THE ABOVE FAILS)
├── war3mapImported/ (this folder is empty)
├── war3mapMap.blp
└── war3mapUnits.doo
The _Locales folder was created for me when I saved a map as a folder in the Reforged editor.

The attached test map "Multilang map v1.0.w3x" shows that the custom peasant will have different names/tooltips in English/German/Russian localizations. However since I did not add a custom war3map.wts file for other languages, map's default war3map.wts will be loaded. To make it easy:
  • English: is called OVERRIDE EN
  • German: is called OVERRIDE DE
  • Russian: is called OVERRIDE RU
  • Default WE: it's in Russian too, but called DEFAULT WE

Reforged Method of Multilang Maps:​

PROs: Ease of use
CONs: Not compatible with old clients


Pre-reforged multilingual maps:​

Prototype map added, it uses Classic-only method though it works fine in Reforged.
Information taken from here: [Solved] - How to make a multilanguage map, credited: Ayane (2008)
Claims to you need to delete "(attributes)" file

How to do:​

  1. Open finished map in MPQEditor
  2. Extract war3map.wts (Language code: 0000 = "Neutral" aka default)
  3. Translate extracted war3map.wts
  4. In MPQEditor, temporarily set the default war3map.wts localization code to something else
  5. Import your translated war3map.wts and set its correct code
  6. Revert default war3map.wts'es language code to 0000 Neutral
  7. If your default war3map.wts is not in English, either:
    1. Make the English translation the default variant (0000)
    2. OR repeat the above steps to add the English war3map.wts to all localization codes. So if you haven't translated the map to Chinese, Chinese players will see English as their default
mpqeditor-set-locale-code.png

How to test:​

Classic: "To test the translation you can change the LANGID field in the config.txt file inside your war3.mpq." (not tested).
Reforged: Set game's text language in Battle.net

Classic Method of Multilang Maps:​

PROs: Works with old maps, Classic client AND Reforged! If you have a 1.26/1.27 map, you can keep compatibility with old clients and Reforged will pick up the translations too.
CONs: You must use old WorldEdit and you can't store war3map.wts in different folders as easy as with Reforged. You must merge translations manually/programmatically into map's MPQ and set their language code.

LANGID or Windows' Language Codes​

The full list is at MSDN, here's shorter and more readable list. It's a hexadecimal number. MPQEditor uses upper-case letters (e.g. war3map#041E.wts). The French multilang tutorial listed some, but I don't know if all of them existed, please confirm (or look up config.txt in war3.mpq for different versions)
MPQEditor documentation lists most, if not all, used languages: MPQ Archives - MPQ file format
Locale / LanguageHexadecimal code (base 16)Decimal code (base 10)
Chinese (Simplified)
zh-CN
08042052
Chinese (Traditional)
zh-TW
04041028
Czech
Classic only
04051029
English (US)
en-US
04091033
English (UK)
Not localized for Reforged. Did it exist?
08092057
French
fr-FR
040c1036
German
de-DE
04071031
Hungarian
Fan-made patch, what LANGID code?
040e1038
Italian
it-IT
04101040
Japanese
Classic only
04111041
Korean
ko-KR
04121042
Polish
pl-PL
04151045
Russian
ru-RU
04191046
Spanish
es-ES
Classic+Reforged
040a1034
Spanish
es-MX
Reforged only
080a2058
Portuguese (Brazilian)
There's only pt-BR in Reforged
04161046
Portuguese (Portugal)
Did it exist?
08162070
Thai
Classic only
041e1054
Turkish
Did it exist?
Fan-made 3rd party patch. What LANGID?
041f1055


What should you do?​

Ideally the map's default should be in English, because it's the language everyone understands, and even better if you developed the map in English too, so it always works. All other languages should be .wts translations that use the _Locales folder/classic method to override the text strings.

If you manage the map in another language: just continue! If you add a valid translation, it will automatically override your default language. But you will need to override all possible localizations with the English file, so for example Chinese players don't see your "default language", but the English translation.

Quirks: Custom Jass code (TODO)​

Probably the only way to export messages to .wts is to define a GUI variable per text string used.

Quirk: 1.26 client only loads default war3map.wts in menu​

When you scroll down the list of maps, it'll only display the 0000 Neutral language, the default one. If you click on the map, the preview will load your correct language file.
Reforged loads the correct text file everywhere (I think this is why the map menu's freeze for so long)

Extra: other overridable paths in Reforged​

I extracted these folders from the Reforged's CASC. I don't know if these paths are loaded for maps/in what order:
Code:
war3.w3mod/ (this folder is in the root of CASC)
    _balance/
        custom_v0.w3mod
        custom_v1.w3mod
        melee_v0.w3mod
    _deprecated.w3mod/
    _hd.w3mod/
    _locales/ (_locales/ in CASC, _Locales for WorldEditor)
        dede.w3mod
        enus.w3mod
        eses.w3mod
        esmx.w3mod
        frfr.w3mod
        itit.w3mod
        kokr.w3mod
        plpl.w3mod
        ptbr.w3mod
        ruru.w3mod
        zhcn.w3mod
        zhtw.w3mod
 

Attachments

  • Multilang map v1.0.w3x
    19.6 KB · Views: 26
  • Multilang1.26 v1.0.w3x
    14.7 KB · Views: 28
Last edited:
Probably the only way to export messages to .wts is to define a GUI variable per text string used.
Only unmodified GUI strings are pushed automatic into the wts.
No: a + b string.
No: a = "xxxx".

Since one can load custom fdf/toc, one can add new entries into the Stringtable of GetLocalizedString(string key). By using custom TOC and fdf - StringList. Unlike wts the fdf-StringList can have any String Key not only TRIGSTR_xxxxx. Might be quite a nice option when writting code. I mean GetLocalizedString("TRIGSTR_xxxxx") vs GetLocalizedString("MyWantedKey").

Bad thing is that toc/fdf loading is not Saved & Loaded by Warcraft 3's save game system.
 
Status
Not open for further replies.
Top