i18n not working on Windows
Though the internationalization feature for user documents which will be introduced in Sphinx 1.1 is really amazing, there seems to be a little bug -- it doesn't work on Windows. On Linux platforms Sphinx 1.1pre (tip) correctly replaces original messages with translated ones, but on Windows it does no replacement.
I found that this is because an incorrect catalog name is passed to
sphinx/locale/__init__.py); on Windows, it is something like
I also found that
sphinx.locale.init() is called from
sphinx/environment.py) as follows:
docname = posixpath.splitext(source[len(env.srcdir):].lstrip('/')) section = docname.split(SEP, 1)
That is why the value of
catalog argument of init (init_locale) remains intact on Windows machines. Of course gettext cannot find the
.mo file and no translation takes place.
I think it is desirable to use
os.sep rather than '/' or
posixpath. I created and attached a patch which makes this fix: Sphinx_rev3237.patch. I confirmed the patch both works on Windows 7 and Ubuntu Linux 10.10.