--- gettext.original.txt 2010年04月23日 02:23:00.276975448 +0200 +++ gettext.txt 2010年04月23日 02:43:53.681995720 +0200 @@ -536,35 +536,24 @@ In this example, the string ``'writing a log message'`` is marked as a candidate for translation, while the strings ``'mylog.txt'`` and ``'w'`` are not. -The Python distribution comes with two tools which help you generate the message -catalogs once you've prepared your source code. These may or may not be -available from a binary distribution, but they can be found in a source -distribution, in the :file:`Tools/i18n` directory. - -The :program:`pygettext` [#]_ program scans all your Python source code looking -for the strings you previously marked as translatable. It is similar to the GNU -:program:`gettext` program except that it understands all the intricacies of -Python source code, but knows nothing about C or C++ source code. You don't -need GNU ``gettext`` unless you're also going to be translating C code (such as -C extension modules). +To extract the strings meant for translation there exist a few tools. +The original GNU :program:`gettext` only supports C or C++ source code but its +extended version :program:`xgettext`[#]_ [#]_ scans code written in a number of +languages, including python, looking for strings marked as translatable. -:program:`pygettext` generates textual Uniforum-style human readable message -catalog :file:`.pot` files, essentially structured human readable files which +:program:`xgettext` generates textual Uniforum-style human readable message +catalog :file:`.po` files, essentially structured human readable files which contain every marked string in the source code, along with a placeholder for the -translation strings. :program:`pygettext` is a command line script that supports -a similar command line interface as :program:`xgettext`; for details on its use, -run:: - - pygettext.py --help - -Copies of these :file:`.pot` files are then handed over to the individual human -translators who write language-specific versions for every supported natural -language. They send you back the filled in language-specific versions as a -:file:`.po` file. Using the :program:`msgfmt.py` [#]_ program (in the -:file:`Tools/i18n` directory), you take the :file:`.po` files from your -translators and generate the machine-readable :file:`.mo` binary catalog files. -The :file:`.mo` files are what the :mod:`gettext` module uses for the actual -translation processing during run-time. +translation. + +Copies of these :file:`.po` files are then handed over to the individual human +translators who fill in the translations. They send you back the filled in +language-specific versions that are then transformed into yet another format +using the :program:`msgfmt` program (usually distributed with +:program:`gettext`). You take the :file:`.po` files from your translators and +generate the machine-readable :file:`.mo` binary catalog files. The :file:`.mo` +files are what the :mod:`gettext` module uses for the actual translation +processing at run-time. How you use the :mod:`gettext` module in your code depends on whether you are internationalizing a single module or your entire application. The next two @@ -757,10 +746,9 @@ similar job. It is available as part of his :program:`po-utils` package at http ://po-utils.progiciels-bpi.ca/. -.. [#] :program:`msgfmt.py` is binary compatible with GNU :program:`msgfmt` except that - it provides a simpler, all-Python implementation. With this and - :program:`pygettext.py`, you generally won't need to install the GNU - :program:`gettext` package to internationalize your Python applications. +.. [#] Some Python distributions may bundle the programs :program:`pygettext.py` and + :program:`msgfmt.py` however :program:`pygettext.py` cannot cope with plural + translations. .. [#] The choice of :func:`N_` here is totally arbitrary; it could have just as easily been :func:`MarkThisStringForTranslation`.