Modul:DateTime: Unterschied zwischen den Versionen
update
(update #unix) |
(update) |
||
Zeile 1: | Zeile 1: | ||
--[=[ 2014- | --[=[ 2014-11-02 | ||
Date and time utilities | Date and time utilities | ||
]=] | ]=] | ||
Zeile 1.129: | Zeile 1.129: | ||
if type( self ) == "table" then | if type( self ) == "table" then | ||
local opts = { lang = self.lang } | local opts = { lang = self.lang } | ||
local babel | local babel, slang | ||
if type( adapt ) == "table" then | if type( adapt ) == "table" then | ||
if type( adapt.lang ) == "string" then | if type( adapt.lang ) == "string" then | ||
opts.lang = adapt.lang | local i = adapt.lang:find( "-", 3, true ) | ||
if i then | |||
slang = adapt.lang | |||
opts.lang = slang:sub( 1, i - 1 ) | |||
else | |||
opts.lang = adapt.lang | |||
end | |||
end | end | ||
opts.london = adapt.london | opts.london = adapt.london | ||
Zeile 1.193: | Zeile 1.199: | ||
tostring( self.year ) ) | tostring( self.year ) ) | ||
end | end | ||
if self.month | if self.month then | ||
local bucket, m, suite, x | |||
if | if show:find( "F" ) then | ||
suite = "monthsLong" | |||
if | elseif show:find( "M" ) then | ||
suite = "monthsAbbr" | |||
local | end | ||
local | bucket = World[ suite ] | ||
if stop then | if bucket then | ||
std = string.format( "%s%%%s", | m = bucket[ opts.lang ] | ||
if slang then | |||
x = bucket[ slang ] | |||
end | |||
if m then | |||
local base = m[ self.month ] | |||
local ex | |||
if x then | |||
ex = x[ self.month ] | |||
end | |||
if suite == "monthsAbbr" then | |||
local stop | |||
if ex then | |||
stop = x.suffix | |||
base = ex | |||
else | |||
stop = m.suffix | |||
end | |||
if base and stop then | |||
local shift, std | |||
std = string.format( "%s%%%s", | |||
base[ 1 ], stop ) | |||
shift = string.format( "%s%s", | |||
base[ 2 ], stop ) | |||
r = mw.ustring.gsub( r, std, shift ) | |||
end | |||
elseif suite == "monthsLong" then | |||
if base and ex then | |||
r = mw.ustring.gsub( r, base, ex ) | |||
end | |||
end | end | ||
end | end | ||
end | end |