Merge branch 'modernize-translation-docs'

Remove obsolete information, improve formatting.

See https://github.com/wxWidgets/wxWidgets/pull/2178
This commit is contained in:
Vadim Zeitlin
2021-01-21 15:56:25 +01:00
2 changed files with 30 additions and 36 deletions

View File

@@ -5,28 +5,20 @@ This note is addressed to wxWidgets translators.
First of all, here is what you will need: First of all, here is what you will need:
1. GNU gettext package version 0.10.35 or later (NB: earlier versions were 1. GNU gettext package
known to have serious bugs)
a) for Unix systems you can download gettext-0.10.tar.gz from any GNU - For Unix systems you can download gettext-0.xx.yy.tar.gz from any GNU
mirror (RPMs and DEBs are also available from the usual places) mirror (RPMs and DEBs are also available from the usual places)
- For Windows you can download the precompiled binaries from
b) for Windows you can download the precompiled binaries from www.wxwidgets.org or install [Poedit](https://poedit.net/) and add
www.wxwidgets.org or install PoEdit (poedit.sourceforge.net) and `<installdir>/poEdit/bin` to your path (so it can find xgettext).
add <installdir>/poEdit/bin to your path (so it can find xgettext).
2. A way to run a program recursively on an entire directory from the command 2. A way to run a program recursively on an entire directory from the command
line: line:
a) for Unix systems, this is done in locale/Makefile using the standard find - For Unix systems, this is done in `locale/Makefile` using the standard `find`
command and xargs which is installed on almost all modern Unices. If you command and `xargs` which is installed on almost all modern Unices.
are unlucky enough to not have xargs, you can use the -exec option of find - For Win32 systems you can use Cygwin, MSYS or WSL.
instead.
b) for Win32 systems you can use either Cygwin or MinGW. If you don't have
those it is less trivial: if you have 4DOS/4NT/bash, that's
fine, but you'd have to use some kind of "for /s" loop with the
command.com/cmd.exe.
3. Access to the git repository is not necessary strictly speaking, but will 3. Access to the git repository is not necessary strictly speaking, but will
make things a lot easier for you and others. make things a lot easier for you and others.
@@ -35,34 +27,34 @@ First of all, here is what you will need:
Now a brief overview of the process of translations (please refer to GNU Now a brief overview of the process of translations (please refer to GNU
gettext documentation for more details). It happens in several steps: gettext documentation for more details). It happens in several steps:
1. the strings to translate are extracted from the C++ sources using xgettext 1. the strings to translate are extracted from the C++ sources using `xgettext`
program into a wxstd.pot file which is a "text message catalog" program into a `wxstd.pot` file which is a "text message catalog"
2. this new wxstd.pot file (recreated each time some new text messages are added 2. this new wxstd.pot file (which is updated from time to time by running
to wxWidgets) is merged with existing translations in another .po file (for `make wxstd.pot` in the `locale` subdirectory) is merged with existing
example, de.po) and replaces this file (this is done using the program translations in another .po file (for example, de.po) and replaces this
msgmerge) file (this is done using the program `msgmerge`)
3. the resulting .po file must be translated 3. the resulting .po file must be translated
4. finally, msgformat must be run to produce a .mo file: "binary message catalog" 4. finally, `msgformat` must be run to produce a .mo file: "binary message catalog"
How does it happen in practice? There is a Makefile in the "locale" How does it happen in practice? There is a Makefile in the "locale"
directory which will do almost everything (except translations) for you. i.e. directory which will do almost everything (except translations) for you. i.e.
just type "make lang.po" to create or update the message catalog for 'lang'. just type `make lang.po` to create or update the message catalog for 'lang'.
Then edit the resulting lang.po and make sure that there are no empty or fuzzy Then edit the resulting `lang.po` and make sure that there are no empty or fuzzy
translations left (empty translations are the ones with msgstr "", fuzzy translations left (empty translations are the ones with `msgstr ""`, fuzzy
translations are those which have the word "fuzzy" in a comment just above translations are those which have the word "fuzzy" in a comment just above
them). Then type "make lang.mo" which will create the binary message catalog. them). Then type `make lang.mo` which will create the binary message catalog.
Under Windows (If you don't have Cygwin or MinGW), you should execute the Under Windows (If you don't have Cygwin or MinGW), you should execute the
commands manually, please have a look at Makefile to see what must be done. commands manually, please have a look at Makefile to see what must be done.
For platform specific translations, .po files such as 'locale/msw/it.po' can be For platform specific translations, .po files such as `locale/msw/it.po` can be
used to provide translations that override the usual ones in 'locale/it.po'. used to provide translations that override the usual ones in `locale/it.po`.
The generated .mo files are then installed under the names such as 'wxmsw.mo' The generated .mo files are then installed under the names such as `wxmsw.mo`
alongside the generic 'wxstd.mo'. alongside the generic `wxstd.mo`.
A new platform specific translation should be added to a section such as this A new platform specific translation should be added to a section such as this
in wx.bkl: in wx.bkl:

View File

@@ -452,15 +452,17 @@ Here are the steps you should follow:
you should already have it. Otherwise you can always retrieve it directly you should already have it. Otherwise you can always retrieve it directly
from the git repository: from the git repository:
<a href="https://raw.githubusercontent.com/wxWidgets/wxWidgets/master/locale/wxstd.pot">locale/wxstd.pot</a>. <a href="https://raw.githubusercontent.com/wxWidgets/wxWidgets/master/locale/wxstd.pot">locale/wxstd.pot</a>.
-# Rename it to <tt>XY.po</tt> where <tt>"XY"</tt> is the 2 letter -# Initialize an <tt>XY.po</tt> file for your language by using the command
<tt>msginit -l XY</tt> in the same folder where you placed <tt>wxstd.pot</tt>.
The <tt>"XY"</tt> is the 2 letter
<a href="http://www.loc.gov/standards/iso639-2/php/English_list.php">ISO 639-2 language code</a> <a href="http://www.loc.gov/standards/iso639-2/php/English_list.php">ISO 639-2 language code</a>
for your language. for your language. Initialization can be also done using e.g. Poedit (see next item).
-# Translate the strings in this file using either your favourite text -# Translate the strings in this file using either your favourite text
editor or a specialized tool such as Vaclav Slavik's excellent editor or a specialized tool such as Vaclav Slavik's excellent
<a href="http://www.poedit.net/">poEdit</a> utility. <a href="http://www.poedit.net/">poEdit</a> utility.
-# Verify that your translations can at least be compiled (even if they -# Verify that your translations can at least be compiled (even if they
are yet incomplete) by running <tt>msgfmt -v XY.po</tt> command: are yet incomplete) by running <tt>msgfmt -vc XY.po</tt> command:
please note that you <i>must</i> use the <tt>-v</tt> option. In please note that you <i>must</i> use the <tt>-c</tt> option. In
particular, please fill the header fields because @c msgfmt doesn't particular, please fill the header fields because @c msgfmt doesn't
accept the default values for them. accept the default values for them.
-# Send the finished translation to <a href="mailto:vadim@wxwidgets.org">Vadim Zeitlin</a> -# Send the finished translation to <a href="mailto:vadim@wxwidgets.org">Vadim Zeitlin</a>