plasTeX 3.0 — A Python Framework for Processing LaTeX Documents

6.5.2 Context language

Contexts objects hold language information for the currently running document. The current language is stored in Context.currentLanguage . It can be changed from the TeX source using the babel package which invokes the Context.loadLanguage  method. New terms can be added in a user defined language file using the lang-terms options (see Section 2.1.2). Languages files are xml files. The following example should be self-explanatory.

<languages>
  <terms lang="fr" babel="french">
    <term name="proof">Démonstration</term>
  </terms>
</languages>

This allows to add new terms which are then available to renderers in the dictionary Context.terms . It also allows to override default translations. For instance the above language file overwrites the default translation of “proof” as “Preuve” in French.