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 63:
Zeile 100:
− +
Zeile 72:
Zeile 109:
+
+
+
Zeile 106:
Zeile 146:
− +
Zeile 129:
Zeile 169:
+
Zeile 150:
Zeile 191:
− +
Zeile 181:
Zeile 222:
− +
+
+
Zeile 188:
Zeile 231:
− +
+
Zeile 294:
Zeile 338:
− +
− tLang = Multilingual.ext.tNames
Zeile 321:
Zeile 364:
+
+
+
2016-06-11
local Multilingual = { suite = "Multilingual",
local Multilingual = { suite = "Multilingual",
serial = "2016-05-23" };
serial = "2016-06-11" };
-- local globals
-- local globals
local Frame
local Frame
function fair( ask )
-- Format language code according to BCP 47 / RFC 4646
-- Precondition:
-- ask -- language name, downcased
-- Postcondition:
-- nil, or string
local r
if ask:find( "-", 3, true ) then
local parts = mw.text.split( ask, "-" )
if parts[ 1 ]:match( "^%l%l%l?$" ) then
local script = parts[ 2 ]
r = parts[ 1 ]
if script then
local subA2 = parts[ 3 ]
if script:match( "^%l%l%l%l$" ) then
r = string.format( "%s-%s%s",
r,
script:sub( 1, 1 ):upper(),
script:sub( 2 ) )
else
subA2 = script
end
if subA2 and subA2:match( "^%l%l$" ) then
r = string.format( "%s-%s",
r,
subA2:upper() )
end
end
end
elseif ask:match( "^%l%l%l?$" ) then
r = ask
end
return r
end -- fair()
-- alien -- language code of ask
-- alien -- language code of ask
-- Postcondition:
-- Postcondition:
-- nil, or
-- nil, or string
local codes = mw.language.fetchLanguageNames( alien, "all" )
local codes = mw.language.fetchLanguageNames( alien, "all" )
local r
local r
end
end
end -- for k, v
end -- for k, v
if not r then
r = fair( ask )
end
return r
return r
end -- find()
end -- find()
seek = mw.ustring.lower( seek )
seek = mw.ustring.lower( seek )
if Multilingual.isLang( seek ) then
if Multilingual.isLang( seek ) then
r = seek
r = fair( seek )
else
else
local slang = favorite()
local slang = favorite()
-- -- "!": current project
-- -- "!": current project
-- -- "#": code, downcased, space separated
-- -- "#": code, downcased, space separated
-- -- "-": code, mixcase, space separated
-- -- any valid code
-- -- any valid code
-- alter -- capitalize, if "c"; downcase all, if "d"
-- alter -- capitalize, if "c"; downcase all, if "d"
if adjacent then
if adjacent then
separator = adjacent
separator = adjacent
elseif alien == "#" then
elseif alien == "#" or alien == "-" then
separator = " "
separator = " "
else
else
slang = Multilingual.findCode( single )
slang = Multilingual.findCode( single )
if slang then
if slang then
if alien == "#" then
if alien == "-" then
r = slang
r = slang
elseif alien == "#" then
r = slang:lower()
else
else
r = Multilingual.getName( slang, alien )
r = Multilingual.getName( slang, alien )
local cnf = fetch( "Multilingual/config",
local cnf = fetch( "Multilingual/config",
true )
true )
if cnf then
if cnf and
type( cnf.getLink ) == "function" then
if not frame then
if not frame then
if not Frame then
if not Frame then
slang = ask:lower()
slang = ask:lower()
end
end
fetch( support, true )
tLang = fetch( support, true )
if tLang then
if tLang then
tLang = tLang[ slang ]
tLang = tLang[ slang ]
if not r then
if not r then
r = mw.language.fetchLanguageName( ask, slang )
r = mw.language.fetchLanguageName( ask, slang )
if r == "" then
r = false
end
end
end
else
else