annotate kdiff3/po/README @ 75:08ea9b86c12c

KDiff3-0.9.91
author joachim99
date Sat, 04 Nov 2006 00:05:00 +0000
parents 8febbfb1148c
children fcd146072e0c
rev   line source
joachim99@55 1 README for KDiff3-Internationalisation (i18n)
joachim99@55 2 =============================================
joachim99@55 3 Author: Joachim Eibl 2004
joachim99@55 4
joachim99@55 5 This text is for you, if you might want to help translating KDiff3 or just want
joachim99@55 6 to learn how this i18n-thing works.
joachim99@55 7
joachim99@66 8 grep "Language-Team" *.po
joachim99@55 9
joachim99@66 10 az Azerbaijani <translation-team-az@lists.sourceforge.net>
joachim99@66 11 ca LANGUAGE <LL@li.org>
joachim99@66 12 da Danish <dansk@klid.dk>
joachim99@66 13 de Deutsch <kde-i18n-de@kde.org>
joachim99@66 14 en_GB British English <kde-en-gb@kde.me.uk>
joachim99@66 15 es espaniol <kde-es@kybs.de>
joachim99@66 16 et Estonian <kde-et@linux.ee>
joachim99@66 17 fr French <kde-francophone@kde.org>
joachim99@66 18 hu Hungarian <kde-lista@sophia.jpte.hu>
joachim99@66 19 it Italian <kde-i18n-it@kde.org>
joachim99@66 20 nl Nederlands <kde-i18n-nl@kde.org>
joachim99@66 21 pl Polish
joachim99@66 22 pt_BR Brazilian Portuguese <kde-i18n-pt_BR@mail.kde.org>
joachim99@66 23 pt Portuguese <kde-i18n-pt@kde.org>
joachim99@66 24 ro Romanian <ro-kde@egroups.com>
joachim99@66 25 ru Russian <ru@li.org>
joachim99@66 26 sr Serbian
joachim99@66 27 sv Svenska <sv@li.org>
joachim99@66 28 ta <tamilpc@ambalam.com>
joachim99@66 29 tr Türkçe <tr@li.org>
joachim99@66 30 zh_CN zh_CN <i18n-translation@lists.linux.net.cn>
joachim99@55 31
joachim99@55 32
joachim99@55 33 Thanks to all translators!
joachim99@55 34
joachim99@55 35
joachim99@55 36 The program was written with English as main language. But to allow automatic
joachim99@55 37 translation of messages, every translatable text in the program was written as
joachim99@55 38 i18n("translatable").
joachim99@55 39
joachim99@55 40 i18n() is a translator-function. If a translation table exists, at runtime the
joachim99@55 41 function looks for the given string in that table and returns the translation.
joachim99@55 42
joachim99@55 43 The translation-table is created in 3 steps:
joachim99@55 44 1. First a template-translation table kdiff3.pot should be created: Usually via
joachim99@55 45 xgettext --keyword=i18n --keyword=I18N_NOOP -C -o ../po/kdiff3.pot *.cpp *.h
joachim99@55 46
joachim99@55 47 It contains all translatable strings of the program, but no translations.
joachim99@69 48 (xgettext is usually part of package gettext-devel)
joachim99@55 49
joachim99@55 50 2. Translators create a translation for a specific language. Because we don't want
joachim99@55 51 to modify the template now, we'll create a copy for each language.
joachim99@55 52 e.g.: cp kdiff3.pot de.po
joachim99@55 53 Using KBabel we can comfortably edit the translated strings.
joachim99@55 54 e.g.: kbabel de.po
joachim99@55 55
joachim99@55 56 3. The last step is to create a fast lookup-table (*.gmo) from the po-file via
joachim99@55 57 msgfmt, but this happens automatically during the build process.
joachim99@55 58 (If a new po-file was added: make -f Makefile.cvs; configure; make)
joachim99@55 59
joachim99@59 60 Before starting to translate make sure nobody else is already doing it. It would
joachim99@59 61 be a pity, if your precious time is wasted. Look at http://i18n.kde.org/, send a
joachim99@59 62 message to the translation team coordinator for your language, and tell them that
joachim99@59 63 you want to translate KDiff3. He'll inform you if you should proceed. Also read
joachim99@59 64 the other docs on that site.
joachim99@59 65
joachim99@55 66 ============
joachim99@55 67
joachim99@55 68 The following is for my own memory and for those who really want to learn dirty tricks and details:
joachim99@55 69
joachim99@69 70 The KDE-i18n team stores their results in SVN. But I would like to have an independent
joachim99@55 71 copy of all translations in the po-directory of the source package. Actually it's just
joachim99@55 72 copying and renaming, but simplified with these commands:
joachim99@55 73
joachim99@69 74
joachim99@69 75 First fetch all available translations from the SVN-repository (access via websvn and wget)
joachim99@69 76 wget http://websvn.kde.org/*checkout*/trunk/l10n/subdirs
joachim99@69 77 for i in `cat subdirs`; do wget http://websvn.kde.org/*checkout*/trunk/l10n/$i/messages/extragear-utils/kdiff3.po -O $i.po; done
joachim99@55 78
joachim99@55 79
joachim99@55 80 This was the explanation for translations within KDE.
joachim99@55 81 But KDiff3 can also be compiled and run without KDE:
joachim99@55 82
joachim99@55 83 Since Qt was used for KDiff3, the first part is quite the same: Only the fast lookup-table
joachim99@55 84 (*.qm-files) must be created with $QTDIR/bin/msg2qm (instead of msgfmt). ($QTDIR/tools/msg2qm)
joachim99@55 85
joachim99@55 86 Still one detail isn't right: Some strings are not translated, because under KDE their
joachim99@55 87 translation is within KDE-libs or within Qt. But the translations are available:
joachim99@55 88
joachim99@55 89 For Qt-strings in $QTDIR/translations (already as .qm-files)
joachim99@55 90
joachim99@75 91 For KDE-libs in the SVN-repository, where we can reuse the previous trick to get
joachim99@55 92 all kdelibs*.po-files:
joachim99@69 93
joachim99@69 94 for i in `cat subdirs`; do wget http://websvn.kde.org/*checkout*/trunk/l10n/$i/messages/kdelibs/kdelibs.po -O kdelibs_$i.po; done
joachim99@55 95
joachim99@55 96 Finally the program must only read the correct translation tables:
joachim99@55 97
joachim99@55 98 QTranslator kdiff3Translator( 0 );
joachim99@66 99 kdiff3Translator.load( QString("kdiff3_")+QTextCodec::locale(), translationDir );
joachim99@55 100 app.installTranslator( &kdiff3Translator );
joachim99@55 101
joachim99@55 102 QTranslator qtTranslator( 0 );
joachim99@55 103 qtTranslator.load( QString("qt_")+QTextCodec::locale(), translationDir );
joachim99@55 104 app.installTranslator( &qtTranslator );
joachim99@55 105
joachim99@55 106 QTranslator kdelibsTranslator( 0 );
joachim99@55 107 kdelibsTranslator.load( QString("kdelibs_")+QTextCodec::locale(), translationDir );
joachim99@55 108 app.installTranslator( &kdelibsTranslator );
joachim99@55 109
joachim99@55 110 This should do the job, if the translation-tables can be found.
joachim99@55 111 The difficult part is: Where to search for the files, because this depends on
joachim99@55 112 where the program was installed. (I didn't solve this puzzle yet.)
joachim99@55 113
joachim99@55 114 Because it's too much effort to copy all kdelibs*.po-files along: Here is a little info
joachim99@55 115 about how to extract only the needed strings and to create the qm-files.
joachim99@55 116
joachim99@55 117 1. Only src/kreplacements/kreplacements.cpp contains strings, that were not covered by
joachim99@55 118 the normal translations. Hence a special pot-file is needed.
joachim99@55 119 xgettext --keyword=i18n --keyword=I18N_NOOP -C ../src/kreplacements/kreplacements.cpp -o kreplacements.pot
joachim99@69 120 (xgettext is usually part of package gettext-devel)
joachim99@55 121
joachim99@55 122 2. Take only needed strings and translations from kdelibs*.po:
joachim99@55 123 msgmerge --no-fuzzy-matching kdelibs_de.po kreplacements.pot >kreplacements_de.po
joachim99@55 124
joachim99@55 125 3. Concatenate the normal de.po and kreplacements_de.po:
joachim99@55 126 msgcat --use-first de.po kreplacements_de.po >kdiff3_de.po
joachim99@55 127
joachim99@55 128 4. Finally create the fast lookup table:
joachim99@55 129 $QTDIR/bin/msg2qm kdiff3_de.po kdiff3_de.qm
joachim99@55 130
joachim99@55 131 5. The intermediate files can then be deleted.
joachim99@55 132
joachim99@55 133 The script createqm does steps 2-5 for languages where a kdiff3.po-translation exists.