[Scummvm-devel] Translation support was added to ScummVM

Pawel Kolodziejski aquadran at xtr.net.pl
Tue Jun 15 20:12:06 CEST 2010


On 2010-06-15, at 19:51, Eugene Sandulenko wrote:

> Hi team,
> 
> I am back from my vacation, and one feature I was working on during
> windy evenings was support for GUI translation (at last).
> 
> Below is brief description of the work. It is based on core developed
> by Alex Bevilacqua, but many of the details, especially GUI was
> reworked completely.
> 
> Basically now in order to make some things translatable you have to use
> one of pseudofunctions:
> 
>  _(char *) -  Main way to mark strings. You need it in majority of
>     cases.
>  _s(char *) - Function used to mark static string constants. For
>     instance, when you have static arrays which need to be translated.
>     In this case you mark these strings with _s(), and then use _() at
>     the place where you need to perform the substitution. See
>     savePeriodLabels[] array in gui/options.cpp for example.
>  _t(char *) - Function used for console messages. It applies charset
>     conversion to the output. But this feature is available only on
>     those platforms which have full blown -liconv)
> 
> If you are adding new file, you must include it into po/POTFILES file.
> 
> Translations could be produced with use of gettext tools, one of the
> best of them is Emacs po-mode. Take po/scummvm.pot file as a
> template, fill out the header, and translate the strings. Please,
> beware, that with current implementation only single byte encoding are
> supported, so no UTF-8, or it will choke.
> 
> Also it is possible to define in-place hotkeys for translation strings.
> Use ~O~pen for defining hotkey 'O'. Tildes are stripped down silently
> from the message. Non-ASCII hotkeys should be put as a parameter to
> widget constructors, just as before.
> 
> Put new translations into po/ directory, and it will pick them up by
> itself.
> 
> However, in order to compile .po files, your system have to have perl5
> installed.
> 
> Additionally, in order to update .pot files, i.e. generate strings from
> the source files, you have to have gettext tools installed. Use
> following command to update it:
> 
>   make updatepot
> 
> It is defined in po/module.mk makefile.
> 
> The implementation itself does not depend on gettext. It uses
> tools/po2c perl script for translating it into gui/messages.cpp file.
> Currently all translations are stuffed into that file as static arrays,
> but in future, once there will be more translations, it will be easy to
> move it to separate .dat file. The code changes will be minimal.
> 
> Now on limitations/TODO:
>  - Unfortunately I did not have any additional BDF files with me, and
>    without internet access, I could not test it. Thus, no support for
>    locale-defined fonts is implemented. That is, Russian translation
>    does not work as expected, it draws accented characters instead of
>    Cyrillic. All European languages should work as is, however, since
>    our BDF fonts contain all Latin-1 subset characters.

It will not work on all European languages, if it's only Latin-1 so some Polish chars will not work as they used with Latin-2.






More information about the Scummvm-devel mailing list