annotate kdiff3/po/README @ 59:b9d051fd4fd5

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