![]() | This is a
documentation
subpage for
Module:Multilingual. It may contain usage information, categories and other content that is not part of the original module page. |
Multilingual
– Module with functions in context of languages, language codes, language names.
All functions expect one unnamed parameter 1
with the key information, and sometimes more optionals. Whitespace ahead and after any content is ignored. Upcasing of language code segments like in en-US
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.
1
– language list or single itemslang
– language of the answer, if not native
*
– native (default)!
– current projectshift
– capitalization
c
– capitalize alld
– downcase everythingf
– capitalize first item onlym
– downcase every first word in item onlylink=1
– link itemsscream
– category title in case of errorsplit
– split pattern, if list expected; e.g. split=,
– otherwise 1
is regarded as single itemseparator
– list separator, else split
start
– prepend first list element, if any2
– language of the answer
*
– in that language itself (default)!
– in project language1
– space separated list of available ISO 639 codesen-US
or en-GB
and that is not mentioned explicitly in list, base language (here en
) will be tried.en
), at least en
for English will be returned.2020-12-10
1
– required version
A test page illustrates practical use.
All functions described above can be used by other modules:
local lucky, Multilingual = pcall( require, "Module:Multilingual" )
if type( Multilingual ) == "table" then
Multilingual = Multilingual.Multilingual()
else
-- failure; Multilingual is the error message
return "<span class='error'>" .. Multilingual .. "</span>"
end
Subsequently there are available:
nil false "*"
– native"!"
– current project"c"
– capitalize"d"
– downcase everything"f"
– capitalize first item only, downcase anything elsetrue
.base
– Basic language (2–3 lowercase letters).region
– Country (2 uppercase letters).script
– Scripting (4 letters, capitalized).year
– year (4 digits).extension
– Extension (1 lowercase letter).other
– More.legal
– true if valid.n
– Number of componentsnil false "*"
– native"!"
– current projectIf succeeding, the Multilingual.get*() return a string, the Multilingual.is*() true
; on failure false
.
General library; no limitations.
![]() | This is a
documentation
subpage for
Module:Multilingual. It may contain usage information, categories and other content that is not part of the original module page. |
Multilingual
– Module with functions in context of languages, language codes, language names.
All functions expect one unnamed parameter 1
with the key information, and sometimes more optionals. Whitespace ahead and after any content is ignored. Upcasing of language code segments like in en-US
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.
1
– language list or single itemslang
– language of the answer, if not native
*
– native (default)!
– current projectshift
– capitalization
c
– capitalize alld
– downcase everythingf
– capitalize first item onlym
– downcase every first word in item onlylink=1
– link itemsscream
– category title in case of errorsplit
– split pattern, if list expected; e.g. split=,
– otherwise 1
is regarded as single itemseparator
– list separator, else split
start
– prepend first list element, if any2
– language of the answer
*
– in that language itself (default)!
– in project language1
– space separated list of available ISO 639 codesen-US
or en-GB
and that is not mentioned explicitly in list, base language (here en
) will be tried.en
), at least en
for English will be returned.2020-12-10
1
– required version
A test page illustrates practical use.
All functions described above can be used by other modules:
local lucky, Multilingual = pcall( require, "Module:Multilingual" )
if type( Multilingual ) == "table" then
Multilingual = Multilingual.Multilingual()
else
-- failure; Multilingual is the error message
return "<span class='error'>" .. Multilingual .. "</span>"
end
Subsequently there are available:
nil false "*"
– native"!"
– current project"c"
– capitalize"d"
– downcase everything"f"
– capitalize first item only, downcase anything elsetrue
.base
– Basic language (2–3 lowercase letters).region
– Country (2 uppercase letters).script
– Scripting (4 letters, capitalized).year
– year (4 digits).extension
– Extension (1 lowercase letter).other
– More.legal
– true if valid.n
– Number of componentsnil false "*"
– native"!"
– current projectIf succeeding, the Multilingual.get*() return a string, the Multilingual.is*() true
; on failure false
.
General library; no limitations.