[aquaria] [PATCH v2] Multi-Language support

Henrik Holst henrik.holst2 at gmail.com
Sun May 20 07:09:11 EDT 2012

Here is the second version of my multi-language patch to Aquaria.

This patch set enables multi language support in Aquaria, which language to use
is determined from the system default unless the user has configured
it in the config
file with the "Locale" element under the "System" element, for example
this to hard code
the language to be "en":

    <Locale name="en" />

The patch works by adding a new function UserSettings::localisePath()
that takes a path to a file
and returns a new language specific name if one is found, if no
language specific version of the
file is found then the orginal filename is returned. So this means
that everything is completely

If told to open "scripts/vox/naija_intro-music.txt" this function will
look for and stop at the first file it finds
out of (if we assume a language of "sv_SE":

1. locales/sv_SE/scripts/vox/naija_intro-music.txt
2. locales/sv/scripts/vox/naija_intro-music.txt
3. scripts/vox/naija_intro-music.txt

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.

In this version of the patch set, the following text-files have
multi-language support:


And for mods the following text files:


What is left to do for proper multi-language support is to also load some
of the graphics and sounds this way so people can translate them as well. And
 of course the problem with the bitmap font only supporting 7-bit
english letters
must be solved one day, or we simply will load a locale specific font file...

/Henrik Holst

 Continuity.cpp           |   11 ++++--
 Game.cpp                 |   27 +++++++++-----
 StatsAndAchievements.cpp |    5 +-
 StringBank.cpp           |   10 +++--
 SubtitlePlayer.cpp       |    2 +
 UserSettings.cpp         |   85 +++++++++++++++++++++++++++++++++++++++++++++++
 UserSettings.h           |    8 +++-
 7 files changed, 130 insertions(+), 18 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multilang.diff
Type: application/octet-stream
Size: 8157 bytes
Desc: not available
URL: <http://icculus.org/pipermail/aquaria/attachments/20120520/844e2268/attachment.obj>

More information about the aquaria mailing list