Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Multilingual/doc
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Functions for templates == All functions expect one unnamed parameter <code>1</code> with the key information, and sometimes more optionals. Whitespace ahead and after any content is ignored. Upcasing of language code segments like in <code>en-US</code> does not matter; results are downcased. The return value is an empty string (βnothingβ), if the parameter value does not fulfil the expectations. If there is a result or the query condition is true, at least one visible character will be returned. The result does not begin or end with a space. ; fair : Format language code according to RFC 5646 and check validity :* ''Result:'' empty, if invalid ; findCode : Retrieve code of language name in local (current project) language. : A code itself will be identified, too. ; format : Format one or more languages. :* <code>1</code> β language list or single item :* <code>slang</code> β language of the answer, if not native :** <code>*</code> β native ''(default)'' :** <code>!</code> β current project :** any valid code :* <code>shift</code> β capitalization :** <code>c</code> β capitalize all :** <code>d</code> β downcase everything :** <code>f</code> β capitalize first item only :** <code>m</code> β downcase every first word in item only :* <code>link=1</code> β link items :* <code>scream</code> β category title in case of error :* <code>split</code> β split pattern, if list expected; e.g. <code>split=,</code> β otherwise <code>1</code> is regarded as single item :* <code>separator</code> β list separator, else <code>split</code> :* <code>start</code> β prepend first list element, if any ; getBase : Retrieve base language from possibly combined ISO language code. ; getName : Which name is assigned to this language code? :* <code>2</code> β language of the answer :** <code>*</code> β in that language itself ''(default)'' :** <code>!</code> β in project language :** Any ISO code. ; isLang : Could this be an ISO language code? :* ''nothing'' β if not ; isLangWiki : Could this be a Wiki language version? :* ''nothing'' β if not ; kannDeutsch : Might someone with this language code understand German? :* ''nothing'' β if not ; userLang : Try to support user language by application. :* <code>1</code> β space separated list of available ISO 639 codes :* ''Result:'' :** If the current user language is not a list element, the first element is used. :** If the current user language is a variant like <code>en-US</code> or <code>en-GB</code> and that is not mentioned explicitly in list, base language (here <code>en</code>) will be tried. :** If nothing matches and no list is provided, the project language (here <code>{{CONTENTLANGUAGE}}</code>), at least <code>en</code> for English will be returned. ; failsafe : Version ID: <code>{{#invoke:Multilingual|failsafe}}</code> : optional parameter <code>1</code> β required version :: result: empty, if requirement not met === Examples (test page) === A [[Wikipedia:Lua/Modul/Multilingual/Test|test page]] illustrates practical use.
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)