| | |
| | | package name is almost always ``gettext``. For example on a Debian or Ubuntu |
| | | system run this command: |
| | | |
| | | .. code-block:: text |
| | | .. code-block:: bash |
| | | |
| | | $ sudo apt-get install gettext |
| | | |
| | | Installing Lingua is done with the Python packaging tools. If the |
| | | :term:`virtual environment` into which you've installed your :app:`Pyramid` |
| | | application lives in ``/my/venv``, you can install Lingua like so: |
| | | application lives at the environment variable ``$VENV``, you can install Lingua |
| | | like so: |
| | | |
| | | .. code-block:: text |
| | | .. code-block:: bash |
| | | |
| | | $ cd /my/venv |
| | | $ $VENV/bin/easy_install lingua |
| | | $ $VENV/bin/pip install lingua |
| | | |
| | | Installation on Windows |
| | | +++++++++++++++++++++++ |
| | |
| | | |
| | | Installing Lingua is done with the Python packaging tools. If the |
| | | :term:`virtual environment` into which you've installed your :app:`Pyramid` |
| | | application lives in ``C:\my\venv``, you can install Lingua like so: |
| | | application lives at the environment variable ``%VENV%``, you can install |
| | | Lingua like so: |
| | | |
| | | .. code-block:: text |
| | | .. code-block:: ps1con |
| | | |
| | | C> %VENV%\Scripts\easy_install lingua |
| | | C> %VENV%\Scripts\pip install lingua |
| | | |
| | | |
| | | .. index:: |
| | |
| | | code and :term:`Chameleon` templates which reside in your :app:`Pyramid` |
| | | application. You run a ``pot-create`` command to extract the messages: |
| | | |
| | | .. code-block:: text |
| | | .. code-block:: bash |
| | | |
| | | $ cd /place/where/myapplication/setup.py/lives |
| | | $ cd /file/path/to/myapplication_setup.py |
| | | $ mkdir -p myapplication/locale |
| | | $ $VENV/bin/pot-create -o myapplication/locale/myapplication.pot src |
| | | |
| | |
| | | Initialize a ``.po`` file for a specific locale from a pre-generated ``.pot`` |
| | | template by using the ``msginit`` command from Gettext: |
| | | |
| | | .. code-block:: text |
| | | .. code-block:: bash |
| | | |
| | | $ cd /place/where/myapplication/setup.py/lives |
| | | $ cd /file/path/to/myapplication_setup.py |
| | | $ cd myapplication/locale |
| | | $ mkdir -p es/LC_MESSAGES |
| | | $ msginit -l es -o es/LC_MESSAGES/myapplication.po |
| | |
| | | First, regenerate the ``.pot`` file as per :ref:`extracting_messages`. Then use |
| | | the ``msgmerge`` command from Gettext. |
| | | |
| | | .. code-block:: text |
| | | .. code-block:: bash |
| | | |
| | | $ cd /place/where/myapplication/setup.py/lives |
| | | $ cd /file/path/to/myapplication_setup.py |
| | | $ cd myapplication/locale |
| | | $ msgmerge --update es/LC_MESSAGES/myapplication.po myapplication.pot |
| | | |
| | |
| | | compile ``.po`` files to ``.mo`` files using the ``msgfmt`` command from |
| | | Gettext: |
| | | |
| | | .. code-block:: text |
| | | .. code-block:: bash |
| | | |
| | | $ cd /place/where/myapplication/setup.py/lives |
| | | $ cd /file/path/to/myapplication_setup.py |
| | | $ msgfmt -o myapplication/locale/es/LC_MESSAGES/myapplication.mo \ |
| | | myapplication/locale/es/LC_MESSAGES/myapplication.po |
| | | |