Skip to content

Commit

Permalink
[iar#176] Update documentation for JavaScript translations
Browse files Browse the repository at this point in the history
  • Loading branch information
torfsen committed Nov 2, 2016
1 parent 00677c2 commit 5f6e385
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
3 changes: 3 additions & 0 deletions ckan/plugins/interfaces.py
Expand Up @@ -1547,6 +1547,9 @@ def abort(self, status_code, detail, headers, comment):


class ITranslation(Interface):
u'''
Allows extensions to provide their own translation strings.
'''
def i18n_directory(self):
u'''Change the directory of the .mo translation files'''

Expand Down
13 changes: 6 additions & 7 deletions doc/contributing/string-i18n.rst
Expand Up @@ -277,19 +277,18 @@ placeholders and constructing plural forms. Note that you should not call
.. note::
CKAN's JavaScript code automatically downloads the appropriate translations
at request time from the CKAN server. The corresponding translation files
are generated beforehand using ``paster trans js``. During development you
need to run that command manually if you're updating JavaScript
translations::
at request time from the CKAN server. Since CKAN 2.7 the corresponding
translation files are regenerated automatically if necessary when CKAN
starts.
You can also regenerate the translation files manually using ``paster trans
js``::
python setup.py extract_messages # Extract translatable strings
# Update .po files as desired
python setup.py compile_catalog # Compile .mo files for Python/Jinja
paster trans js # Compile JavaScript catalogs
Also note that extensions currently `cannot provide translations for
JS strings <https://github.com/ckan/ideas-and-roadmap/issues/176>`_.
-------------------------------------------------
General guidelines for internationalizing strings
-------------------------------------------------
Expand Down
15 changes: 6 additions & 9 deletions doc/extensions/translating-extensions.rst
Expand Up @@ -30,6 +30,12 @@ containing:
This template provides a sample string that we will internationalize in this
tutorial.

.. note::

While this tutorial only covers Python/Jinja templates it is also possible
(since CKAN 2.7) to :ref:`translate strings in an extension's JavaScript
modules <javascript_i18n>`.

---------------
Extract strings
---------------
Expand Down Expand Up @@ -164,12 +170,3 @@ implement the ``ITranslation`` interface yourself.
~ckan.plugins.interfaces.ITranslation.i18n_locales
~ckan.plugins.interfaces.ITranslation.i18n_domain
----------
JavaScript
----------
Extensions currently `cannot provide their own translations for JavaScript
strings <https://github.com/ckan/ideas-and-roadmap/issues/176>`_.
However, they can re-use existing JavaScript translations from CKAN. See
:ref:`javascript_i18n` for details.
8 changes: 7 additions & 1 deletion doc/maintaining/paster.rst
Expand Up @@ -504,9 +504,15 @@ trans: Translation helper functions

Usage::

trans js - generate the javascript translations
trans js - generate the JavaScript translations
trans mangle - mangle the zh_TW translations for testing

.. note::

Since version 2.7 the JavaScript translation files are automatically
regenerated if necessary when CKAN is started. Hence you usually do not
need to run ``paster trans js`` manually.


.. _paster-user:

Expand Down

0 comments on commit 5f6e385

Please sign in to comment.