Help Localize HTTP Domain Extension

12 views
Skip to first unread message

Konstantin Molchanov

unread,
Nov 15, 2016, 3:25:49 AM11/15/16
to sphinx-dev
Hi!

We're using the HTTP Domain extension to document a REST API.

It's a great extension but it's English only—the headers are hardcoded in English. But our docs are in Russian.

Could you please tell my how do I add multilanguage support to an extension? The author of the extension couldn't assist unfortunately (https://bitbucket.org/birkenfeld/sphinx-contrib/issues/164/httpdomain-localize-labels).

Komiya Takeshi

unread,
Nov 15, 2016, 9:43:19 AM11/15/16
to sphinx-dev
Hi,

sphinx.locale and babel package might help you.

1. Mark target messages using sphinx.locale._()

from sphinx.locale import _

# surround the message you want to translate with _() function
print(_("english message"))

2. Use extract_message command of babel to extract messages

ref:

4. Put the translated message catalog to locale directory

Then it will be translated at runtime.

This is not tested and I'm not good at i18n.
So please test that before translating whole of messages.

Thanks,
Takeshi KOMIYA

2016年11月15日火曜日 17時25分49秒 UTC+9 Konstantin Molchanov:
Reply all
Reply to author
Forward
0 new messages