localization
.localization name:{String}
merge:{Boolean = false}
contents:{Map<String, Dictionary<Any>>}
-> Void
Defines and registers a new localization table, whose entries are key-value pairs for each locale and defined by a Markdown dictionary.
Example:
.localization {mytable}
- English
- morning: Good morning
- evening: Good evening
- Italian
- morning: Buongiorno
- evening: Buonasera
The localization entries can then be accessed via the localize function, after setting the document language via doclang:
.doclang {english}
.localize {mytable:morning} <!-- Good morning -->
If merge is set to true, it can be used to expand an existing localization table.
Example, extending stdlib's localization table:
.doclang {fr-CA}
.localization {std} merge:{true}
- fr-CA
- warning: Avertissement
.box type:{warning}
Box content
In this example, the warning box will automatically feature the "Avertissement" title, since the std:warning
localization key is accessed by the .box
function.
Parameters
name of the localization table. Must be unique if merge is false.
if enabled and a table with the same name already exists, the two tables will be merged, with higher priority to the new one
dictionary of locales and their key-value entries
Throws
if the contents are not in the correct format, or if the table name is already defined and merge is false