Languages & localization

Metanorma allows generation of standards in different languages.

The language of the document is specified in following document attributes:

  • :language: — ISO 639-2 two-letter language code. Defaults to en.

  • :script: — ISO 15924 script code (for languages with more than one script). Defaults to Latn. e.g., specify Hant for Traditional Chinese.

  • :i18nyaml: — language template file. Only needed if you’re using a language other than English, Chinese (Simplified) or French.

Localised string variants can be specified using the lang:[] macro [added in]:

  • lang:XX[] indicates a string specific to language XX; e.g. lang:fr[text]

  • lang:XX-YYYY[] indicates a string specific to language XX and script YYYY; e.g. lang:zh-Hant[text]

If lang:[] macros appear next to each other in a document, and one of the macros matches the current document language (and script, if supplied), then only that macro will be rendered. For example, if the document is in English,

=== lang:en[husked rice] lang:fr[riz décortiqué]

is rendered as

husked rice


If you’re looking for information about how to add support for a new language in your custom Metanorma workflow, see localization in Metanorma builder’s documentation.