diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-03-02 13:45:42 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-03-02 13:45:42 +0300 |
commit | b3b5a595a91c7afd4da7ae71e762756d638459dd (patch) | |
tree | 2b1c004abe01c318d33c37fc648102c9ef6697fc /sphinx/locale | |
parent | 4b15b6659f4efde6e77dbb5ae39a3fa039d5485f (diff) |
docs: Update docs for i18n
Diffstat (limited to 'sphinx/locale')
-rw-r--r-- | sphinx/locale/__init__.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py index 94b0b854d..9f0e15af7 100644 --- a/sphinx/locale/__init__.py +++ b/sphinx/locale/__init__.py @@ -255,21 +255,19 @@ def get_translation(catalog, namespace='general'): import os from sphinx.locale import get_translation - EXTENSION_NAME = 'myextension' # name of both *.pot, *.po and *.mo files - _ = get_translation(EXTENSION_NAME) + MESSAGE_CATALOG_NAME = 'myextension' # name of *.pot, *.po and *.mo files + _ = get_translation(MESSAGE_CATALOG_NAME) text = _('Hello Sphinx!') def setup(app): package_dir = path.abspath(path.dirname(__file__)) locale_dir = os.path.join(package_dir, 'locales') - app.add_message_catalog(EXTENSION_NAME, locale_dir) + app.add_message_catalog(MESSAGE_CATALOG_NAME, locale_dir) With this code, sphinx searches a message catalog from - ``${package_dir}/locales/${language}/LC_MESSAGES/myextension.mo`` - (ex. ``sphinxcontrib.applehelp.mo``). Of course, you can use - arbitrary catalog name instead of ``__name__``. The - :confval:`language` is used for the searching. + ``${package_dir}/locales/${language}/LC_MESSAGES/myextension.mo``. + The :confval:`language` is used for the searching. .. versionadded:: 1.8 """ |