annotate kdiff3/po/README @ 66:efe33e938730

0.9.86
author joachim99
date Thu, 16 Sep 2004 02:40:08 +0000
parents b9d051fd4fd5
children 8febbfb1148c
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@55 48
joachim99@55 49 2. Translators create a translation for a specific language. Because we don't want
joachim99@55 50 to modify the template now, we'll create a copy for each language.
joachim99@55 51 e.g.: cp kdiff3.pot de.po
joachim99@55 52 Using KBabel we can comfortably edit the translated strings.
joachim99@55 53 e.g.: kbabel de.po
joachim99@55 54
joachim99@55 55 3. The last step is to create a fast lookup-table (*.gmo) from the po-file via
joachim99@55 56 msgfmt, but this happens automatically during the build process.
joachim99@55 57 (If a new po-file was added: make -f Makefile.cvs; configure; make)
joachim99@55 58
joachim99@59 59 Before starting to translate make sure nobody else is already doing it. It would
joachim99@59 60 be a pity, if your precious time is wasted. Look at http://i18n.kde.org/, send a
joachim99@59 61 message to the translation team coordinator for your language, and tell them that
joachim99@59 62 you want to translate KDiff3. He'll inform you if you should proceed. Also read
joachim99@59 63 the other docs on that site.
joachim99@59 64
joachim99@55 65 ============
joachim99@55 66
joachim99@55 67 The following is for my own memory and for those who really want to learn dirty tricks and details:
joachim99@55 68
joachim99@55 69 The KDE-i18n team stores their results in CVS. But I would like to have an independent
joachim99@55 70 copy of all translations in the po-directory of the source package. Actually it's just
joachim99@55 71 copying and renaming, but simplified with these commands:
joachim99@55 72
joachim99@55 73 1. First checkout all available translations from the CVS-repository
joachim99@55 74 cvs co kde-i18n/subdirs
joachim99@55 75 for i in `cat kde-i18n/subdirs`; do cvs co kde-i18n/$i/messages/kdeextragear-1/kdiff3.po; done
joachim99@55 76
joachim99@55 77 2. Copy and rename them as needed:
joachim99@55 78 for i in `cat kde-i18n/subdirs`; do cp kde-i18n/$i/messages/kdeextragear-1/kdiff3.po $i.po; done
joachim99@55 79 rm -R kde-i18n
joachim99@55 80
joachim99@55 81
joachim99@55 82 This was the explanation for translations within KDE.
joachim99@55 83 But KDiff3 can also be compiled and run without KDE:
joachim99@55 84
joachim99@55 85 Since Qt was used for KDiff3, the first part is quite the same: Only the fast lookup-table
joachim99@55 86 (*.qm-files) must be created with $QTDIR/bin/msg2qm (instead of msgfmt). ($QTDIR/tools/msg2qm)
joachim99@55 87
joachim99@55 88 Still one detail isn't right: Some strings are not translated, because under KDE their
joachim99@55 89 translation is within KDE-libs or within Qt. But the translations are available:
joachim99@55 90
joachim99@55 91 For Qt-strings in $QTDIR/translations (already as .qm-files)
joachim99@55 92
joachim99@55 93 For KDE-libs in the CVS-repository, where we can reuse the previous trick to get
joachim99@55 94 all kdelibs*.po-files:
joachim99@55 95 for i in `cat kde-i18n/subdirs`; do cvs co kde-i18n/$i/messages/kdelibs/kdelibs.po; done
joachim99@55 96 for i in `cat kde-i18n/subdirs`; do cp kde-i18n/$i/messages/kdelibs/kdelibs.po kdelibs_$i.po; done
joachim99@55 97
joachim99@55 98 Finally the program must only read the correct translation tables:
joachim99@55 99
joachim99@55 100 QTranslator kdiff3Translator( 0 );
joachim99@66 101 kdiff3Translator.load( QString("kdiff3_")+QTextCodec::locale(), translationDir );
joachim99@55 102 app.installTranslator( &kdiff3Translator );
joachim99@55 103
joachim99@55 104 QTranslator qtTranslator( 0 );
joachim99@55 105 qtTranslator.load( QString("qt_")+QTextCodec::locale(), translationDir );
joachim99@55 106 app.installTranslator( &qtTranslator );
joachim99@55 107
joachim99@55 108 QTranslator kdelibsTranslator( 0 );
joachim99@55 109 kdelibsTranslator.load( QString("kdelibs_")+QTextCodec::locale(), translationDir );
joachim99@55 110 app.installTranslator( &kdelibsTranslator );
joachim99@55 111
joachim99@55 112 This should do the job, if the translation-tables can be found.
joachim99@55 113 The difficult part is: Where to search for the files, because this depends on
joachim99@55 114 where the program was installed. (I didn't solve this puzzle yet.)
joachim99@55 115
joachim99@55 116 Because it's too much effort to copy all kdelibs*.po-files along: Here is a little info
joachim99@55 117 about how to extract only the needed strings and to create the qm-files.
joachim99@55 118
joachim99@55 119 1. Only src/kreplacements/kreplacements.cpp contains strings, that were not covered by
joachim99@55 120 the normal translations. Hence a special pot-file is needed.
joachim99@55 121 xgettext --keyword=i18n --keyword=I18N_NOOP -C ../src/kreplacements/kreplacements.cpp -o kreplacements.pot
joachim99@55 122
joachim99@55 123 2. Take only needed strings and translations from kdelibs*.po:
joachim99@55 124 msgmerge --no-fuzzy-matching kdelibs_de.po kreplacements.pot >kreplacements_de.po
joachim99@55 125
joachim99@55 126 3. Concatenate the normal de.po and kreplacements_de.po:
joachim99@55 127 msgcat --use-first de.po kreplacements_de.po >kdiff3_de.po
joachim99@55 128
joachim99@55 129 4. Finally create the fast lookup table:
joachim99@55 130 $QTDIR/bin/msg2qm kdiff3_de.po kdiff3_de.qm
joachim99@55 131
joachim99@55 132 5. The intermediate files can then be deleted.
joachim99@55 133
joachim99@55 134 The script createqm does steps 2-5 for languages where a kdiff3.po-translation exists.