Template:Language/archives/Autolang: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(This should fix the pre not being outside of the template)
 
(23 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<!--
{{Uselangflags|en=1|es=1|vi=1|zh=1|hr=1|de=1}}
 
<onlyinclude>
 
{{Tdeprecated|notes = Use #switch parser function instead. Example <br>{{pre|<nowiki>{{#switch: {{language}}</nowiki><br><nowiki>| #default = English</nowiki><br><nowiki>| ja = 日本語</nowiki><br><nowiki>| zh-tw = 中文(台灣)</nowiki><br><nowiki>}}</nowiki> }}
    + Documentation +
 
 
-->{{Uselangflags|en=1|zh=1}}
{{doc|tools=0|content=
{{autolang|zh={{:User:1416006136/Signature|create=1}}}}
{{autolang|This template can change the content automaticaly according to the language of the UI. Should use with {{tl|Uselangflags}}. The documentation of the template is written by using this template.|zh=该模板可以根据 UI 语言来自动更改显示的内容。应该与 {{tl|Uselangflags}} 一起使用。模板的文档是使用此模板编写的。}}
<h2>{{autolang|Usage|zh=用法}}</h2>
<h3>{{autolang|Parameters|zh=参数}}</h3>
*{{param|1}} - {{autolang|(Unnamed parameter) the default value to show (when this language has not translation). It should be in English.|zh=(未命名参数)要显示的默认值(当该语言没有翻译时)。它应该是用英语写的。}}
*{{param|<lang code>}} - {{autolang|The value should be the content of this language. See examples for details.|zh=它的值应该是这个语言的内容。参见示例查看详情。}}
<h3>{{autolang|Examples|zh=示例}}</h3>
{{Uselangflags|en=1|de=1|ja=1|vi=1|ru=1|zh=1|old-right-align=1|transparent=1|noborder=1}}
{{autolang|The buttons on the right can help you change the language of the UI easily.<br>|zh=右边的按钮可以帮助你更方便地切换 UI 的语言。}}
 
{{Code|<nowiki>{{autolang|Document}}</nowiki>}} → {{autolang|Document}}<br>
{{Code|<nowiki>{{autolang|Document|zh=文档}}</nowiki>}} → {{autolang|Document|zh=文档}}<br>
{{Code|<nowiki>{{autolang|Document|ru=документ|zh=文档|de=Dokument|ja=文書|fr=Document}}</nowiki>}} → {{autolang|Document|ru=документ|zh=文档|de=Dokument|ja=文書|fr=Document}}<br>
<h2>{{autolang|See Also|zh=另见}}</h2>
*{{tl|Uselangflags}}
*{{tl|uilang}}
*{{tl|suflang}}
}}
}}
[[Category:Multiple languages]][[Category:Translation templates]][[Category:Templates]]<!--
</onlyinclude>
 
{{doc}}
 
  + Template +
 


--><includeonly><onlyinclude>{{#if:{{uselang|{{SUBPAGENAME}}}}|{{{{{SUBPAGENAME}}|{{{1|}}}}}}|{{{{{uselang}}|{{{1|}}}}}}}}</onlyinclude></includeonly>
[[Category:Translation templates]]
[[Category:Templates]]

Latest revision as of 14:55, 30 March 2025

English (en)Deutsch (de)Español (es)Hrvatski (hr)Tiếng Việt (vi)中文 (zh)
Red x.png
This template (and its redirect) is Wikipedia icon Deprecated. Its use is not recommended and its functionality may be compromised.
You can help our editors by replacing or deleting this template on the Pages that use this template. Once no more pages use this template, it should be Marked for deletion.

Additional notes:
Use #switch parser function instead. Example
{{#switch: {{language}}
| #default = English
| ja = 日本語
| zh-tw = 中文(台灣)
‎}}
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)
Curly brackets white.pngTemplate Documentation [view] [edit]
Icon-translate.png Available doc translations
View
Page history
This template can change the content automatically according to the language of the page or the interface. Should use with {{Uselangflags}} or {{LanguageBar}}. The documentation of the template is written by using this template.
Also, if you encounter a bug that the text is missing, use "| 1 = Text" or try to remove atleast one pipe "|" as a workaround.

Usage

Parameters

  • {{{1}}} - (Unnamed parameter) the default value to show (when this language has not translated). It should be in English.
  • {{{<lang code>}}} - The value should be the content of this language. See examples for details.
  • {{{int}}} - The template should decide the language according to the interface language instead of page language if enbaled.

Examples

English (en)Deutsch (de)日本語 (ja)Русский (ru)Tiếng Việt (vi)中文 (zh)

The buttons on the right can help you change the language of the UI easily.
{{#switch: {{intlang}}|#default = Document}} → Document
{{#switch: {{intlang}}|#default = Document|zh=文档}} → Document
{{#switch: {{intlang}}|#default = Document|ru=документ|zh=文档|de=Dokument|ja=文書|fr=Document|vi=Tài liệu}} → Document

{{#switch: {{intlang}} | #default = Document | ru = документ | zh = 文档 | hr = Dokument | de = Dokument | ja = 文書 | fr = Document | vi = Tài liệu }}
→ Document (Same as above, but with usage of line breaks and spacing to making it look less messy)

See also