:L10n subtemplate

Terraria Wiki
둘러보기로 이동 검색으로 이동
This template is i18n-ready, which means it is easy to localize for different languages. Please see I18n & l10n for templates to learn more.
See 틀:L10n subtemplate/l10n for the localization of this template.
This template uses Lua.
This template uses 모듈:L10ndatatable, a script written in the Lua programming language. To learn more about Lua, see Terraria Wiki:Lua.
Template-info.svg Documentation The documentation below is transcluded from 틀:L10n subtemplate/doc. (edit | history)

This template is used on localization subtemplates to provide a standardized documentation of the functionality of those subtemplates. It also automatically categorizes the page.

Usage

{{ l10n subtemplate | notable = y (optional) }}

notable

The template will print an overview table that visualizes the current localization configuration. Use this parameter to hide that table.

Note

This template uses %ARGS% paremeter of DPL to retrieve "raw" input of arguments(i.e. before parsing), it is roughly the code you wrote, not the parsed input received by the {{10n/register}} template.

For example, |title={{tr|box}}|name=Smith will be represented as §title={tr§box}§name=Smith in %ARGS%. through some string processing, we can get the original input code.

However, unfortunately, due to a bug(or a feature?) in DPL, for certain forms of input, some information is lost in %ARGS%'s value, specifically, consecutive parentheses. For example, |title={{code|{{tr|box}}}}|name=Smith, it should be §title={code§{tr§box}}§name=Smith or something similar, but in fact, you will get §title={code§{tr§box}§name=Smith, consecutive parentheses will appear only one. When this happens, the original input cannot be inferred with certainty. Here is an example: for |title={{note|{{code|{{tr|foo}} {{tr|bar}}}}}} and |title={{note|{{code|{{tr|foo}}}} {{tr|bar}}}}, both of them will be §title={note§{code§{tr§foo} {tr§bar} in %ARGS%.

This also happened to the {{l10n/register}} template's closing parentheses and will produce even more weird results. if you write {{l10n/register|ns|en|title={{code{{tr|foo}}}}}}, you will get §ns§en§title={code§{tr§foo} for %ARGS%, and, after this round of DPL loop ended, there will be a single ghost } goes out, then next loop round began. That ghost } is completely invisible to the DPL template code you wrote.

The HTML comments are invisible for %ARGS%, so be care with this, for example,

{{l10n/register|ns|en<!--
 ...
-->|title={{tr|foo}}<!--
-->}}

is same as {{l10n/register|ns|en<!-- ... -->|title={{tr|foo}}}} and will lead to incorrect result.

Adding white space between parentheses will solve this problem. For example, |title={{note|{{code|{{tr|foo}} {{tr|bar}} }} }} will work correctly. So,for l10n registion, the best practice is to use line breaks directly, without the aid of comments. For example:

{{l10n/register|ns|en
<!-- ...-->
  |title={{tr|foo}}
}}

And, if there are consecutive parentheses, split them will space:

{{l10n/register|ns|en
<!-- ...-->
  |title={{code|{{tr|foo}} }}
}}

This will not affect the function of l10 itself (and even slightly faster), and it can help l10 automatic document to be generated correctly.