This module is intended to be used by bots or other automation tools which need to access Wiktionary data.
Bots may access the data by using mw:API:Expandtemplates or requesting the raw source of a page invoking this module with a &templates=expand
query parameter.
Make sure you only load this module once (or twice, if you need both the languages table and another table). Generating the JSON data takes a few seconds and puts a relatively high strain on the servers.
Available functions are: export_languages
, export_scripts
and export_families
, which generate the JSON equivalents of Module:languages, Module:scripts and Module:families respectively. The structure of the data corresponds exactly to the one used in Wiktionary modules, with a caveat below.
When export_languages
is given positional arguments:
TWO_LETTER
, TWO_THREE_LETTER
and TWO_THREE_LETTER_REGULAR
can be passed. For example, invoking the function with TWO_LETTER
, 1
and 4
as arguments will export the canonical names and script codes for languages with two-letter codes.Examples:
{{#invoke:JSON data|export_languages||ancestors|3}}
This will return the ancestors and language family for every language. (See Template:language data documentation for an explanation of numbers 1
to 4
.)
{{#invoke:JSON data|export_languages|TWO_LETTER}}
This will return all available info for two-letter language codes. (Note, this is currently broken and returns a Lua error.)