Nicht angemeldeter Benutzer - Bearbeiten von Seiten ist nur als angemeldeter Benutzer möglich.
Änderungen
Zur Navigation springen
Zur Suche springen
Zeile 1:
Zeile 1:
− +
Zeile 5:
Zeile 5:
+
+
− +
− +
− +
− +
− +
− +
− de = "Doppelangabe:" },+
− +
− de = "Parameterwert fehlt" },+
− +
− de = "Ungültig:" },+
− +
− de = "Parameter fehlt" },+
− +
− de = "'%s' * vermutlich ist '%s' gemeint" },+
− +
− de = "Parameter unbekannt:" },+
− +
− +
− "Audio",+
− "IPA",+
− "class",+
− "lenient",+
− "script",+
− "style",+
− "nachgestellt",+
− "demo",+
− "demo2",+
− "demo3",+
− "demo4",+
− "NoCat" },+
− +
− +
− hbo = 2,+
− la = 3,+
− en = 9 },+
− +
− scripts = "Multilingual/scripts",+
− +
− +
− +
− +
− +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Zeile 60:
Zeile 122:
+
+
− +
− local lucky, g = pcall( require, "Module:" .. ask ) +
− +
− g = g[ ask ] +
− +
− +
+
+
+
− g = false
− else
− g = false
− +
− g = "Invalid library *** Module:" .. ask +
+
− g = mw.html.create( "span" ) +
− :attr( "class", "error" )+
− :wikitext( g )+
− +
Zeile 102:
Zeile 167:
− +
− +
− local lucky +
− lucky, Config.multiScripts = pcall( mw.loadData,+
− "Module:" .. Config.scripts )+
− +
− +
+
− +
Zeile 164:
Zeile 230:
− r = string.format( "<span class=\"error\">????.%s.????</span>", +
− apply )+
+
+
+
Zeile 180:
Zeile 249:
− +
Zeile 197:
Zeile 266:
− +
− +
− +
Zeile 353:
Zeile 422:
− +
− +
− +
Zeile 492:
Zeile 561:
− +
Zeile 524:
Zeile 593:
− +
Zeile 531:
Zeile 600:
+
− local o = Config.orderOther[ t.short ] +
− +
− +
+
+
Zeile 554:
Zeile 626:
− +
− +
− +
Zeile 562:
Zeile 634:
− +
+
Zeile 587:
Zeile 660:
−
Zeile 754:
Zeile 826:
− +
− +
− +
− .getScriptName( Config.scripting )+
Zeile 817:
Zeile 889:
+
+
+
Zeile 889:
Zeile 964:
+
+
+
+
+
+
Zeile 899:
Zeile 980:
− +
+
Zeile 927:
Zeile 1.009:
− if not r.trsl then+
− r.trsl = { }+
− end+
− table.insert( r.trsl,+
− { n = #r.trsl + 1,+
− script = k,+
− short = k,+
− slang = Config.slang,+
− story = v } )+
+
+
+
Zeile 977:
Zeile 1.062:
− r = string.format( "'<code>%s</code>'", +
− table.concat( unknown, " " ) )+
− +
+
+
Zeile 987:
Zeile 1.074:
−
−
−
− Export.failsafe = function ( assert )
− -- Retrieve versioning and check for compliance
− -- Precondition:
− -- assert -- string, with required version or "wikidata",
− -- or false
− -- Postcondition:
− -- Returns string with appropriate version, or false
− local since = assert
− local r
− if since == "wikidata" then
− local item = Export.item
− since = false
− if type( item ) == "number" and item > 0 then
− local entity = mw.wikibase.getEntity( string.format( "Q%d",
− item ) )
− if type( entity ) == "table" then
− local vsn = entity:formatPropertyValues( "P348" )
− if type( vsn ) == "table" and
− type( vsn.value ) == "string" and
− vsn.value ~= "" then
− r = vsn.value
− end
− end
− end
− end
− if not r then
− if not since or since <= Export.serial then
− r = Export.serial
− else
− r = false
− end
− end
− return r
− end -- Export.failsafe()
Zeile 1.134:
Zeile 1.184:
+
+
+
+
+
+
Zeile 1.144:
Zeile 1.200:
+
Zeile 1.150:
Zeile 1.207:
− +
− script = parts[ 2 ]+
− +
+
+
+
+
Zeile 1.160:
Zeile 1.221:
− bdi:attr( "lang", string.format( "%s-%s", slang, script ) )
Zeile 1.166:
Zeile 1.226:
+
− bdi:attr( "lang", slang ) +
+
+
+
+
Zeile 1.205:
Zeile 1.270:
− if #parts > 1 then +
− +
− +
− +
− +
− +
Zeile 1.233:
Zeile 1.298:
− +
+
+
+
− elem:attr( "lang", string.format( "%s-%s", slang, script ) ) +
− elseif state then
− elem:attr( "lang", string.format( "%s-%s", slang, state ) )
− elem:attr( "lang", slang ) +
+
+
+
+
Zeile 1.248:
Zeile 1.318:
− +
+
+
+
Zeile 1.309:
Zeile 1.382:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Zeile 1.341:
Zeile 1.457:
+
Zeile 1.354:
Zeile 1.471:
− +
− +
Modul:Vorlage:lang (Quelltext anzeigen)
Version vom 11. November 2019, 13:15 Uhr
, 13:15, 11. Nov. 20192019-10-02
local Export = { serial = "2019-02-24",
local Export = { serial = "2019-10-02",
suite = "lang",
suite = "lang",
item = 26826825 }
item = 26826825 }
Vorlage:lang und Sprachnamenvorlagen usw. unterstützen
Vorlage:lang und Sprachnamenvorlagen usw. unterstützen
]=]
]=]
local Failsafe = Export
local GlobalMod = Export
local Config = {
local Config = {
errCat = false,
errCat = false,
errClass = "error_lang",
errClass = "error_lang",
errClasses = false,
errClasses = false,
errHide = true,
errHide = true,
errNS = false,
errNS = false,
errDoubled = { en = "Doubled:",
errDoubled = { en = "Doubled:",
de = "Doppelangabe:" },
errEmpty = { en = "Empty parameter value",
errEmpty = { en = "Empty parameter value",
de = "Parameterwert fehlt" },
errInvalid = { en = "Invalid:",
errInvalid = { en = "Invalid:",
de = "Ungültig:" },
errMissing = { en = "Missing parameter",
errMissing = { en = "Missing parameter",
de = "Parameter fehlt" },
errSuggest = { en = "'%s' * probably '%s' intended",
errSuggest = { en = "'%s' * probably '%s' intended",
de = "'%s' * vermutlich ist '%s' gemeint" },
errUnkown = { en = "Unkown parameter:",
errUnkown = { en = "Unkown parameter:",
de = "Parameter unbekannt:" },
ipa = "IPA",
ipa = "IPA",
params = { "Text1",
keyBase = 100,
keyProject = 200,
keyAncient = 300,
keyTranslate = 400,
params = { "Text1",
"Audio",
"IPA",
"class",
"lenient",
"script",
"style",
"nachgestellt",
"demo",
percents = false,
"demo2",
orderOther = { grc = 1,
"demo3",
"demo4",
"NoCat" },
percents = false,
owns = { de = "‚%s‘" },
orderOther = { grc = 1,
hbo = 2,
sepComma = "Latn Armn Cyrl Grek Thai",
la = 3,
site = "Latn",
en = 9 },
tmplAudio = false, -- template for media player link
owns = { de = "‚%s‘" },
tmplLang = false, -- template for language name link
sepComma = "Latn Armn Cyrl Grek Thai",
tmplStyles = false
site = "Latn",
tmplAudio = false, -- template for media player link
tmplLang = false, -- template for language name link
tmplStyles = false,
wikidata = { Multilingual = 47541920,
ISO15924 = 71584769,
["ISO15924/codes"] = 71840276,
TemplUtl = 52364930 }
}
}
local foreignModule = function ( access, advanced, append, alt, alert )
-- Fetch global module
-- Precondition:
-- access -- string, with name of base module
-- advanced -- true, for require(); else mw.loadData()
-- append -- string, with subpage part, if any; or false
-- alt -- number, of wikidata item of root; or false
-- alert -- true, for throwing error on data problem
-- Postcondition:
-- Returns whatever, probably table
-- 2019-10-29
local storage = access
local finer = function ()
if append then
storage = string.format( "%s/%s",
storage,
append )
end
end
local fun, lucky, r, suited
if advanced then
fun = require
else
fun = mw.loadData
end
GlobalMod.globalModules = GlobalMod.globalModules or { }
suited = GlobalMod.globalModules[ access ]
if not suited then
finer()
lucky, r = pcall( fun, "Module:" .. storage )
end
if not lucky then
if not suited and
type( alt ) == "number" and
alt > 0 then
suited = string.format( "Q%d", alt )
suited = mw.wikibase.getSitelink( suited )
GlobalMod.globalModules[ access ] = suited or true
end
if type( suited ) == "string" then
storage = suited
finer()
lucky, r = pcall( fun, storage )
end
if not lucky and alert then
error( "Missing or invalid page: " .. storage, 0 )
end
end
return r
end -- foreignModule()
-- Parameter:
-- Parameter:
-- ask -- string, with name
-- ask -- string, with name
-- "ISO15924"
-- "Multilingual"
-- "Multilingual"
-- "TemplUtl"
-- "TemplUtl"
-- Returns string, with error message, if not available
-- Returns string, with error message, if not available
local ext = Config[ ask ]
local r
local r
if type( Config[ ask ] ) ~= "table" then
if not ext and ext ~= false then
ext = foreignModule( ask,
if type( g ) == "table" then
true,
false,
if type( g ) == "function" then
Config.wikidata[ ask ] )
Config[ ask ] = g()
if type( ext ) == "table" then
Config[ ask ] = ext
if type( ext[ ask ] ) == "function" then
Config[ ask ] = ext[ ask ]()
end
end
end
end
if type( Config[ ask ] ) ~= "table" then
if type( Config[ ask ] ) ~= "table" then
if not g then
Config[ ask ] = false
if not ext then
ext = "Invalid library *** Module:" .. ask
end
end
ext = mw.html.create( "span" )
:attr( "class", "error" )
:wikitext( ext )
r = tostring( g )
r = tostring( ext )
end
end
end
end
local function Friend()
local function Friend()
-- Fetch Module:Multilingual/scripts
-- Fetch Module:ISO15924/codes
if not Config.multiScripts then
if not Config.codesISO15924 then
Config.codesISO15924 = foreignModule( "ISO15924",
false,
"codes",
if type( Config.multiScripts ) ~= "table" then
Config.wikidata.ISO15924 )
Config.multiScripts = { }
if type( Config.codesISO15924 ) ~= "table" then
Config.codesISO15924 = { }
end
end
end
end
return Config.multiScripts
return Config.codesISO15924
end -- Friend()
end -- Friend()
end
end
else
else
local e = mw.html.create( "span" )
:attr( "class", "error" )
:wikitext( string.format( "????.%s.????",
apply ) )
r = tostring( e )
end
end
return r
return r
if s == "string" then
if s == "string" then
r = mw.text.trim( adjust )
r = mw.text.trim( adjust )
r = ( r ~= "" and r ~= "0" )
r = ( r ~= "" and r ~= "0" and r ~= "-" )
elseif s == "boolean" then
elseif s == "boolean" then
r = adjust
r = adjust
-- Returns boolean
-- Returns boolean
local r
local r
Fetch( "Multilingual" )
Fetch( "ISO15924" )
if Config.Multilingual then
if Config.ISO15924 then
r = Config.Multilingual.isTrans( ask, assign, Config.site )
r = Config.ISO15924.isTrans( ask, assign, Config.site )
end
end
return r
return r
-- Returns string or false
-- Returns string or false
local r
local r
local written = Friend().written
local iso639script = Friend().iso639script
if type( written ) == "table" then
if type( iso639script ) == "table" then
r = written[ acquire ]
r = iso639script[ acquire ]
if type( r ) == "table" then
if type( r ) == "table" then
r = r[ 1 ]
r = r[ 1 ]
:attr( "lang", advanced )
:attr( "lang", advanced )
local s = "normal"
local s = "normal"
if acquire == Config.standard
if acquire == facility()
and Config.owns[ acquire ] then
and Config.owns[ acquire ] then
story = string.format( Config.owns[ acquire ], apply )
story = string.format( Config.owns[ acquire ], apply )
local lone = alone
local lone = alone
local r = ""
local r = ""
local lucky, s, t
local k, lucky, s, t
family()
family()
facility()
facility()
t = aliens[ i ]
t = aliens[ i ]
if t.short == Config.standard then
if t.short == Config.standard then
t.m = Config.keyProject
t.n = 0
t.n = 0
else
else
k = Config.orderOther[ t.short ]
if o then
if k then
t.n = o
t.n = k
t.m = Config.keyAncient
end
end
lone = false
lone = false
end
end
t.n = t.m + t.n
end -- for i
end -- for i
table.sort( aliens,
table.sort( aliens,
t.script and
t.script and
t.n > 0 then
t.n > 0 then
Fetch( "Multilingual" )
Fetch( "ISO15924" )
if Config.Multilingual then
if Config.ISO15924 then
s = Config.Multilingual.getScriptName( t.script )
s = Config.ISO15924.scriptName( t.script )
if s == t.script then
if s == t.script then
s = false
s = false
end
end
end
end
if not s and t.n > 0 then
if not s and t.n > Config.keyProject then
s = fill( t.short )
s = fill( t.short )
end
end
if not s then
if not s then
Fetch( "Multilingual" )
s = mw.language.fetchLanguageName( t.short,
s = mw.language.fetchLanguageName( t.short,
Config.standard )
Config.standard )
return r
return r
end -- foreigns()
end -- foreigns()
if arglist[ Config.scripting ] and
if arglist[ Config.scripting ] and
not arglist.Text2 then
not arglist.Text2 then
Fetch( "Multilingual" )
Fetch( "ISO15924" )
if Config.Multilingual then
if Config.ISO15924 then
s = Config.Multilingual
s = Config.ISO15924
.scriptName( Config.scripting )
end
end
end
end
Config.errClasses = argsF.errClasses
Config.errClasses = argsF.errClasses
Config.errNS = argsF.errNS
Config.errNS = argsF.errNS
if argsF.ELEMENT and argsF.ELEMENT:match( "^%a+$" ) then
Config.scope = argsF.ELEMENT:lower()
end
if argsF.SUITABLE then
if argsF.SUITABLE then
local params = mw.text.split( argsF.SUITABLE, " ", true )
local params = mw.text.split( argsF.SUITABLE, " ", true )
if legal then
if legal then
local state = k:match( "^%l%l%l?%-(%u%u)$" )
local state = k:match( "^%l%l%l?%-(%u%u)$" )
local m
if s == Config.slang then
m = Config.keyBase
else
m = Config.keyTranslate
end
if not script then
if not script then
script = fit( s )
script = fit( s )
end
end
table.insert( r.trsl,
table.insert( r.trsl,
{ n = #r.trsl + 10,
{ m = m,
n = #r.trsl + 1,
script = script,
script = script,
short = s,
short = s,
end
end
else
else
if not r.trsl then
r.trsl = { }
end
table.insert( r.trsl,
{ m = 100,
n = #r.trsl + 1,
script = k,
short = Config.slang,
slang = string.format( "%s-%s",
Config.slang,
k ),
story = v } )
end
end
k = false
k = false
end
end
if unknown then
if unknown then
local e = mw.html.create( "code" )
:wikitext( table.concat( unknown, " " ) )
r = fault( "errUnkown", r, true )
r = fault( "errUnkown",
string.format( "'%s'", tostring( e ) ),
true )
end
end
end
end
return r
return r
end -- furnish()
end -- furnish()
end
end
end
end
end
if s and
s:sub( 1, 5 ) == "<bdo " and
s:find( "^<bdo [^<>]+><bdi [^<>]+>[^<>]+</bdi></bdo>$" ) then
r = s
s = false
end
end
if s then
if s then
local slang = params[ 1 ]
local slang = params[ 1 ]
local script = argsF.SCRIPTING
local script = argsF.SCRIPTING
local state = argsF.STATE
local selector
local selector
family()
family()
local parts = mw.text.split( slang, "-", true )
local parts = mw.text.split( slang, "-", true )
slang = parts[ 1 ]
slang = parts[ 1 ]
if #parts > 1 and parts[ 2 ]:match( "^%u%l%l%l$" ) then
for i = 2, #parts do
if parts[ i ]:match( "^%u%u$" ) then
end
state = parts[ i ]
elseif parts[ i ]:match( "^%u%l%l%l$" ) then
script = parts[ i ]
end
end -- for i
end
end
slang = slang:lower()
slang = slang:lower()
if script then
if script then
first( script, bdo )
first( script, bdo )
features( bdi, script )
features( bdi, script )
selector = script
selector = script
selector = flag( selector, Config.classScript[ script ] )
selector = flag( selector, Config.classScript[ script ] )
end
end
s = string.format( "%s-%s", slang, script )
else
else
s = slang
end
if state then
s = string.format( "%s-%s", s, state )
end
end
bdi:attr( "lang", s )
selector = flag( selector, argsF.class )
selector = flag( selector, argsF.class )
selector = flag( selector, params.class )
selector = flag( selector, params.class )
local parts = mw.text.split( alien, "-", true )
local parts = mw.text.split( alien, "-", true )
slang = parts[ 1 ]
slang = parts[ 1 ]
for i = 2, #parts do
if parts[ 2 ]:match( "^%u%u$" ) then
if parts[ i ]:match( "^%u%u$" ) then
state = parts[ 2 ]
state = parts[ i ]
elseif parts[ 2 ]:match( "^%u%l%l%l$" ) then
elseif parts[ i ]:match( "^%u%l%l%l$" ) then
script = parts[ 2 ]
script = parts[ i ]
end
end
end
end -- for i
else
else
slang = alien
slang = alien
selector = flag( selector, alike )
selector = flag( selector, alike )
if ltr then
if ltr then
local elem = mw.html.create( "span" )
local scope = Config.scope or "span"
local elem = mw.html.create( scope )
local story = apply
local set
if script then
if script then
set = string.format( "%s-%s", slang, script )
features( elem, script )
features( elem, script )
else
else
set = slang
end
end
if state then
set = string.format( "%s-%s", set, state )
end
elem:attr( "lang", set )
if selector then
if selector then
elem:addClass( selector )
elem:addClass( selector )
elem:cssText( appear )
elem:cssText( appear )
end
end
elem:wikitext( apply )
if scope == "span" then
story = story:gsub( "\n", " " )
end
elem:wikitext( story )
r = tostring( elem )
r = tostring( elem )
if script and script ~= Config.site then
if script and script ~= Config.site then
return furnish( argsF, argsT )
return furnish( argsF, argsT )
end -- Export.full()
end -- Export.full()
Failsafe.failsafe = function ( atleast )
-- Retrieve versioning and check for compliance
-- Precondition:
-- atleast -- string, with required version or "wikidata" or "~"
-- or false
-- Postcondition:
-- Returns string -- with queried version, also if problem
-- false -- if appropriate
local last = ( atleast == "~" )
local since = atleast
local r
if last or since == "wikidata" then
local item = Failsafe.item
since = false
if type( item ) == "number" and item > 0 then
local entity = mw.wikibase.getEntity( string.format( "Q%d",
item ) )
if type( entity ) == "table" then
local vsn = entity:formatPropertyValues( "P348" )
if type( vsn ) == "table" and
type( vsn.value ) == "string" and
vsn.value ~= "" then
if last and vsn.value == Failsafe.serial then
r = false
else
r = vsn.value
end
end
end
end
end
if type( r ) == "nil" then
if not since or since <= Failsafe.serial then
r = Failsafe.serial
else
r = false
end
end
return r
end -- Failsafe.failsafe()
p.failsafe = function ( frame )
p.failsafe = function ( frame )
-- Versioning interface
local s = type( frame )
local s = type( frame )
local since
local since
end
end
end
end
return Export.failsafe( since ) or ""
return Failsafe.failsafe( since ) or ""
end -- p.failsafe()
end -- p.failsafe