dev
Documentation icon Template documentation
[view] [edit] [history] [purge]

Note: parts of or the entire template might not be visible without values provided.
Description

This template is used for the localization of templates.

Description
Register localization

Before starting to use this template, the localization DB should be created. To do that, use the template {{L10n/register}}. Create a sub-page for your template called <!-- The name of your template -->/l10n and paste the code below:

<includeonly><!--
-->{{L10n/register|template's name|en
| key1 = value1
| key2 = value2
}}<!--
-->{{L10n/register|template's name|<!-- other language -->
| key1 = value1
| key2 = value2
}}<!--
--></includeonly>

en is the default language, so you should define it first.

Usage in templates

To retrieve a value from the DB, paste the code below:

{{l10n|<!-- template's name -->|<!-- key -->}}

By default, the template will parse the language preferences of user, so you don't have to specify it. However, you can still write it as the third parameter if you need to.

Sample output

The code on page Template:L10n/l10n:

<includeonly><!--
-->{{L10n/register|l10n|en
| first = first
| second = second
| third = third
}}<!--
-->{{L10n/register|l10n|es
| first = primero 
| third = tercero
}}<!--
-->{{L10n/register|l10n|ru
| first = первый 
| second = второй
}}<!--
--></includeonly>
Code Result (en user) Result (es user) Result (ru user)
{{L10n|l10n|first}} first primero первый
{{L10n|l10n|second}} second second второй
{{L10n|l10n|third}} third tercero third