Template:Translit module documentation: Difference between revisions

From The Languages of David J. Peterson
Jump to navigation Jump to search
m (Replaced Wiktionary: links with Project: links)
(Replaced content with "<includeonly>{{#invoke:documentation/translit|documentation_template}}</includeonly><noinclude>{{documentation}}</noinclude>")
Tag: Replaced
 
Line 1: Line 1:
This module will transliterate <!--
<includeonly>{{#invoke:documentation/translit|documentation_template}}</includeonly><noinclude>{{documentation}}</noinclude>
 
XXX: needs a way to generate category names reliably
-->{{#if:{{#invoke:languages/templates|exists|{{{1|und}}}}}<!--
-->|<!--
  -->[[:Category:{{#invoke:languages/templates|getByCode|{{{1|und}}}|getCategoryName}}|{{#invoke:languages/templates|getByCode|{{{1|und}}}|getCategoryName}}]] text<!--
-->|<!--
  -->text in the [[:Category:{{#invoke:scripts/templates|getByCode|{{{1|Zyyy}}}|getCategoryName}}|{{#invoke:scripts/templates|getByCode|{{{1|Zyyy}}}|getCategoryName}}]]<!--
-->}}<!--
 
-->{{#if:{{{2|}}}<!--
-->|<!--
  -->&#32;{{{2|}}}<!--
-->|<!--
  -->{{#ifexist:Wiktionary:{{uc:{{{1}}} TR}}<!--
  -->|<!--
    -->&#32;per [[Project:{{uc:{{{1|und}}}}} TR]]<!--
  -->}}<!--
-->}}. {{#if:{{{2|}}}|[[Category:Erutuon's test category|1]]|{{#invoke:documentation|translitModuleLangList}}}}{{#if:{{{1|}}}||[[Category:Erutuon's test category|2]]}}
 
The module should preferably not be called directly from templates or other modules. To use it from a template, use {{temp|xlit}}. Within a module, use [[Module:languages#Language:transliterate]].
 
For testcases, see [[Module:{{BASEPAGENAME}}/testcases]].
 
== Functions ==
; {{code|lua|tr(text, lang, sc)}}
: Transliterates a given piece of {{code|lua|text}} written in the script specified by the code {{code|lua|sc}}, and language specified by the code {{code|lua|lang}}. When the transliteration fails, returns {{code|lua|nil}}.
<includeonly>{{#invoke:module categorization|categorize}}</includeonly><noinclude>{{documentation}}</noinclude>

Latest revision as of 11:37, 4 May 2024


This template generates documentation pages for transliteration modules. It requires a single parameter: the language or script code. The second parameter provides optional text to be displayed after "This module will transliterate x language text".

If the second parameter is not provided, the languages that use the module will be listed, if they can be detected. In all cases, a category will be added for every language, and the category Transliteration modules will be added, with the canonical name corresponding to the code in the module name as sortkey (for example, Module:sa-translit[[Category:Transliteration modules|Sanskrit]]).

Module:languages/byTranslitModule finds the languages that use the module, and the translitModuleLangList function in Module:documentation lists them, and the categorize function in Module:module categorization adds categories for each one. This will only work if the transliteration module is listed in the language's data file or in the language's entry in Module:translit-redirect/data.