Re: Role for different human language?
Guenter Milde via Docutils-users <[email protected]> Sun, 23 Feb 2020 16:23:47 -0000 (UTC)
| Newsgroups | gmane.text.docutils.user |
|---|---|
| Message-ID | <[email protected]> |
On 2020-02-22, Matěj Cepl wrote:
> I am looking for some markup which say that the phrase in the
> text is of different human language. E.g., I have this paragraph
> (written in otherwise English story):
> In the end both options happened. Uncle Harry in secret
> asked the French Bureau des Aurors to sent somebody to start
> the investigation, and so I spent two afternoons in small
> café near my University with the French lady, who asked me
> very thoroughly about my story.
> Now, I would like to mark the term “Bureau des Aurors” so that
> screen reader or other software know that it is not English and
> behave accordingly. Is there a standard way how to do it? Yes,
> I understand I can define my own custom role for it (translating
> to ``<span lang="fr_FR">``), but isn’t there a standard role?
There is a method for defining the language of text parts: The HTML and
LaTeX writers convert a "class" argument starting with ``language-`` in a
language argument with the remainder, e.g.
::
.. role:: language-de
Let's count in German :language-de:`eins zwei drei`.
becomes in HTML::
Let's count in German <span lang="de">eins zwei drei</span>.
and in LaTeX::
Let’s count in German \foreignlanguage{ngerman}{eins zwei drei}.
For block-level elements, you can use the ``.. class::`` directive or
the :class: directive option.
See:
https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/test/functional/input/data/custom_roles.txt
https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/test/functional/expected/standalone_rst_html5.html#l1221
https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/test/functional/expected/standalone_rst_latex.tex#l1766
(Also, have a look for "Die Trichter" in these documents to see an example
to define a block's language.)
Hope this helps,
Günter
_______________________________________________
Docutils-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-users
Please use "Reply All" to reply to the list.