Пређи на садржај

Шаблон:multitrans/documentation

This template is used to reduce Lua memory usage and running time on pages with large translation tables such as water, black, star, etc. It works by replacing a lot separate Lua module invocations, one per {{t}} or {{t+}} call, with a single module invocation that handles a whole batch of translations at once. It has one parameter, |data=, which should contain the entire text of one or more translation tables; it is recommended to surround a whole set of translation tables with a call to {{multitrans|data=<...>}}. An example usage:

{{multitrans|data=
{{trans-top|absorbing all light}}
* Abkhaz: {{tt|ab|аиқәаҵәа}}
* Acehnese: {{tt|ace|itam}}
* Afrikaans: {{tt+|af|swart}}
* Albanian: {{tt+|sq|zi}}
* Amharic: {{tt|am|ጥቁር}}
* Arabic: {{tt+|ar|أَسْوَد|m}}, {{tt|ar|سَوْدَاء|f}}, {{tt|ar|سُود|p}}
*: Moroccan Arabic: {{tt|ary|كحال|tr=kḥāl}}
* Armenian: {{tt|hy|սև}}
* Aromanian: {{tt|rup|negru}}, {{tt+|rup|laiu}}
* Asháninka: {{tt|cni|cheenkari}}, {{tt|cni|kisaari}}
* Assamese: {{tt|as|ক‌’লা}}, {{tt|as|কুলা}} {{qualifier|Central}}
* Asturian: {{tt|ast|ñegru}}, {{tt|ast|negru}}, {{tt|ast|prietu}}
* Atikamekw: {{tt|atj|makatewaw}}
* Avar: {{tt|av|чӏегӏера}}
* Aymara: {{tt|ay|ch’iyara}}
* Azerbaijani: {{tt+|az|qara}}
[etc.]
{{trans-bottom}}

{{trans-top|without light}}
* Bulgarian: {{tt+|bg|тъмен}}
* Catalan: {{tt+|ca|fosc}}
* Dutch: {{tt+|nl|donker}}
* Esperanto: {{tt+|eo|malhela}}
* Estonian: {{tt+|et|pime}}
* Finnish: {{tt+|fi|pimeä}}
* Georgian: {{tt|ka|ბნელი}}, {{tt|ka|მუქი}}, {{tt|ka|ბუნდოვანი}}
* Greek: {{tt+|el|σκοτεινός|m}}, {{tt+|el|ερεβώδης|m}}
[etc.]
{{trans-bottom}}
}}

Inside of the template, add a t to the beginning of translation templates:

  • {{t|...}} -> {{tt|...}}
  • {{t+|...}} -> {{tt+|...}}

The {{tt}} and {{tt+}} templates are pass-throughs, so that e.g. {{tt|ary|كحال|tr=kḥāl}} generates the literal text ⦃⦃t¦ary¦كحال¦tr=kḥāl⦄⦄, with braces replaced by brace-like Unicode chars and the pipe symbol replaced by a pipe-symbol-like Unicode char. These special chars are parsed by the Lua code and call the same code that underlyingly implements {{t}} and {{t+}}, but because this all happens inside a single module invocation instead of a lot of separate module invocations, it's much faster and more memory-efficient.