Modul:Multilingual: Unterschied zwischen den Versionen
2019-11-12
w>PerfektesChaos (2019-11-02) |
w>PerfektesChaos (2019-11-12) |
||
| Zeile 1: | Zeile 1: | ||
local Multilingual = { suite = "Multilingual", | local Multilingual = { suite = "Multilingual", | ||
serial = "2019-11- | serial = "2019-11-12", | ||
item = 47541920, | item = 47541920, | ||
globals = { ISO15924 = 71584769, | globals = { ISO15924 = 71584769, | ||
| Zeile 26: | Zeile 26: | ||
* userLangCode() | * userLangCode() | ||
* wikibase() | * wikibase() | ||
* failsafe() | |||
loadData: Multilingual/config Multilingual/names | loadData: Multilingual/config Multilingual/names | ||
]=] | ]=] | ||
| Zeile 45: | Zeile 46: | ||
ger = "de", | ger = "de", | ||
gr = "el", | gr = "el", | ||
iw = "he", | iw = "he", | ||
jp = "ja", | jp = "ja", | ||
| Zeile 763: | Zeile 763: | ||
return r | return r | ||
end -- Multilingual.getName() | end -- Multilingual.getName() | ||
| Zeile 1.141: | Zeile 1.121: | ||
-- frame -- frame, if available | -- frame -- frame, if available | ||
-- Postcondition: | -- Postcondition: | ||
-- Returns string with | -- Returns | ||
-- 1. string, with selected message | |||
-- 2. string, with language code, or not | |||
local s = type( all ) | local s = type( all ) | ||
local object, r | local object, r, r2 | ||
if s == "table" then | if s == "table" then | ||
object = all | object = all | ||
| Zeile 1.150: | Zeile 1.132: | ||
end | end | ||
if type( object ) == "table" then | if type( object ) == "table" then | ||
if about then | if about and about ~= "labels" then | ||
s = "descriptions" | s = "descriptions" | ||
else | else | ||
| Zeile 1.158: | Zeile 1.140: | ||
if type( object ) == "table" then | if type( object ) == "table" then | ||
if object[ attempt ] then | if object[ attempt ] then | ||
r = object[ attempt ].value | r = object[ attempt ].value | ||
r2 = attempt | |||
else | else | ||
local poly | local poly | ||
| Zeile 1.166: | Zeile 1.149: | ||
end -- for k, v | end -- for k, v | ||
if poly then | if poly then | ||
r = Multilingual.i18n( poly, nil, frame ) | r, r2 = Multilingual.i18n( poly, nil, frame ) | ||
end | end | ||
end | end | ||
end | end | ||
end | end | ||
return r or "" | return r or "", r2 | ||
end -- Multilingual.wikibase() | end -- Multilingual.wikibase() | ||
| Zeile 1.324: | Zeile 1.307: | ||
return r or "" | return r or "" | ||
end -- p.getName | end -- p.getName | ||
| Zeile 1.467: | Zeile 1.435: | ||
-- Optimal translation of wikibase component | -- Optimal translation of wikibase component | ||
-- 1 -- object ID | -- 1 -- object ID | ||
-- 2 -- either "descriptions" or "labels" | -- 2 -- 1 for "descriptions", 0 for "labels". | ||
-- or either "descriptions" or "labels" | |||
local r | local r | ||
local s = mw.text.trim( frame.args[ 1 ] or "" ) | local s = mw.text.trim( frame.args[ 1 ] or "" ) | ||