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 6:
Zeile 6:
− +
Zeile 23:
Zeile 23:
+
Zeile 330:
Zeile 331:
+
+
− sin = User.tell:inLanguage( s ):plain() +
− if sin == User.sin then+
− User.self = s
− break -- for i
− User.trials[ s ] = true+
+
+
+
+
+
+
+
+
+
+
+
+
+
Zeile 770:
Zeile 784:
− +
Zeile 932:
Zeile 946:
−
−
−
− Multilingual.isTrans = function ( ask, assign, about )
− -- OBSOLETE
− -- Check whether valid transcription for context
− -- Precondition:
− -- ask -- string, with transcription key
− -- assign -- string, with language or scripting code
− -- about -- string or nil, with site scripting code
− -- Postcondition:
− -- Returns boolean
− local bib = fetch( "ISO15924" )
− local r
− if type( bib ) == "table" and
− type( bib.isTrans ) == "function" then
− r = bib.isTrans( ask, assign, about )
− end
− return r or false
− end -- Multilingual.isTrans()
Zeile 965:
Zeile 959:
− +
Zeile 984:
Zeile 978:
− +
+
+
+
Zeile 1.039:
Zeile 1.036:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Zeile 1.381:
Zeile 1.485:
−
−
−
− p.isTrans = function ( frame )
− -- OBSOLETE
− -- Check whether valid transcription for context
− -- 1 -- string, with transcription key
− -- 2 -- string, with language or scripting code
− -- site -- string or nil, with site scripting code
− local s1 = mw.text.trim( frame.args[ 1 ] or "" )
− local s2 = mw.text.trim( frame.args[ 2 ] or "" )
− local site = mw.text.trim( frame.args.site or "" )
− return Multilingual.isTrans( s1, s2, site ) and "1" or ""
− end -- p.isTrans
Zeile 1.420:
Zeile 1.510:
+
+
+
+
+
+
+
+
+
+
+
+
+
Modul:Multilingual (Quelltext anzeigen)
Version vom 4. Dezember 2019, 20:41 Uhr
, 20:41, 4. Dez. 20192019-11-30
local Multilingual = { suite = "Multilingual",
local Multilingual = { suite = "Multilingual",
serial = "2019-11-12",
serial = "2019-11-30",
item = 47541920,
item = 47541920,
globals = { ISO15924 = 71584769,
globals = { ISO15924 = 71584769,
}
}
--[=[
--[=[
Utilities for multilingual texts and ISO 639 (BCP47) issues etc.
Utilities for multilingual texts and ISO 639 (BCP47) issues etc.
* fair()
* fair()
* fallback()
* fallback()
* message()
* message()
* sitelink()
* sitelink()
* tabData()
* userLang()
* userLang()
* userLangCode()
* userLangCode()
end
end
if User.sin then
if User.sin then
local order = { }
local post = { }
local s, sin
local s, sin
for i = 1, #accept do
for i = 1, #accept do
s = accept[ i ]
s = accept[ i ]
if not User.trials[ s ] then
if not User.trials[ s ] then
if s:find( "-", 3, true ) then
table.insert( post, s )
else
else
table.insert( order, s )
end
end
end
end -- for i
for i = 1, #post do
table.insert( order, post[ i ] )
end -- for i
for i = 1, #order do
s = order[ i ]
sin = User.tell:inLanguage( s ):plain()
if sin == User.sin then
User.self = s
break -- for i
else
User.trials[ s ] = true
end
end
end -- for i
end -- for i
-- Precondition:
-- Precondition:
-- available -- table, with mapping language code ./. text
-- available -- table, with mapping language code ./. text
-- alt -- string|nil|false, with fallback
-- alt -- string|nil|false, with fallback text
-- frame -- frame, if available
-- frame -- frame, if available
-- Returns
-- Returns
return r
return r
end -- Multilingual.isRTL()
end -- Multilingual.isRTL()
if type( arglist ) == "table" then
if type( arglist ) == "table" then
local t = { }
local t = { }
local m, p
local m, p, save
for k, v in pairs( arglist ) do
for k, v in pairs( arglist ) do
if type( k ) == "string" and
if type( k ) == "string" and
end
end
end -- for k, v
end -- for k, v
r = Multilingual.i18n( t, nil, frame )
if type( arglist[ "-" ] ) == "string" then
save = arglist[ arglist[ "-" ] ]
end
r = Multilingual.i18n( t, save, frame )
if p and r and r:find( "$", 1, true ) then
if p and r and r:find( "$", 1, true ) then
t = { }
t = { }
return r or ""
return r or ""
end -- Multilingual.sitelink()
end -- Multilingual.sitelink()
Multilingual.tabData = function ( access, alert, alt, frame )
-- Select translatable message
-- Precondition:
-- access -- string, with page identification on Commons
-- alert -- string, with error keyword
-- alt -- string|nil|false, with fallback text
-- frame -- frame, if available
-- Returns
-- 1. string|nil|false, with selected message
-- 2. string|nil|false, with language code, or "error"
local storage = access
local data, r1, r2
if type( storage ) == "string" then
storage = mw.text.trim( storage )
s = storage:lower()
if s:sub( 1, 2 ) == "c:" then
storage = mw.text.trim( storage:sub( 3 ) )
s = storage:lower()
elseif s:sub( 1, 8 ) == "commons:" then
storage = mw.text.trim( storage:sub( 9 ) )
s = storage:lower()
end
if s:sub( 1, 5 ) == "data:" then
storage = mw.text.trim( storage:sub( 6 ) )
s = storage:lower()
end
if s == "" or s == ".tab" then
storage = false
elseif s:sub( -4 ) == ".tab" then
storage = storage:sub( 1, -5 ) .. ".tab"
else
storage = storage .. ".tab"
end
end
if type( storage ) == "string" then
if type( Multilingual.TabDATA ) ~= "table" then
Multilingual.TabDATA = { }
end
data = Multilingual.TabDATA[ storage ]
if type( data ) ~= "table" and not data then
local lucky
lucky, data = pcall( mw.ext.data.get, storage, "_" )
if type( data ) == "table" then
data = data.data
if type( data ) == "table" then
Multilingual.TabDATA[ storage ] = data
else
r1 = string.format( "%s [[%s%s]]",
"INVALID Multilingual.tabData",
"commons:Data:",
storage )
end
else
r1 = "BAD STORAGE Multilingual.tabData – commons:"
.. storage
end
if r1 then
Multilingual.TabDATA[ storage ] = true
data = false
end
end
else
r1 = "BAD STORAGE Multilingual.tabData"
end
if data then
if type( alert ) == "string" then
local seek = mw.text.trim( alert )
if seek == "" then
r1 = "EMPTY Multilingual.tabData key"
else
local e, poly
for i = 1, #data do
e = data[ i ]
if type( e ) == "table" then
if e[ 1 ] == seek then
if type( e[ 2 ] ) == "table" then
poly = e[ 2 ]
else
r1 = "INVALID Multilingual.tabData bad #"
.. tostring( i )
end
break -- for i
end
else
break -- for i
end
end -- for i
if poly then
data = poly
else
r1 = "UNKNOWN Multilingual.tabData key: " .. seek
end
end
else
r1 = "INVALID Multilingual.tabData key"
end
end
if r1 then
r2 = "error"
elseif data then
r1, r2 = Multilingual.i18n( data, alt, frame )
end
return r1, r2
end -- Multilingual.tabData()
return Multilingual.isRTL( s ) and "1" or ""
return Multilingual.isRTL( s ) and "1" or ""
end -- p.isRTL()
end -- p.isRTL()
return r or s
return r or s
end -- p.sitelink
end -- p.sitelink
p.tabData = function ( frame )
-- Retrieve best message text from Commons Data
-- 1 -- page identification on Commons
-- 2 -- keyword
-- alt -- fallback text
local suite = frame.args[ 1 ]
local seek = frame.args[ 2 ]
local salt = frame.args.alt
return Multilingual.tabData( suite, seek, salt, frame )
end -- p.tabData