From: Guenter M. <mi...@us...> - 2017-05-11 12:40:42
|
Dear David, On 2017-05-10, Dave Kuhlman wrote: >> However, styles seems to be correct. Also, I am not sure, whether >> I should use cs, cs-CZ, or cs_CZ language code. > You can use "-l" or "--language" and any of: > cs-CZ > cs_CZ > cs-cz > cs_cz > They all have the same effect, as far as I can tell. But, "-l cs" > does *not* work. I don't know whether it should or not. Generally, Docutils follows the "best current praxis" `BCP 47`__ which says that any specifiers (like the region subtag here) is optional. Czech-language mappings for language-dependent features of Docutils. are in the files .../docutils/languages/cs.py .../docutils/parsers/rst/languages/cs.py that are used for any of the above language tags. In some cases, special files for sub-locales exist, e.g., "pt_br.py" for Brasilanean Portugese. The HTML writers also insert the original language tag into the document header. The XML writer uses the language tag to support "localized" directive names. It does, however, not insert a language tag into the output document. This is IMO a bug. The LaTeX writer translates the tag into a Babel language name (or with XeTeX/LuaTeX a Polyglossia name), if there language is supported. Subvarieties (de-1901, de-CH, de-AT, say) are respected, if supported by Babel/Polyglossia, e.g. 'en-AU': 'australian', 'en-CA': 'canadian', 'en-GB': 'british', 'en-NZ': 'newzealand', 'en-US': 'american', __ http://www.rfc-editor.org/rfc/bcp/bcp47.txt > You can try "-l cs", but you end up with the language "cs-US", which > I'm guessing you do not want. This seems wrong in any case. It should stay "cs" without the optional region subtag. There is a function to iterate over "normalized" language tags: utils.normalize_language_tag() """Return a list of normalized combinations for a `BCP 47` language tag. Example: >>> normalize_language_tag('de_AT-1901') ['de-at-1901', 'de-at', 'de-1901', 'de'] """ used, e.g., in the latex writer, the smartquotes transform and ``parsers.rst.languages.get_language(language_code)``. Maybe this can also help in the odt writer? Günter |