Steve Piercy
2016-07-02 53c040906a380276282e22c305c4fdd112f2fbce
fix URLs, spell out virtual environment, fix reST syntax
2 files modified
48 ■■■■ changed files
docs/narr/firstapp.rst 8 ●●●● patch | view | raw | blame | history
docs/narr/i18n.rst 40 ●●●● patch | view | raw | blame | history
docs/narr/firstapp.rst
@@ -27,15 +27,15 @@
On UNIX:
.. code-block:: text
.. code-block:: bash
   $ $VENV/bin/python helloworld.py
On Windows:
.. code-block:: text
.. code-block:: doscon
   C:\> %VENV%\Scripts\python.exe helloworld.py
   c:\> %VENV%\Scripts\python helloworld.py
This command will not return and nothing will be printed to the console. When
port 8080 is visited by a browser on the URL ``/hello/world``, the server will
@@ -197,7 +197,7 @@
server to present an application to a requestor. :term:`WSGI` is a protocol
that allows servers to talk to Python applications.  We don't discuss
:term:`WSGI` in any depth within this book, but you can learn more about it by
visiting `wsgi.org <http://wsgi.org>`_.
reading its `documentation <http://wsgi.readthedocs.org/en/latest/>`_.
The :app:`Pyramid` application object, in particular, is an instance of a class
representing a :app:`Pyramid` :term:`router`.  It has a reference to the
docs/narr/i18n.rst
@@ -265,17 +265,18 @@
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:`virtualenv` into which you've installed your :app:`Pyramid` application
lives in ``/my/virtualenv``, you can install Lingua like so:
:term:`virtual environment` into which you've installed your :app:`Pyramid`
application lives at the environment variable ``$VENV``, you can install Lingua
like so:
.. code-block:: text
.. code-block:: bash
   $ cd /my/virtualenv
   $ cd $VENV
   $ $VENV/bin/easy_install lingua
Installation on Windows
@@ -288,12 +289,13 @@
``$PATH``.
Installing Lingua is done with the Python packaging tools. If the
:term:`virtualenv` into which you've installed your :app:`Pyramid` application
lives in ``C:\my\virtualenv``, you can install Lingua like so:
:term:`virtual environment` into which you've installed your :app:`Pyramid`
application lives at the environment variable ``%VENV%``, you can install
Lingua like so:
.. code-block:: text
.. code-block:: doscon
   C> %VENV%\Scripts\easy_install lingua
   c:\> %VENV%\Scripts\easy_install lingua
.. index::
@@ -308,9 +310,9 @@
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
@@ -331,9 +333,9 @@
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
@@ -342,7 +344,7 @@
``myapplication/locale/es/LC_MESSAGES/myapplication.po``.
Once the file is there, it can be worked on by a human translator. One tool
which may help with this is `Poedit <http://www.poedit.net/>`_.
which may help with this is `Poedit <https://poedit.net/>`_.
Note that :app:`Pyramid` itself ignores the existence of all ``.po`` files.
For a running application to have translations available, a ``.mo`` file must
@@ -362,9 +364,9 @@
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
@@ -380,9 +382,9 @@
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
@@ -646,7 +648,7 @@
The features represented by attributes of the ``i18n`` namespace of Chameleon
will also consult the :app:`Pyramid` translations. See
http://chameleon.readthedocs.org/en/latest/reference.html#id50.
http://chameleon.readthedocs.org/en/latest/reference.html#translation-i18n.
.. note::