[Doc-SIG] Choosing a language?

David Goodger goodger@python.org
Thu, 27 Mar 2003 23:49:16 -0500


Pearu Peterson wrote:
> Q: How to specify in a rst document the language of its contents?

You can't currently.  There's an entry in the to-do list: 
<http://docutils.sf.net/spec/notes.html#misc-language>.

Currently, the way to specify the language is through a runtime setting 
(see below) or command-line option (-l/--language).

> I have rst documents in Estonian language and I have prepared
> docutils/languages/et.py file but I could not find out how to enable it.

Please contribute it to the project!  Also, a 
docutils/parsers/rst/languages/et.py translation would be appreciated. 
See <http://docutils.sf.net/spec/howto/i18n.html> for an overview.

Note that yesterday I changed the bibliographic_fields data structure in 
the docutils/languages files.

> In case languages cannot be specified in rst documents, here follows a
> codelet that I am using to transform documents:
> 
>   import docutils.core
>   docutils.core.publish_file(source_path = src_name,
>                              destination_path = dest_name,
>                              reader_name='standalone',
>                              parser_name='restructuredtext',
>                              writer_name='html',
>                              )

Add this parameter::

     settings_overrides={'language_code': 'et'},

-- 
David Goodger    http://starship.python.net/~goodger

Programmer/sysadmin for hire: http://starship.python.net/~goodger/cv