annotate kdiff3/po/README @ 113:7bca1f1340f6 tip

Build fixes for Xcode 10 / Qt 5.12
author Chris Cannam
date Mon, 17 Dec 2018 11:13:01 +0000
parents fcd146072e0c
children
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@80 49 Better to get version from kde svn:
joachim99@80 50 wget http://websvn.kde.org/*checkout*/trunk/l10n-kde4/templates/messages/extragear-utils/kdiff3.pot
joachim99@80 51 wget http://websvn.kde.org/*checkout*/trunk/l10n-kde4/templates/messages/extragear-utils/kdiff3plugin.pot
joachim99@55 52
joachim99@55 53 2. Translators create a translation for a specific language. Because we don't want
joachim99@55 54 to modify the template now, we'll create a copy for each language.
joachim99@55 55 e.g.: cp kdiff3.pot de.po
joachim99@55 56 Using KBabel we can comfortably edit the translated strings.
joachim99@55 57 e.g.: kbabel de.po
joachim99@55 58
joachim99@55 59 3. The last step is to create a fast lookup-table (*.gmo) from the po-file via
joachim99@55 60 msgfmt, but this happens automatically during the build process.
joachim99@55 61 (If a new po-file was added: make -f Makefile.cvs; configure; make)
joachim99@55 62
joachim99@59 63 Before starting to translate make sure nobody else is already doing it. It would
joachim99@59 64 be a pity, if your precious time is wasted. Look at http://i18n.kde.org/, send a
joachim99@59 65 message to the translation team coordinator for your language, and tell them that
joachim99@59 66 you want to translate KDiff3. He'll inform you if you should proceed. Also read
joachim99@59 67 the other docs on that site.
joachim99@59 68
joachim99@55 69 ============
joachim99@55 70
joachim99@55 71 The following is for my own memory and for those who really want to learn dirty tricks and details:
joachim99@80 72 The script "update_po_dirs" does all in here automatically. Read on if you want details.
joachim99@55 73
joachim99@69 74 The KDE-i18n team stores their results in SVN. But I would like to have an independent
joachim99@55 75 copy of all translations in the po-directory of the source package. Actually it's just
joachim99@55 76 copying and renaming, but simplified with these commands:
joachim99@55 77
joachim99@69 78 First fetch all available translations from the SVN-repository (access via websvn and wget)
joachim99@69 79 wget http://websvn.kde.org/*checkout*/trunk/l10n/subdirs
joachim99@80 80 for i in `cat subdirs`; do wget http://websvn.kde.org/*checkout*/trunk/l10n-kde4/$i/messages/extragear-utils/kdiff3.po -O $i.po; done
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@80 86 (*.qm-files) must be created with $QTDIR/bin/msg2qm (instead of msgfmt). ($QTDIR/tools/msg2qm in the "qt3-devel-tools"-package))
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@75 93 For KDE-libs in the SVN-repository, where we can reuse the previous trick to get
joachim99@55 94 all kdelibs*.po-files:
joachim99@69 95
joachim99@80 96 for i in `cat subdirs`; do wget http://websvn.kde.org/*checkout*/trunk/l10n-kde4/$i/messages/kdelibs/kdelibs4.po -O 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@80 119 Steps 1-3 are obsolete for translations that are up to date because kreplacements.pot is now in kde-svn-repository.
joachim99@55 120 1. Only src/kreplacements/kreplacements.cpp contains strings, that were not covered by
joachim99@55 121 the normal translations. Hence a special pot-file is needed.
joachim99@55 122 xgettext --keyword=i18n --keyword=I18N_NOOP -C ../src/kreplacements/kreplacements.cpp -o kreplacements.pot
joachim99@69 123 (xgettext is usually part of package gettext-devel)
joachim99@55 124
joachim99@55 125 2. Take only needed strings and translations from kdelibs*.po:
joachim99@55 126 msgmerge --no-fuzzy-matching kdelibs_de.po kreplacements.pot >kreplacements_de.po
joachim99@80 127 ("msgmerge" and "msgcat" are part of the "gettext-tools"-package.)
joachim99@55 128
joachim99@55 129 3. Concatenate the normal de.po and kreplacements_de.po:
joachim99@55 130 msgcat --use-first de.po kreplacements_de.po >kdiff3_de.po
joachim99@80 131 The resulting file is huge, but most stuff is commented out.
joachim99@55 132
joachim99@80 133 4. Finally create the fast lookup table (msg2qm is from "qt3-devel-tools"-package):
joachim99@55 134 $QTDIR/bin/msg2qm kdiff3_de.po kdiff3_de.qm
joachim99@55 135
joachim99@55 136 5. The intermediate files can then be deleted.
joachim99@55 137
joachim99@80 138 Creating the directory structure needed for KDE4 and cmake.
joachim99@80 139 for i in *.po; do echo $i; export j=`echo $i | sed s/.po//`; echo $j; md $j; cp $j.po $j/kdiff3.po; sed s/xx/$j/ CMakeLists_xx.txt >$j/CMakeLists.txt ; done
joachim99@80 140 (For each po-file create the subdir, copy outer po-file to subdir/kdiff3.po and create a CMakeLists.txt file.)
joachim99@80 141 ls */kdiff3.po | sed 's/\(.*\)\/.*/add_subdirectory(\1)/' >CMakeLists.txt
joachim99@80 142