[30180] | 1 | Plugin Translations
|
---|
| 2 | ===================
|
---|
| 3 |
|
---|
| 4 | Run from plugin main directory:
|
---|
| 5 | ant pot
|
---|
| 6 | ant poimport
|
---|
| 7 | ant pomerge
|
---|
| 8 | ant lang
|
---|
| 9 |
|
---|
| 10 | Detailed Version
|
---|
| 11 | ----------------
|
---|
| 12 | * To kick off the translation of the plugin it is SVN committed.
|
---|
| 13 | After a day the translatable strings are visible at Launchpad
|
---|
| 14 | (https://translations.launchpad.net/josm/trunk/+pots/josm).
|
---|
| 15 | * After the Java code or the plugin description in build.xml was
|
---|
| 16 | changed, you need to run "ant pot". That creates/updates the
|
---|
| 17 | template file po/plugin.pot.
|
---|
| 18 | * Download the latest translations from Launchpad and copy them into
|
---|
| 19 | the directory po with "ant poimport". This uses the version that is
|
---|
| 20 | updated once a day. For a more recent version you need to request a
|
---|
| 21 | download from
|
---|
| 22 | https://translations.launchpad.net/josm/trunk/+pots/josm/+export.
|
---|
| 23 | Then run "ant -Dpoimport.tarball=URL poimport", replace URL with the
|
---|
| 24 | translation download URL.
|
---|
| 25 | * Remove all untranslated strings and other translations with
|
---|
| 26 | "ant pomerge".
|
---|
| 27 | * Create the language files in the data directory with "ant lang".
|
---|
| 28 | * SVN commit plugin changes, SVN update plugin directory, run
|
---|
| 29 | "ant dist" to create a new plugin release, SVN commit new plugin
|
---|
| 30 | release (../../dist/plugin.jar). "ant dist" will add the
|
---|
| 31 | translations of the plugin description to the manifest.
|
---|
| 32 |
|
---|
| 33 | Additions to plugin build.xml:
|
---|
| 34 | <!-- ** internationalization ** -->
|
---|
| 35 | <import file="i18n/build-i18n.xml"/>
|
---|
[33072] | 36 | <target name="pot" description="Extract translatable strings from source." depends="gettext-init">
|
---|
| 37 | <mkdir dir="${plugin.po.dir}"/>
|
---|
| 38 | <gettext-extract keysFile="${ant.project.name}.pot" poDirectory="${plugin.po.dir}" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
---|
| 39 | <fileset dir="${plugin.src.dir}" includes="**/*.java"/>
|
---|
| 40 | </gettext-extract>
|
---|
| 41 | <echo file="${plugin.po.dir}/${ant.project.name}.pot" append="true">
|
---|
| 42 | #. Plugin ${ant.project.name}
|
---|
| 43 | #: build.xml:1
|
---|
| 44 | msgid "${plugin.description}"
|
---|
| 45 | msgstr ""
|
---|
| 46 | </echo>
|
---|
| 47 | </target>
|
---|
[30180] | 48 | <target name="additional-manifest">
|
---|
| 49 | <antcall target="mftrans"/>
|
---|
| 50 | </target>
|
---|
| 51 |
|
---|
[33072] | 52 | Local Translation
|
---|
| 53 | -----------------
|
---|
| 54 | To translate the strings locally, e.g. to check that they make sense:
|
---|
| 55 | * ant pot
|
---|
| 56 | * LL is a language code, CC is an optional country code
|
---|
| 57 | * If there is no PO file:
|
---|
| 58 | msginit --input=po/*.pot --output-file=po/LL_CC.po --locale=LL_CC
|
---|
| 59 | * If a PO file exists:
|
---|
| 60 | msgmerge --update po/LL_CC.po po/*.pot
|
---|
| 61 |
|
---|
[30180] | 62 | Global Run
|
---|
| 63 | ----------
|
---|
| 64 | From the global i18n directory the steps are:
|
---|
| 65 | ./launchpad bzronly
|
---|
| 66 | ant -Dplugin=plugin singleplugintrans
|
---|
| 67 |
|
---|
| 68 | * The command "launchpad bzronly" exports the latest revision of the
|
---|
| 69 | Launchpas translations.
|
---|
| 70 | * "ant singleplugintrans" generates the language files in the plugin
|
---|
| 71 | data directory. Then it deletes to PO files.
|
---|
| 72 | * It is not possible to add the translations of the plugin description
|
---|
| 73 | to the manifest.
|
---|
[31960] | 74 |
|
---|
| 75 | See Language String Changes
|
---|
| 76 | ---------------------------
|
---|
| 77 | To see what language strings changed in data/*.lang run this:
|
---|
| 78 | svn diff --diff-cmd i18n/diff_lang.pl --force data
|
---|
| 79 |
|
---|
| 80 | To see just removed or modified strings:
|
---|
| 81 | svn diff --diff-cmd i18n/diff_lang.pl --force data | grep ^- | grep -v '^--- data/'
|
---|
| 82 |
|
---|
| 83 | To display changes of a single file with tkdiff:
|
---|
| 84 | svn diff --diff-cmd i18n/diff_lang.pl --extensions --tkdiff --force data/<lang>.lang
|
---|