summaryrefslogtreecommitdiff
path: root/docs/zcml/translationdir.rst
blob: 5cf615d269479fb7df47e27322c87dd98fa27388 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
.. _translationdir_directive:

``translationdir``
------------------

Add a :term:`gettext` :term:`translation directory` to the current
configuration for use in localization of text.

Attributes
~~~~~~~~~~

``dir``
  The path to the translation directory.  This path may either be 1)
  absolute (e.g. ``/foo/bar/baz``) 2) Python-package-relative
  (e.g. ``packagename:foo/bar/baz``) or 3) relative to the package
  directory in which the ZCML file which contains the directive
  (e.g. ``foo/bar/baz``).

Example 1
~~~~~~~~~

.. code-block:: xml
   :linenos:

   <!-- relative to configure.zcml file -->

   <translationdir
     dir="locale"
     />

Example 2
~~~~~~~~~

.. code-block:: xml
   :linenos:

   <!-- relative to another package -->

   <translationdir
     dir="another.package:locale"
     />

Example 3
~~~~~~~~~

.. code-block:: xml
   :linenos:

   <!-- an absolute directory name -->

   <translationdir
     dir="/usr/share/locale"
     />

Alternatives
~~~~~~~~~~~~

Use :meth:`pyramid.config.Configurator.add_translation_dirs`
method instance during initial application setup.

See Also
~~~~~~~~

See also :ref:`activating_translation`.