User:結衣/Template:Int: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Add documentation)
m (Modify warning when undefined localization key6)
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
     | {{ #ifexist: {{ FULLPAGENAME }}/{{lc:{{{ 1 }}}}}
     | {{ #ifexist: {{ FULLPAGENAME }}/{{lc:{{{ 1 }}}}}
       | {{{{ FULLPAGENAME }}/{{lc:{{{ 1 }}}}}/{{PAGELANGUAGE}}}}
       | {{{{ FULLPAGENAME }}/{{lc:{{{ 1 }}}}}/{{PAGELANGUAGE}}}}
       | {{Error|Warning: please create i18n message {{#tag:code|[[{{ FULLPAGENAME }}/{{lc:{{{ 1 }}}}}|{{lc:{{{ 1 }}}}}]]}} and localization {{#tag:code|[[{{ FULLPAGENAME }}/{{lc:{{{ 1 }}}}}/{{PAGELANGUAGE}}|{{lc:{{{ 1 }}}}}/{{PAGELANGUAGE}}]]}}}}
       | {{Error|Warning: undefined localization key! Check if the key is misspelled or create the localization key {{#tag:code|[[{{ FULLPAGENAME }}/{{lc:{{{ 1 }}}}}|{{lc:{{{ 1 }}}}}]]}}.}}
       }}
       }}
     | {{ int: {{{ 1 }}} }}
     | {{ int: {{{ 1 }}} }}
Line 11: Line 11:
   | {{Error|Exception: please specify a {{ns:8}} or custom i18n message!}}
   | {{Error|Exception: please specify a {{ns:8}} or custom i18n message!}}
   }}</onlyinclude>
   }}</onlyinclude>
<noinclude>{{Documentation}}</noinclude>>
<noinclude>{{Documentation}}</noinclude>

Latest revision as of 19:41, 1 May 2023

Exception: please specify a MediaWiki or custom i18n message!

English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
About
Icon-translate.png Available doc translations
View
Page history

Usage

The {{i18n}} template is used to localize common strings by key similarly to the magic word {{int:}}. This is a necessary template for the Valve Developer Community since site administrators have yet to add Extension:Translate for i18n support. This seeks to deprecate the unmaintainable and sub-optimal localization stack built on Template:Autolang, Template:Uselangflags, and Template:Uselang. It should be used for localizing small phrases of text and not for full-page translation (e.g., see Template:Doc, Template:Dictionary). Localizations are automatically transcluded based on the user’s {{PAGELANGUAGE}}. If a localization is non-existent, then a link to the hypothetical page is returned.

This template is technically a wrapper for {{int:}} and will behave identically for MediaWiki messages. Otherwise, it will emit the localizations for a given custom localization key. Custom localization keys are stored as sub-pages to {{i18n}}. Each sub-page of a localization key is named after a valid MediaWiki language code and stores the raw translation of its localization key. For example, the localization key sandbox could have the sub-pages en and ja whose contents are Sandbox and サンドボックス, respectively.

Parameters

Parameter Description Type Status
Localization Key 1 The localization key to substitute a translation for. String required

Examples

  • {{User:結衣/Template:Int}} is an invalid state: Exception: please specify a MediaWiki or custom i18n message!
  • {{User:結衣/Template:Int|mainpage}} yields: Main Page
  • {{User:結衣/Template:Int|blahblahblah}} requests an non-existent localization key: Warning: undefined localization key! Check if the key is misspelled or create the localization key blahblahblah.