[aquaria] [PATCH] Multi-Language support

Henrik Holst henrik.holst2 at gmail.com
Tue Apr 3 06:32:58 EDT 2012


Hello Aquaria Community,

  here is a patch set that enables multi-language support in Aquaria.
Setting the desired language to use is done using the config file with a
new element "Locale" under the "System" element:

"<System>
    <Locale name="en" />
"

If not set then the system default will be used. Left to do is to implement
the "get the system default language" for Windows since that requires quite
a long translation table and I just want to make sure first if this
work/design is accepted by the community before I begin that task :)

The way the patch works: say user is on a Swedish system (system
locale/language is sv_SE), then when Aquaria wants to open a text file that
supports multiple languages we stat files in the following order (if the
requested file is file.txt):

file-sv_SE.txt
file-sv.txt
file.txt

And the first file that stat() returns success with we give back to Aquaria
to use.

That way it's possible to support regional variants of languages while at
the same time bailing back to the original (english) file if no language
specific file is found. This is also implemented when reading text files
from mods so mods can contain translations as well.

The following text files have multi-language support with this patch:

data/ingredients.txt
data/help_header_mac.txt
data/help_header.txt
data/help_bindsong.txt
data/help_energyform.txt
data/help_start.txt
data/help_end_mac.txt
data/help_end.txt
data/achievements.txt
data/stringbank.txt
scripts/vox/*.txt (audio/*.txt for mods)

One problem that I can see though is that the scripts/vox/ directory can
get very crowded so perhaps we should have separate directories per
language there like scripts/vox/it/ scripts/vox/ru/ and so on? Or we should
break out all translatable text files into a new root directory "locales"
with language sub-directories like

locales/it/ingredients.txt
locales/it/vox/*.txt

And then move the originals into locale/en/ ?

Anyways, here is the first version of the patch. Attached since GMail
messes up included diffs from what I've learned.

/Henrik Holst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/aquaria/attachments/20120403/0b79991b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multilang.patch
Type: application/octet-stream
Size: 7990 bytes
Desc: not available
URL: <http://icculus.org/pipermail/aquaria/attachments/20120403/0b79991b/attachment.obj>


More information about the aquaria mailing list