<type>documentation</type>
<domain>scripting</domain>
<id>i18n</id>
<title>Internationalization and Localization</title>
<date>$Date$</date>
<version>$Revision$</version>
<product>per+</product>

String literals and docstrings defined in scripts can be flagged for translation using the
``gettext`` system. To do this, the following code should be added before any string
literals are used::

  import gettext
  _ = gettext.translation('scripts_example', fallback=1).gettext
  _i18n_module = 'scripts_example'

The string ``'scripts_example'`` should be replaced with the name of the ``.mo``
translation file that will be added to the ``resources/locale`` localization directories
inside the Wing installation.

Subsequently, all translatable strings should be passed to the ``_()`` function as in this
code example::

  kMenuName = _("Test Base")
  
The separate ``_i18n_module`` attribute is needed to tell Wing how to translate
docstrings, which cannot be passed to ``_()``.

The ``pygettext.py`` script included with Python can be used to extract and merge strings
into a ``*.po`` file and then convert that file into an ``*.mo`` file. See Python's
documentation for `gettext <https://docs.python.org/library/gettext.html>`__ for details.
