[Kde-games-devel] Game introduction: Nonogram

Ian Wadham ianw2 at optusnet.com.au
Wed May 14 00:49:27 CEST 2008


On Wed, 14 May 2008 03:14 am, Tom Vollerthun wrote:
> The actual puzzle-data is packaged into tar files which are located and
> loaded at runtime, so that game packages can be provided.
>
I recommend you avoid the use of tar files.  The KDE game called
KGoldrunner used to have an individual file for each level and these
(100s of them) were packaged into tar files for release and installation
in KDE.  That caused endless problems because tar works differently
in different UNIXes and Linux and also depending whether you are
untarring and installing as "root".  And nowadays KDE games are
being installed in Windows and Apple systems ...

In the end I grouped the level files into one file per game and wrote
a special input class to load levels, but that is an extreme solution.

> Together with the 
> game data, I want to have some kind of description file which can contain
> the name, some descriptive text (perhaps an artistic license?) and a hint.
> Unfortunately I am not at all sure on how to go about designing these
> description files in a way that makes them accessible to translations.
>
Translating strings from in-game data-files and graphics-files is a bit of
a black art.  Using *.desktop files, as Albert suggested, will take you a
certain distance but you do not want to end up with 100s of them.  Also
they might not be good at handling long hints, if you have them.

XML is another way to go.  Or you can dress up your data to look like a
dummy *.cpp or *.h file, as KGoldrunner has done, and get XGETTEXT
to scan it and extract strings for translation, via a Messages.sh script,
just as if it was a program file - but of course you never compile it ;-)

Have a look at the tutorials on internationalization (i18n) and
localization (l10n) in KDE's Techbase:

http://techbase.kde.org/Development/Tutorials#Localization

especially the one about Challenges - but *after* you have read the
introductory Localization tutorials.

> Should the Strings be all in one file like Name=..., Name[dk]=... as in the
> desktop-files? Should there be subdirectories for each locale? How can I
> determine the preferred locale?
>
If you do this, you can use KDE and KDE Games library classes to parse
your data, whether you put it in a .desktop file or some other file extension
of your own choosing.  "Scripty" can extract strings for translation, but
only if they have some standard tag, such as Name=.  This what many
KDE games now use for holding meta-data about graphics themes.

All the best, Ian W.

P.S. Name[dk]= is automatically inserted by Scripty (which runs regularly),
after a human translator has provided a translation for the English Name=
(which is the only bit you have to write).


More information about the kde-games-devel mailing list