साचा:LangSwitch/doc
"दस्तावेजीकरणाचा हा भाग केवळ मर्यादित संख्येतील भाषांमध्येच उपलब्ध आहे."
Provides a method to present a string of text selected from an array of many language translations in the language set in the user's preferences or the most appropriate fallback language (as determined by GetFallback).
हा साचा खालील वर्ग आपोआप स्थापतो: Category:LangSwitch template without default version
वापर
{{LangSwitch
|en =
|xx =
|default =
}}
साच्याचे प्राचल (पॅरामिटर्स)
- TemplateData
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.
Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either useTemplateData=1
or useTemplateData=only
on the /doc
subpage and transcluding it with {{Documentation}} into the template. <nowiki>
-tags can be wrapped around the the arguments, if required, to avoid templates being expanded.
Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw <templatedata>-tags into the Wikitext or the template as described in various Wikipediae.
Wikipedia's help about TemplateData • Commons-specific information
प्राचल | वर्णन | प्रकार | स्थिती | |
---|---|---|---|---|
default |
| तंतू | ऐच्छिक | |
en | तंतू | हवे | ||
lang | Language code (only needs to be provided if the language displayed is to be fixed and independent of the user’s preferences).. Many templates use <code>{{#if:{{{lang|}}}|{{{lang|}}}|{{int:Lang}}}}</code>.
| तंतू | ऐच्छिक | |
nocat | तंतू | ऐच्छिक | ||
xx | तंतू | ऐच्छिक |
अतिरिक्त माहिती
हा साचा खालील नामविश्वात वापरण्यासाठी उद्देशित आहे: काहीच नामविश्वे नमूद केली नाहीत
हा साचा खालील सदस्यगटांना वापरण्यासाठी उद्देशित आहे: सर्व प्रवेशित सदस्य
Relies on:
module:fallback and module:fallbacklist
⧼Seealso⧽
"दस्तावेजीकरणाचा हा भाग केवळ मर्यादित संख्येतील भाषांमध्येच उपलब्ध आहे."
- {{Autotranslate}} for template internationalization (i18n) mechanism for templates that use named parameters
- {{GetFallback}}, {{Fallback}}, {{Translation table}}
- Category:Internationalization templates using LangSwitch
Localization
हा साचा स्थनिकीकरणासाठी उद्देशित नाही.
"दस्तावेजीकरणाचा हा भाग केवळ मर्यादित संख्येतील भाषांमध्येच उपलब्ध आहे."
I18n templates: | {{Multilingual description}} | {{en}}{{fr}}… | {{LangSwitch}} | {{Autotranslate}} | {{TNT}} |
---|---|---|---|---|---|
Requires JavaScript enabled for folding | + | + | − | − | − |
Folding can be disabled by user | + | + | − | − | − |
Folding is done server-side | − | − | + | + | + |
Folding when at least n languages are provided | 1 | 4 | 1 | 1 | 1 |
Collation order of languages (when not folded) | Latin, Latin or Cyrillic, Cyrillic, Greek, other simple LTR alphabets, Indic, other South Asian, Syllabaries, Hangul, Japanese scripts, Sinograms, Hebrew, Arabic languages | as provided by the user in the wikitext | − | − | − |
Search indexing issues | − | − | ? | partially (where used; language subpages of templates are indexed) | − |
Recommended use at | categories, galleries | file description pages | other pages incl. simple templates | larger templates when used on pages that do not have language subpages (e.g. not having Main page/en , Main page/de ) and where the language displayed will be automatically determined by the language set in user preferences
|
larger templates when used on pages that do have language subpages; most of the time these will be pages prepared with the Translate Extension |
Contains expensive parser functions | − | − | − | + | + |
Examples
Here are a few examples showing template behavior for three languages: English, French and Corsu, which defaults to French if Corsu text is not available:
Test | Code | lang=en | lang=fr | lang=co |
---|---|---|---|---|
No En; default | {{LangSwitch|fr=French|default=default}}
|
default | French | French |
No En; no default | {{LangSwitch|fr=French|co=Corsu}}
|
[१] | French[१] | Corsu[१] |
En; default | {{LangSwitch|en=English|co=Corsu|default=default}}
|
English | default | Corsu |
En; no default | {{LangSwitch|en=English|co=Corsu}}
|
English | English | Corsu |
En; skip default | {{LangSwitch|en=English|co=Corsu|default=~}}
|
English | Corsu | |
En; empty default | {{LangSwitch|en=English|co=Corsu|default=}}
|
English | English | Corsu |
Skip en; default | {{LangSwitch|en=~|fr=French|default=default}}
|
French | French | |
Skip en; no default | {{LangSwitch|en=~|fr=French}}
|
French | French | |
Empty en; no default | {{LangSwitch|en=|fr=French}}
|
French | French | |
En; default; skip fr | {{LangSwitch|en=English|fr=~|co=Corsu|default=default}}
|
English | Corsu | |
En; default; empty fr | {{LangSwitch|en=English|fr=|co=Corsu|default=default}}
|
English | default | Corsu |
En; no default; skip fr | {{LangSwitch|en=English|fr=~|co=Corsu}}
|
English | Corsu | |
Forced "lang=co" | {{LangSwitch|en=English|co=Corsu|default=default|lang=co}}
|
Corsu | Corsu | Corsu |
- ^ a b c would add Category:LangSwitch template without default version
The default option is intended for providing more language independent option. For example:
{{LangSwitch |de=[[:de:Warschau|Warschau]] |en=[[:en:Warsaw|Warsaw]] |fr=[[:fr:Varsovie|Varsovie]] |ja=[[:ja:ワルシャワ|ワルシャワ]] |pl=[[:pl:Warszawa|Warszawa]] |default=[[d:Q270]] }}
will provide link to Wikipedia articles in case one of the languages provided matches user's language but will link to Commons gallery page (Warsaw) if any other language is used.