You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
134 lines
5.7 KiB
134 lines
5.7 KiB
15 years ago
|
README for KDiff3-Internationalisation (i18n)
|
||
|
=============================================
|
||
|
Author: Joachim Eibl 2004
|
||
|
|
||
|
This text is for you, if you might want to help translating KDiff3 or just want
|
||
|
to learn how this i18n-thing works.
|
||
|
|
||
|
grep "Language-Team" *.po
|
||
|
|
||
|
az Azerbaijani <translation-team-az@lists.sourceforge.net>
|
||
|
ca LANGUAGE <LL@li.org>
|
||
|
da Danish <dansk@klid.dk>
|
||
|
de Deutsch <kde-i18n-de@kde.org>
|
||
|
en_GB British English <kde-en-gb@kde.me.uk>
|
||
|
es espaniol <kde-es@kybs.de>
|
||
|
et Estonian <kde-et@linux.ee>
|
||
|
fr French <kde-francophone@kde.org>
|
||
|
hu Hungarian <kde-lista@sophia.jpte.hu>
|
||
|
it Italian <kde-i18n-it@kde.org>
|
||
|
nl Nederlands <kde-i18n-nl@kde.org>
|
||
|
pl Polish
|
||
|
pt_BR Brazilian Portuguese <kde-i18n-pt_BR@mail.kde.org>
|
||
|
pt Portuguese <kde-i18n-pt@kde.org>
|
||
|
ro Romanian <ro-kde@egroups.com>
|
||
|
ru Russian <ru@li.org>
|
||
|
sr Serbian
|
||
|
sv Svenska <sv@li.org>
|
||
|
ta <tamilpc@ambalam.com>
|
||
|
tr Türkçe <tr@li.org>
|
||
|
zh_CN zh_CN <i18n-translation@lists.linux.net.cn>
|
||
|
|
||
|
|
||
|
Thanks to all translators!
|
||
|
|
||
|
|
||
|
The program was written with English as main language. But to allow automatic
|
||
|
translation of messages, every translatable text in the program was written as
|
||
|
i18n("translatable").
|
||
|
|
||
|
i18n() is a translator-function. If a translation table exists, at runtime the
|
||
|
function looks for the given string in that table and returns the translation.
|
||
|
|
||
|
The translation-table is created in 3 steps:
|
||
|
1. First a template-translation table kdiff3.pot should be created: Usually via
|
||
|
xgettext --keyword=i18n --keyword=I18N_NOOP -C -o ../po/kdiff3.pot *.cpp *.h
|
||
|
|
||
|
It contains all translatable strings of the program, but no translations.
|
||
|
(xgettext is usually part of package gettext-devel)
|
||
|
|
||
|
2. Translators create a translation for a specific language. Because we don't want
|
||
|
to modify the template now, we'll create a copy for each language.
|
||
|
e.g.: cp kdiff3.pot de.po
|
||
|
Using KBabel we can comfortably edit the translated strings.
|
||
|
e.g.: kbabel de.po
|
||
|
|
||
|
3. The last step is to create a fast lookup-table (*.gmo) from the po-file via
|
||
|
msgfmt, but this happens automatically during the build process.
|
||
|
(If a new po-file was added: make -f Makefile.cvs; configure; make)
|
||
|
|
||
|
Before starting to translate make sure nobody else is already doing it. It would
|
||
|
be a pity, if your precious time is wasted. Look at http://i18n.kde.org/, send a
|
||
|
message to the translation team coordinator for your language, and tell them that
|
||
|
you want to translate KDiff3. He'll inform you if you should proceed. Also read
|
||
|
the other docs on that site.
|
||
|
|
||
|
============
|
||
|
|
||
|
The following is for my own memory and for those who really want to learn dirty tricks and details:
|
||
|
|
||
|
The KDE-i18n team stores their results in SVN. But I would like to have an independent
|
||
|
copy of all translations in the po-directory of the source package. Actually it's just
|
||
|
copying and renaming, but simplified with these commands:
|
||
|
|
||
|
|
||
|
First fetch all available translations from the SVN-repository (access via websvn and wget)
|
||
|
wget http://websvn.kde.org/*checkout*/trunk/l10n/subdirs
|
||
|
for i in `cat subdirs`; do wget http://websvn.kde.org/*checkout*/trunk/l10n/$i/messages/extragear-utils/kdiff3.po -O $i.po; done
|
||
|
|
||
|
|
||
|
This was the explanation for translations within KDE.
|
||
|
But KDiff3 can also be compiled and run without KDE:
|
||
|
|
||
|
Since Qt was used for KDiff3, the first part is quite the same: Only the fast lookup-table
|
||
|
(*.qm-files) must be created with $QTDIR/bin/msg2qm (instead of msgfmt). ($QTDIR/tools/msg2qm)
|
||
|
|
||
|
Still one detail isn't right: Some strings are not translated, because under KDE their
|
||
|
translation is within KDE-libs or within Qt. But the translations are available:
|
||
|
|
||
|
For Qt-strings in $QTDIR/translations (already as .qm-files)
|
||
|
|
||
|
For KDE-libs in the SVN-repository, where we can reuse the previous trick to get
|
||
|
all kdelibs*.po-files:
|
||
|
|
||
|
for i in `cat subdirs`; do wget http://websvn.kde.org/*checkout*/trunk/l10n/$i/messages/kdelibs/kdelibs.po -O kdelibs_$i.po; done
|
||
|
|
||
|
Finally the program must only read the correct translation tables:
|
||
|
|
||
|
QTranslator kdiff3Translator( 0 );
|
||
|
kdiff3Translator.load( QString("kdiff3_")+QTextCodec::locale(), translationDir );
|
||
|
app.installTranslator( &kdiff3Translator );
|
||
|
|
||
|
QTranslator qtTranslator( 0 );
|
||
|
qtTranslator.load( QString("qt_")+QTextCodec::locale(), translationDir );
|
||
|
app.installTranslator( &qtTranslator );
|
||
|
|
||
|
QTranslator kdelibsTranslator( 0 );
|
||
|
kdelibsTranslator.load( QString("kdelibs_")+QTextCodec::locale(), translationDir );
|
||
|
app.installTranslator( &kdelibsTranslator );
|
||
|
|
||
|
This should do the job, if the translation-tables can be found.
|
||
|
The difficult part is: Where to search for the files, because this depends on
|
||
|
where the program was installed. (I didn't solve this puzzle yet.)
|
||
|
|
||
|
Because it's too much effort to copy all kdelibs*.po-files along: Here is a little info
|
||
|
about how to extract only the needed strings and to create the qm-files.
|
||
|
|
||
|
1. Only src/kreplacements/kreplacements.cpp contains strings, that were not covered by
|
||
|
the normal translations. Hence a special pot-file is needed.
|
||
|
xgettext --keyword=i18n --keyword=I18N_NOOP -C ../src/kreplacements/kreplacements.cpp -o kreplacements.pot
|
||
|
(xgettext is usually part of package gettext-devel)
|
||
|
|
||
|
2. Take only needed strings and translations from kdelibs*.po:
|
||
|
msgmerge --no-fuzzy-matching kdelibs_de.po kreplacements.pot >kreplacements_de.po
|
||
|
|
||
|
3. Concatenate the normal de.po and kreplacements_de.po:
|
||
|
msgcat --use-first de.po kreplacements_de.po >kdiff3_de.po
|
||
|
|
||
|
4. Finally create the fast lookup table:
|
||
|
$QTDIR/bin/msg2qm kdiff3_de.po kdiff3_de.qm
|
||
|
|
||
|
5. The intermediate files can then be deleted.
|
||
|
|
||
|
The script createqm does steps 2-5 for languages where a kdiff3.po-translation exists.
|