[aquaria] [PATCH] Multi-Language support

GMMan yukaili.geek at gmail.com
Tue Apr 3 18:26:49 EDT 2012


I think language files could be gathered into a catalog of sorts.
Instead of keeping multiple files, keep one big catalog for each
language for the main game and individual catalogs for each mod would
possibly reduce fragmentation and file handles needed. The other way
could be diffing files so that if one translation doesn't exist, the
default is used.
--GMMan



2012/4/3 Henrik Holst <henrik.holst2 at gmail.com>:
> 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
>
> _______________________________________________
> aquaria mailing list
> aquaria at icculus.org
> http://icculus.org/mailman/listinfo/aquaria
>


More information about the aquaria mailing list