How to set up the Client for a new Localization set

Timbab

Administrator
Staff member
Administrator
Moderator
Joined
Oct 6, 2010
Messages
1,057
Location
Magna Germania
So I'm only going to give a quick run down because I just looked into it for someone at SWGEmu, I might expand/make it more detailed in the future.

Basically, as far as I could tell, localization isn't hardcoded whatsoever, it defaults to English, but you can easily add in new layers of translation.

The client reads two variables in "options.cfg" which determine the localization, one for .STF files and one for the font set, for example:

English localization
Code:
[SharedGame]
    defaultLocale=en
    fontLocale=en
Japanese localization
Code:
[SharedGame]
    defaultLocale=ja
    fontLocale=j5


defaultLocale -- How to set up the translations

Near everything text wise in the game can be found in the .STF files (string/xx/<filename>.stf), any file that links to a value in these .STF files, does so by simply stating the filename itself, for example "obj_n" or a particular path beyond "string/xx/", for example "faction/faction_names".

So as a full example, when an object file might link to the .STF key "coal_bin" inside of the file "obj_n", it'll check the "defaultLocale" that was set in options.cfg and then proceed to look up that file, so for example, if the "defaultLocale" had been "de", it would look up this .STF file in "string/de/obj_n.stf" and then grab whatever value "coal_bin" contains. If it couldn't find the key or the .STF in this localization, it'll go and try the actual default localization which is the English one, so using the same example, it would then instead look at "string/en/obj_n.stf" and grab the value from there.

Due to how this is set up, it should be extremely straight forward to add in a new localization with relative ease, so for example, taking the example I've used above:

  • 1. Change the "defaultLocale" in "options.cfg" to your desired locale tag (This can be anything you want), "de" in this example, so:
    Code:
    [SharedGame]
        defaultLocale=de
  • 2. Create a folder called "de" inside of your "string" directory.
  • 3. Either copy or create a new .STF in that directory with the same name and inside of this file, the same ID's/Key's that were used in the English .STF file, only with your translated Value. Note that, as I've mentioned above, if it can't find something in this localization, it'll simply grab the English variant, so you only need to actually add and modify what you actually want localized, you don't need to copy and move everything.
It should be this simple. I haven't checked if the "defaultLocale" tag can be longer than two characters, but I think it can, maybe.



fontLocale -- How to set up localization specific font sets

Font's are linked/setup in "ui/ui_textstylemanager.inc".

You can add in multiple different sets for different languages and it seems they're always prefixed with "Fonts_" and then have the identifier, for example in "options.cfg", the Japanese localization's "fontLocale" was set to "j5" and if you look at, inside of "ui/ui_textstylemanager.inc":

Code:
Fonts_j5='font/ja/swgdfgotp2_20.inc
font/ja/swgdfgotp2_14.inc
font/aurabesh_12.inc
font/aurabesh_18.inc
font/aurabesh_24.inc'
This seems to be the font set that was marked as "j5".

I can't really get into how to create new fonts at the moment, because you'd ideally need a tool for it, but basically you have .INC files (XML syntax) in "ui/font/" that setup/map each character from a .DDS texture file found in "texture/font/".

So for example, inside one of the font. INC files, you'll have:

"SourceFile='font/aurabesh_12_000'"

Which points to:

"texture/font/aurabesh_12_000.dds"

And that's basically that.

There might be third party tools that can generate new font maps, but I haven't found one yet I don't think, maybe one that sorta worked in the past but not really. Unless someone beats me to it, I'll make a tool at some point, but this could also be done manually of course in theory, it's just a lot of work.


I will try to go into more sometime in the future.
 
Top Bottom