मोड्युल:JSON data/doc
This is the documentation page for मोड्युल:JSON data
This module is intended to be used by bots or other automation tools which need to access Wiktionary data. This is not a general-purpose JSON serialisation module. Using one would be impractical, as experiments have shown that using one on the language data easily hits execution limits.
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). As of 11th of September 2013, the JSON for the languages table has been measured to weigh 666543 bytes. (Family data takes 13731 bytes, while scripts take 6279 bytes.) 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, the first specifies the types of languages (see Template:language data documentation) that will be listed in the data, while the following arguments list data keys which will be exported. For the first argument, the special values TWO_LETTER
, TWO_THREE_LETTER
and TWO_THREE_LETTER_REGULAR
can be passed. For example, invoking the function with TWO_LETTER
, canonicalName
and scripts
as arguments will export the canonical names and script codes for languages with two-letter codes. To conserve space, if only one key is specified, its value is listed directly in the root object (indexed by language codes).