translating: mission impossible.

Ian Wadham ianw at netspace.net.au
Sat Jun 26 08:46:39 BST 2004


----- Original Message ----- 
From: "Pupeno" <pupeno at pupeno.com>
Sent: Friday, June 18, 2004 2:53 AM
> I have created an app, with KDevelop...
> ...
> I find impossible to translate the application, lots of weird errors.
> ...
> ... am I the only one trying to translate an application?
> ...
---- On 24/06/04 Raul Moratalla also wrote:
> I'm having problems with the translation of my program.
> I generate without any problem the desired .po files, I translate them
> and I make "make install". The application developed is an "Application
> framework" generated with the template of kdevelop. When I execute it is
> still in english (the file dialogs too) and the .po file is installed in
> the correct directory.
>
Back in November I had written an application (the game
KGoldrunner) and submitted it for release with KDE 3.2.   I
did not have to worry about translation, because the various
KDE translation teams do the job for you - if you are making
your application part of KDE - and they do an excellent job!

Then the German translator wrote me that some of my messages
were staying in English.  It turned out they were messages embedded
in DATA files (game hints, etc.).  Only messages in source
and documentation files get translated (using .pot, .po, etc.).  So I
had to create a dummy "source" file (data_messages.cpp) and,
in order to test that file, I used KDevelop to create and compile
translation files for "en_GB" (UK English).

I did get it all to work, but I have forgotten how!  However
I had a lot of problems!  The main one was that if anything
at all failed, the whole translation process failed and so you
got back English at execution time.  Some problems I
remember are:

1. The .pot/.po file might not be created correctly.  The text
    strings in the .pot/.po file might be subtly different from the
    ones in your .cpp file, maybe in the handling of white space,
    but definitely in the handling of UTF-8 substrings for
    accented characters.  "Krüger" must be written as
    i18n("Krüger"), but KDevelop somehow inserted some
    extra characters between the two UTF-8 (Unicode) chars.

2. When your .po file is translated, KDevelop creates an
    "object" file (e.g. en_GB.gmo).  Where does it go?  Where
    does install put it?  Is that where i18n expects to find it at
    execution time?  You need to play with this a bit.  I think
    it has to be installed as <application_name>.mo (not .gmo)
    in <prefix>/share/local/<language>/LC_MESSAGES,
    where <prefix> is /opt/kde3 or /usr/local/kde, <language>
    is "es" or whatever and <application_name> is whatever
    your program executes as.

3. Creation of .pot files is done by "gettext", a GNU utility.
    Trouble is, the KDE team uses a patch on an OLD version
    of "gettext", which is not released with KDE.  The KDE
    "gettext" implements some KDE variants of i18n I think
    (cases where i18n has more than one parameter, maybe, but
    I'm guessing: I was never able to get those cases to work -
    I could not understand the KDE doc re the i18n function).

    However, KDevelop executes the *standard* version of
    "gettext" that comes with your distrib (e.g. /usr/bin/gettext
    or /usr/bin/xgettext), so you don't get the extra KDE features
    of i18n, if you are using them.

Hope all this helps. Ian W.


-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list