<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AMultilingual%2Fdoc</id>
	<title>Module:Multilingual/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AMultilingual%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Multilingual/doc&amp;action=history"/>
	<updated>2026-05-07T04:48:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Multilingual/doc&amp;diff=144019&amp;oldid=prev</id>
		<title>imported&gt;Primefac: TFD closed as no consensus (XFDcloser)</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Multilingual/doc&amp;diff=144019&amp;oldid=prev"/>
		<updated>2019-04-28T14:44:01Z</updated>

		<summary type="html">&lt;p&gt;TFD closed as no consensus (&lt;a href=&quot;/index.php?title=WP:XFDC&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:XFDC (page does not exist)&quot;&gt;XFDcloser&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;Multilingual&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039; – Module with functions in context of languages, language codes, language names.&lt;br /&gt;
&lt;br /&gt;
== Functions for templates ==&lt;br /&gt;
All functions expect one unnamed parameter &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; with the key information, and sometimes more optionals. Whitespace ahead and after any content is ignored. Upcasing of language code segments like in &amp;lt;code&amp;gt;en-US&amp;lt;/code&amp;gt; does not matter; results are downcased.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
; fair&lt;br /&gt;
: Format language code according to RFC 5646 and check validity&lt;br /&gt;
:* &amp;#039;&amp;#039;Result:&amp;#039;&amp;#039; empty, if invalid&lt;br /&gt;
; findCode&lt;br /&gt;
: Retrieve code of language name in local (current project) language.&lt;br /&gt;
: A code itself will be identified, too.&lt;br /&gt;
; format&lt;br /&gt;
: Format one or more languages.&lt;br /&gt;
:* &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; – language list or single item&lt;br /&gt;
:* &amp;lt;code&amp;gt;slang&amp;lt;/code&amp;gt; – language of the answer, if not native&lt;br /&gt;
:** &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt; – native &amp;#039;&amp;#039;(default)&amp;#039;&amp;#039;&lt;br /&gt;
:** &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; – current project&lt;br /&gt;
:** any valid code&lt;br /&gt;
:* &amp;lt;code&amp;gt;shift&amp;lt;/code&amp;gt; – capitalization&lt;br /&gt;
:** &amp;lt;code&amp;gt;c&amp;lt;/code&amp;gt; – capitalize all&lt;br /&gt;
:** &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt; – downcase everything&lt;br /&gt;
:** &amp;lt;code&amp;gt;f&amp;lt;/code&amp;gt; – capitalize first item only&lt;br /&gt;
:** &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; – downcase every first word in item only&lt;br /&gt;
:* &amp;lt;code&amp;gt;link=1&amp;lt;/code&amp;gt; – link items&lt;br /&gt;
:* &amp;lt;code&amp;gt;scream&amp;lt;/code&amp;gt; – category title in case of error&lt;br /&gt;
:* &amp;lt;code&amp;gt;split&amp;lt;/code&amp;gt; – split pattern, if list expected; e.g. &amp;lt;code&amp;gt;split=,&amp;lt;/code&amp;gt; – otherwise &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; is regarded as single item&lt;br /&gt;
:* &amp;lt;code&amp;gt;separator&amp;lt;/code&amp;gt; – list separator, else &amp;lt;code&amp;gt;split&amp;lt;/code&amp;gt;&lt;br /&gt;
:* &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt; – prepend first list element, if any&lt;br /&gt;
; getBase&lt;br /&gt;
: Retrieve base language from possibly combined ISO language code.&lt;br /&gt;
; getName&lt;br /&gt;
: Which name is assigned to this language code?&lt;br /&gt;
:* &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; – language of the answer&lt;br /&gt;
:** &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt; – in that language itself &amp;#039;&amp;#039;(default)&amp;#039;&amp;#039;&lt;br /&gt;
:** &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; – in project language&lt;br /&gt;
:** Any ISO code.&lt;br /&gt;
; isLang&lt;br /&gt;
: Could this be an ISO language code?&lt;br /&gt;
:* &amp;#039;&amp;#039;nothing&amp;#039;&amp;#039; – if not&lt;br /&gt;
; isLangWiki&lt;br /&gt;
: Could this be a Wiki language version?&lt;br /&gt;
:* &amp;#039;&amp;#039;nothing&amp;#039;&amp;#039; – if not&lt;br /&gt;
; kannDeutsch&lt;br /&gt;
: Might someone with this language code understand German?&lt;br /&gt;
:* &amp;#039;&amp;#039;nothing&amp;#039;&amp;#039; – if not&lt;br /&gt;
; userLang&lt;br /&gt;
: Try to support user language by application.&lt;br /&gt;
:* &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; – space separated list of available ISO 639 codes&lt;br /&gt;
:* &amp;#039;&amp;#039;Result:&amp;#039;&amp;#039;&lt;br /&gt;
:** If the current user language is not a list element, the first element is used.&lt;br /&gt;
:** If the current user language is a variant like &amp;lt;code&amp;gt;en-US&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;en-GB&amp;lt;/code&amp;gt; and that is not mentioned explicitly in list, base language (here&amp;amp;nbsp;&amp;lt;code&amp;gt;en&amp;lt;/code&amp;gt;) will be tried.&lt;br /&gt;
:** If nothing matches and no list is provided, the project language (here&amp;amp;nbsp;&amp;lt;code&amp;gt;{{CONTENTLANGUAGE}}&amp;lt;/code&amp;gt;), at least &amp;lt;code&amp;gt;en&amp;lt;/code&amp;gt; for English will be returned.&lt;br /&gt;
; failsafe&lt;br /&gt;
: Version ID: &amp;lt;code&amp;gt;{{#invoke:Multilingual|failsafe}}&amp;lt;/code&amp;gt;&lt;br /&gt;
: optional parameter &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; – required version&lt;br /&gt;
:: result: empty, if requirement not met&lt;br /&gt;
&lt;br /&gt;
=== Examples (test page) ===&lt;br /&gt;
A [[Wikipedia:Lua/Modul/Multilingual/Test|test page]] illustrates practical use.&lt;br /&gt;
== Functions for Lua modules (API) ==&lt;br /&gt;
&lt;br /&gt;
All functions described above can be used by other modules:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local lucky, Multilingual = pcall( require, &amp;quot;Module:Multilingual&amp;quot; )&lt;br /&gt;
if type( Multilingual ) == &amp;quot;table&amp;quot; then&lt;br /&gt;
    Multilingual = Multilingual.Multilingual()&lt;br /&gt;
else&lt;br /&gt;
    -- failure; Multilingual is the error message&lt;br /&gt;
    return &amp;quot;&amp;lt;span class=&amp;#039;error&amp;#039;&amp;gt;&amp;quot; .. Multilingual .. &amp;quot;&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Subsequently there are available:&lt;br /&gt;
; Multilingual.fair( ask )&lt;br /&gt;
:* &amp;#039;&amp;#039;ask&amp;#039;&amp;#039; – string, or table according to getLang()&lt;br /&gt;
; Multilingual.findCode( ask )&lt;br /&gt;
; Multilingual.format( apply, alien, alter, active, alert, frame, assembly, adjacent )&lt;br /&gt;
:* &amp;#039;&amp;#039;apply&amp;#039;&amp;#039; – string with language list or single item&lt;br /&gt;
:* &amp;#039;&amp;#039;alien&amp;#039;&amp;#039; – language of the answer&lt;br /&gt;
:** &amp;lt;code&amp;gt;nil false &amp;quot;*&amp;quot;&amp;lt;/code&amp;gt; – native&lt;br /&gt;
:** &amp;lt;code&amp;gt;&amp;quot;!&amp;quot;&amp;lt;/code&amp;gt; – current project&lt;br /&gt;
:** any valid code&lt;br /&gt;
:* &amp;#039;&amp;#039;alter&amp;#039;&amp;#039; – capitalization&lt;br /&gt;
:** &amp;lt;code&amp;gt;&amp;quot;c&amp;quot;&amp;lt;/code&amp;gt; – capitalize&lt;br /&gt;
:** &amp;lt;code&amp;gt;&amp;quot;d&amp;quot;&amp;lt;/code&amp;gt; – downcase everything&lt;br /&gt;
:** &amp;lt;code&amp;gt;&amp;quot;f&amp;quot;&amp;lt;/code&amp;gt; – capitalize first item only, downcase anything else&lt;br /&gt;
:* &amp;#039;&amp;#039;active&amp;#039;&amp;#039; – link items, if &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;&lt;br /&gt;
:* &amp;#039;&amp;#039;alert&amp;#039;&amp;#039; – string with category title in case of error&lt;br /&gt;
:* &amp;#039;&amp;#039;frame&amp;#039;&amp;#039; – if available&lt;br /&gt;
:* &amp;#039;&amp;#039;assembly&amp;#039;&amp;#039; – string with split pattern, if list expected&lt;br /&gt;
:* &amp;#039;&amp;#039;adjacent&amp;#039;&amp;#039; – string with list separator, else &amp;#039;&amp;#039;assembly&amp;#039;&amp;#039;&lt;br /&gt;
:* &amp;#039;&amp;#039;ahead&amp;#039;&amp;#039; – string for optional prepending first element, if any&lt;br /&gt;
; Multilingual.getBase( ask )&lt;br /&gt;
; Multilingual.getLang( ask )&lt;br /&gt;
: Split language code into components&lt;br /&gt;
: Returns: &amp;#039;&amp;#039;table&amp;#039;&amp;#039;&lt;br /&gt;
:: &amp;lt;code&amp;gt;.base&amp;lt;/code&amp;gt; – Basic language (2–3 lowercase letters)&lt;br /&gt;
:: &amp;lt;code&amp;gt;.region&amp;lt;/code&amp;gt; – Country (2 uppercase letters)&lt;br /&gt;
:: &amp;lt;code&amp;gt;.script&amp;lt;/code&amp;gt; – Scripting (4 letters, capitalized)&lt;br /&gt;
:: &amp;lt;code&amp;gt;.year&amp;lt;/code&amp;gt; – year (4 digits)&lt;br /&gt;
:: &amp;lt;code&amp;gt;.extension&amp;lt;/code&amp;gt; – Extension (1 lowercase letter)&lt;br /&gt;
:: &amp;lt;code&amp;gt;.other&amp;lt;/code&amp;gt; – More&lt;br /&gt;
:: &amp;lt;code&amp;gt;.legal&amp;lt;/code&amp;gt; – &amp;#039;&amp;#039;true&amp;#039;&amp;#039; if valid&lt;br /&gt;
:: &amp;lt;code&amp;gt;.n&amp;lt;/code&amp;gt; – Number of components&lt;br /&gt;
; Multilingual.getName( ask, alien )&lt;br /&gt;
:* &amp;#039;&amp;#039;alien&amp;#039;&amp;#039; – language of the answer&lt;br /&gt;
:** &amp;lt;code&amp;gt;nil false &amp;quot;*&amp;quot;&amp;lt;/code&amp;gt; – native&lt;br /&gt;
:** &amp;lt;code&amp;gt;&amp;quot;!&amp;quot;&amp;lt;/code&amp;gt; – current project&lt;br /&gt;
:** Any ISO code.&lt;br /&gt;
; Multilingual.isLang( ask )&lt;br /&gt;
; Multilingual.isLangWiki( ask )&lt;br /&gt;
; Multilingual.kannDeutsch( ask )&lt;br /&gt;
; Multilingual.userLang( accept, frame )&lt;br /&gt;
:* &amp;#039;&amp;#039;accept&amp;#039;&amp;#039; – string with space separated list of available ISO 639 codes&lt;br /&gt;
:* &amp;#039;&amp;#039;frame&amp;#039;&amp;#039; – if available&lt;br /&gt;
; Multilingual.failsafe( atleast )&lt;br /&gt;
:* atleast&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;optional&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;nil&amp;#039;&amp;#039; or required version&lt;br /&gt;
:* Returns: &amp;#039;&amp;#039;string&amp;#039;&amp;#039; or &amp;#039;&amp;#039;false&amp;#039;&amp;#039;&lt;br /&gt;
If succeeding, the &amp;#039;&amp;#039;Multilingual.get*()&amp;#039;&amp;#039; return a string, the &amp;#039;&amp;#039;Multilingual.is*()&amp;#039;&amp;#039; &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;; on failure &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
General library; no limitations.&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
* [[Module:WLink|WLink]]&lt;br /&gt;
* [[Module:Multilingual/config|/config]] – optional project specific adaption&lt;/div&gt;</summary>
		<author><name>imported&gt;Primefac</name></author>
	</entry>
</feed>