[Numpy-discussion] Internationalization of numpy/scipy docstrings...
Tim Cera
tim at cerazone.net
Sat May 19 18:04:43 EDT 2012
I have thought for a long time that it would be nice to have numpy/scipy
docs in multiple languages. I didn't have any idea how to do it until I
saw http://sphinx.pocoo.org/intl.html. The gettext builder which is a
requirement to make this happen is relatively new to sphinx.
Outline of above applied to numpy/scipy...
1. pydocweb would use the new gettext builder to convert *.rst to *.pot
files.
2. Translators would use pootle to edit the *.pot files to *.po files
pydocweb or pootle would use mgsfmt to create *.mo files
3. From here can choose either:
a. Have pydocweb use sphinx-build to create new,
translated *.rst files from the *.mo files.
(my favorite since we would have *.rst files)
b. OR use gettext in Python to translate docstring
on-the-fly from the *.mo files.
A user would then install a language kit, maybe something like scikits
and access the translated docstring with a new 'np.info'. As near as I can
figure, Python 'help' command can't be replaced by something else, so
'help' would always display the English docstring.
I have pydocweb and pootle setup locally and working. Ran into a problem
though with sphinx-build creating the initial *.pot files. It seems to be a
problem with numpydoc. It fails on 'function' and 'auto*' directives. I
tried to look at numpydoc and it is a bit of very intense coding and I
frankly have not been able to find my way around.
I am willing to put in some work for this to happen. My block right now is
getting the initial *.pot files.
Any interest?
You can see the problem directly by changing into the numpy/doc directory
and use the following command:
sphinx-build -b gettext -P source/ gettext/
Once sphinx-build is working, then the target build directory (which I
called 'gettext' above) would be in a location accessible to pootle.
Kindest regards,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120519/fe0f5b13/attachment.html>
More information about the NumPy-Discussion
mailing list