how to translate strings in conf.py?

12 views
Skip to first unread message

RJ Skerry-Ryan

unread,
Feb 21, 2020, 1:06:43 PM2/21/20
to sphinx-users
There are various user-visible strings in conf.py that I'm not sure how to translate, for example copyright, html_title, etc.


Is there a way to translate these? I've tried:

from sphinx import locale
copyright = _("...")

But they do not show up in source/locale/*.pot after running make gettext.

Komiya Takeshi

unread,
Feb 21, 2020, 10:44:02 PM2/21/20
to sphinx...@googlegroups.com
Hi,

Hmm... it's difficult question. At this moment, there are no support
from Sphinx.
So you need to switch messages inside conf.py by yourself:

```
if language == 'ja':
copyright = ...
elif language == 'de':
copyright = ...
else:
copyright = ...
```

Thanks,
Takeshi KOMIYA

2020年2月22日(土) 3:06 RJ Skerry-Ryan <russel...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/dcf7448a-7b4b-44a7-903b-6c726e404431%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages