Modul:DateTime: Unterschied zwischen den Versionen

Zur Navigation springen Zur Suche springen
1.250 Bytes hinzugefügt ,  4. November 2014
update
(update #unix)
(update)
Zeile 1: Zeile 1:
--[=[ 2014-09-20
--[=[ 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 and  show:find( "M" ) then
             if self.month then
                 local m = World.monthsAbbr[ opts.lang ]
                local bucket, m, suite, x
                 if m then
                if show:find( "F" ) then
                     local ex = m[ self.month ]
                    suite = "monthsLong"
                     if ex then
                elseif show:find( "M" ) then
                         local stop  = m.suffix
                    suite = "monthsAbbr"
                         local std  = ex[ 1 ]
                end
                         local shift = ex[ 2 ]
                 bucket = World[ suite ]
                         if stop then
                 if bucket then
                             std  = string.format( "%s%%%s",
                     m = bucket[ opts.lang ]
                                                  std, stop )
                     if slang then
                            shift = string.format( "%s%s",
                         x = bucket[ slang ]
                                                  shift, stop )
                    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
                        r = mw.ustring.gsub( r, std, shift )
                     end
                     end
                 end
                 end
Anonymer Benutzer

Navigationsmenü