Multilingual – Module with functions in context of languages, language codes, language names.
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 splitstart – 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-101 – 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.
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.