[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n
Subject:    HOWTO: translation
From:       Stephan Kulow <coolo () itm ! mu-luebeck ! de>
Date:       1998-01-03 14:00:37
[Download RAW message or body]

Alejandro Diaz wrote:
> 
> HI there again! I do not quite get what I need to start translating packages into
> Spanish so help would be appreciated....
> 
OK, enough guys here to listen? I'll tell now all the secrets ;)
Juha Tuomala (I hope, subscribed too) has done a FAQ, but un-
fortunatly I've lost the URL to it.

If you look at www.kde.org/i18n.html, you'll find links to .pot
files in the table of applications. Those have such a format:

# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1998-01-02 15:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"

#: kdecore/kapp.cpp:407 kdeui/kcolordlg.cpp:469 kdeui/kcontrol.cpp:34
#: po/texts.cpp:43
msgid "Help"
msgstr ""

#: kdecore/kapp.cpp:412
msgid "About "
msgstr ""

#: kdecore/kapp.cpp:416 kdecore/kapp.cpp:437
msgid "About KDE"
msgstr ""


The header is currently only important for me, if I want
to know, who to contact. In the past I told the translators
they could remove it, but I've noticed, that it's very hard
to remember, who has done what, if there isn't such a header.
Currently I use the following format myself for the header:

msgid ""
msgstr ""
"Project-Id-Version: kdelibs\n"
"POT-Creation-Date: 1998-01-02 21:12+0100\n"
"PO-Revision-Date: 1997-12-28 19:46+01\n"
"Last-Translator: Stephan Kulow <coolo@kde.org>\n"  

It should work to add more translators there, if you have
updated a version.

Back to the original. You'll find a "#" followed by filenames
and line numbers. This are used to give you a hint, where to
look for, if you have doubts, how this message is used in the
application.

So, if you want to translate the file, you'll add the trans-
lation of Help behind msgstr. In german, this looks like this:

#: kdecore/kapp.cpp:407 kdeui/kcolordlg.cpp:469 kdeui/kcontrol.cpp:34
#: po/texts.cpp:43
msgid "Help"
msgstr "Hilfe"
                
Ok, this was an easy one, wasn't it? Sometimes, you'll find longer
messages, then this looks like this (from the swedish version):

#: kdecore/kapp.cpp:439
msgid ""
"The KDE Desktop Environment was written by the KDE team.\n"
"\n"
"Please send bug reports to kde-bugs@kde.org.\n"
"\n"
"\n"
"KDE was developed with Qt, a cross-platform GUI library.\n"
"\n"
"Qt is a product of Troll Tech (http://www.troll.no, info@troll.no).\n"
"Qt may be used freely to develop free software on the X Window
System.\n"
msgstr ""
"KDE Desktop Environment skrevs av KDE-teamet.\n"
"\n"
"Vänligen, skicka bug-rapporter till kde-bugs@kde.org.\n"
"\n"
"\n"
"Det här programmet utvecklades med hjälp av Qt, ett tvärkompatibelt "  
"GUI-bibliotek.\n"
"\n"
"Qt tillverkas av Troll Tech AS (http://www.troll.no, info@troll.no). Qt
får "
"användas fritt för att utveckla fri programvara på X Window System.\n"


You'll find again the msgid and msgstr words, but this time followed by
longer texts. There is no real need to keep the same layout of the text
as long as the same information is brought to the user. Most often such
long texts are used for dialog boxes or --help textes. In both cases,
there is no need to keep the line feeds in the way, it was in the
original.
If you need more lines for your translation, no problem; if you need
less,
no problem too. The only important position is the last line. msgfmt
checks,
if both versions ends with or without a linefeed, since this is
important
in cases, where other text follows.

Another case you'll find in the template files are accelerators. 
#: po/texts.cpp:48
msgid "View"
msgstr ""

#: po/texts.cpp:49
msgid "&View"
msgstr ""

The first is View without accelerators and the second View with. Both
appear in the main menu as View, but the second with an underlined V
to use it with ALT+V. So, the question is, where to put the & for in
your translation. The answer is not that easy. It's important, that
only one letter is marked in one menu. This fits to the main menu and
to every popup. So, if you can use the same letter as in the english
version, it's safe almost everywhere, that it's just in single use.
But as I tried to say, it's no need to do it this way. 
For example, the german translation of View is Ansicht (no V) and the
swedish translation is Utseende (also no V). In such cases (main menu)
the first letter is most often used. This is no real problem, since
there are usualy no more then 5 or 6 entries in this menu.

I hope, this is clear. Now to another topic: C-Format strings.
This look like this:
#: app.cpp:416
#, c-format
msgid "Your time: %02d:%02d:%02d"
msgstr ""

I hope, everyone of you have little experience with printf. This
helps to understand, what is going on here. Those messages are
translated and then the real time is filled in the gaps. So,
it's important, that you keep the structure of those messages.
But of course it's proper to translate it to something like
"%02d:%02d:%02d was your time" or even 
"you did in %02d hours, %02d minutes and %02d seconds". Do you
got it? 
What you can not do, is to translate 
"file %s not found, tried %d times" to "I have tried %d times
to find file %s". Your translated version would crash, because
printf would try to fill a string into a place of number. 

OK, now you should know, how to translate single messages.
The KDE structure is, that there is a file in kdelibs, that
contains several important messages (like the "View" and "Help"
from above). This needs to be always uptodate. Then, there
are message files for many applications from KDE. Both (the
kdelibs file and the application file) need to be translated
to get a translated application. 
You need GNU gettext installed to use your translations.
msgfmt compiles the .po files in .gmo files, that are installed
as .mo files in $KDEDIR/share/locale/$LANG/LC_MESSAGES/
If this has been done, a "LANG=sv khexdit" starts khexdit
in swedish and a "LANG=de khexdit" starts khexdit in german.

All from above was mainly for new translations, but there is
a high need to update existing translations. If you take
an exisiting translation file (from the snapshots, there is
no real use in translating Beta releases), you'll find empty
messages, that have to be treated exactly like the one in the
template files. But sometimes you'll also find fuzzy entries
like the following:

#: kfmprops.cpp:697
#, fuzzy
msgid "Run normally"
msgstr "In Terminal ausführen"    

This is just a guess of msgmerge (the application I use for
this task). Sometimes, this guess is OK, but this time, it's
completly wrong. No matter, you must update the entry and
remove the fuzzy comment, since msgfmt will ignore entries,
that are marked as fuzzy.

Another thing, you can see, are unused translations, like:
#~ msgid "Do you really want to quit?"
#~ msgstr "Wirklich beenden?"

#~ msgid "&How can I ..."
#~ msgstr "&Wie kann ich ...?"        

This translations were once used, but are no longer part
of the application, or (more usual) changed. It may be,
that there is no an entry "Do you really want to exit?"
or something like that and msgmerge hasn't seen the 
connection between this messages. No matter, you can re-
move the messages, if you have updated the rest. They
are just comments. 

If you're ready with your translations, please mail them
to me (Stephan Kulow <coolo@kde.org>). I'll add them to
the KDE sources.

Another topic, I would like to note here, are .kdelnk files.
This is a little bit more complicated, since they are not
all in one place like the .pot files. You'll need to make
patches to get them applied.

In $KDEDIR/share/applnk you'll find a structure of files,
that are scanned by kpanel. This files can be translated
and also the directories, they are in. But don't translate
them there, but in the source packages. In kdebase/applnk, 
most of them are in. For example kdebase/applnk/Games
contains a file .directory, that looks like this:

[KDE Desktop Entry]
Name=Games
Name[de]=Spiele
Name[nl]=Spelletjes
Name[pl]=Gry
Name[cs]=Hry   

As you can see, only few languages have added their translations
there. If you want to translate the .directory file or a 
.kdelnk file, that looks like this:

# KDE Config File
[KDE Desktop Entry]
Name=Hex Editor
Name[de]=Hexeditor
Name[pl]=HexEdytor
Exec=khexdit -caption "%c" -icon "%i" -miniicon "%m" %f
Icon=khexdit.xpm
Type=Application
DocPath=khexdit/index.html
Comment=A simple Hex editor
Comment[de]=Ein Editor für binäre Dateien
Comment[pl]=Prosty edytor plików binarnych
Terminal=0
MiniIcon=khexdit.xpm     

just add a line Name[$LANG] and a line Comment[$LANG]
to this file and send me a patch agains the latest 
snapshot. I really would suggest, that you download
a snapshot, translate for a hour or what you can spend
on KDE and send me the patch the same day. I hope, it
will never happen, that I get two patches the same day,
but this is something I have to care for ;)

Just in case, you don't know, how to make patches:
Copy the sources (the best is not to compile them ;)
into another directory (e.g. kdebase into kdebase.orig).
After this edit kdebase and if you finished, use
"diff -urN kdebase.orig kdebase | gzip > kdebase-patch.gz" 
and send me the result ;)

OK, I hope, this helps all of you and you will fill my
mailbox in the next days ;)

Greets, Stephan
P.S. Do you think, it's a good idea, to put this together
as a HTML page for the web site?

-- 
Everyone makes mistakes -- but we are more experienced at it
                                      anonymous KDE developer

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic