Nicht angemeldeter Benutzer - Bearbeiten von Seiten ist nur als angemeldeter Benutzer möglich.

Änderungen

Zur Navigation springen Zur Suche springen
1.504 Bytes hinzugefügt ,  03:06, 3. Nov. 2018
2018-11-01
Zeile 1: Zeile 1: −
local Export = { serial = "2018-10-31",
+
local Export = { serial = "2018-11-01",
 
                 suite  = "lang",
 
                 suite  = "lang",
 
                 item  = 26826825 }
 
                 item  = 26826825 }
Zeile 35: Zeile 35:  
                       Hebr = 115,
 
                       Hebr = 115,
 
                       Syrc = 110,
 
                       Syrc = 110,
                       Thaa = 125,
+
                       Thaa = 115,
 
                       Tibt = 125 },
 
                       Tibt = 125 },
 
   orderOther    = { grc = 1,
 
   orderOther    = { grc = 1,
Zeile 43: Zeile 43:  
   owns          = { de = "‚%s‘" },
 
   owns          = { de = "‚%s‘" },
 
   scripts        = "Multilingual/scripts",
 
   scripts        = "Multilingual/scripts",
 +
  sepComma      = "Latn Cyrl Grek Thai",
 
   tmplAudio      = false,    -- template for media player link
 
   tmplAudio      = false,    -- template for media player link
 
   tmplOtherLang  = false,    -- template for otherLanguaguage link
 
   tmplOtherLang  = false,    -- template for otherLanguaguage link
Zeile 93: Zeile 94:  
     return Config.frame
 
     return Config.frame
 
end -- Frame()
 
end -- Frame()
 +
 +
 +
 +
local function Friend()
 +
    -- Fetch Module:Multilingual/scripts
 +
    if not Config.multiScripts then
 +
        local lucky
 +
        lucky, Config.multiScripts = pcall( mw.loadData,
 +
                                            "Module:" .. Config.scripts )
 +
        if type( Config.multiScripts ) ~= "table" then
 +
            Config.multiScripts = { }
 +
        end
 +
    end
 +
    return Config.multiScripts
 +
end -- Friend()
      Zeile 263: Zeile 279:  
     end
 
     end
 
end -- fill()
 
end -- fill()
 +
 +
 +
 +
local function fit( acquire )
 +
    -- Retrieve script code for language
 +
    --    acquire  -- string, with language code
 +
    -- Returns string or false
 +
    local r
 +
    local written = Friend().written
 +
    if type( written ) == "table" then
 +
        r = written[ slang ]
 +
        if type( r ) == "table" then
 +
            r = r[ 1 ]
 +
        end
 +
    end
 +
    return r
 +
end -- fit()
      Zeile 301: Zeile 334:       −
local function foreign( apply, acquire, advanced )
+
local function follow( affine )
 +
    -- Retrieve appropriate separator
 +
    --    affine    -- string or nil, with code of script
 +
    -- Returns string, with separator (comma) or not
 +
    local r
 +
    if affine then
 +
        if Config.sepComma:find( affine, 1, true ) then
 +
            r = ","
 +
        else
 +
            r = ""
 +
        end
 +
    else
 +
        r = ","
 +
    end
 +
    return r
 +
end -- follow()
 +
 
 +
 
 +
 
 +
local function foreign( apply, acquire, advanced, affine )
 
     -- Format text in some language
 
     -- Format text in some language
 
     --    apply    -- string, with text
 
     --    apply    -- string, with text
 
     --    acquire  -- string, with basic code of language
 
     --    acquire  -- string, with basic code of language
 
     --    advanced  -- string, with full code of language
 
     --    advanced  -- string, with full code of language
     -- Returns string, starting with comma
+
     --     affine    -- string or nil, with code of script
     local story = apply
+
    -- Returns string
 +
     local story = apply
 +
    local script = affine
 
     local p = { ["font-weight"] = "normal" }
 
     local p = { ["font-weight"] = "normal" }
 
     local ltr, r
 
     local ltr, r
 
     if advanced == acquire then
 
     if advanced == acquire then
 
         ltr = not mw.language.new( acquire ):isRTL()
 
         ltr = not mw.language.new( acquire ):isRTL()
     elseif advanced:find( "-", 3, true ) then
+
     elseif not script  and  advanced:find( "-", 3, true ) then
 
         local parts = mw.text.split( advanced, "-", true )
 
         local parts = mw.text.split( advanced, "-", true )
 
         if #parts > 1  and  parts[ 2 ]:match( "^%u%l%l%l$" ) then
 
         if #parts > 1  and  parts[ 2 ]:match( "^%u%l%l%l$" ) then
             local script = parts[ 2 ]
+
             script = parts[ 2 ]
            local rtl = friend().rtl
+
        end
            if type( rtl ) == "table" then
+
    end
                ltr = not rtl[ script ]
+
    if script then
            end
+
        local rtl = Friend().rtl
 +
        if type( rtl ) == "table" then
 +
            ltr = not rtl[ script ]
 
         end
 
         end
 
     end
 
     end
Zeile 348: Zeile 404:       −
local function foreigns( aliens )
+
local function foreigns( ahead, aliens )
 
     -- Create list of translations
 
     -- Create list of translations
 +
    --    ahead  -- string, with leading separator
 
     --    aliens  -- sequence table, with assignment tables
 
     --    aliens  -- sequence table, with assignment tables
     -- Returns string, starting with comma
+
     -- Returns string, starting with separator (comma)
    local r = ""
   
     local pars = { }
 
     local pars = { }
 +
    local sep  = ahead
 +
    local r    = ""
 
     local s, t
 
     local s, t
 
     family()
 
     family()
Zeile 389: Zeile 447:  
             s = string.format( "%s %s",
 
             s = string.format( "%s %s",
 
                               facet( s ),
 
                               facet( s ),
                               foreign( t.story, t.short, t.slang ) )
+
                               foreign( t.story,
 +
                                        t.short,
 +
                                        t.slang,
 +
                                        t.script ) )
 
         end
 
         end
         r = string.format( "%s, %s", r, s )
+
         r   = string.format( "%s%s %s", r, sep, s )
 +
        sep = ","    -- follow( t.script )
 
     end -- for i
 
     end -- for i
 
     return r
 
     return r
 
end -- foreigns()
 
end -- foreigns()
  −
  −
  −
local function friend()
  −
    -- Fetch Module:Multilingual/scripts
  −
    if not Config.multiScripts then
  −
        local lucky
  −
        lucky, Config.multiScripts = pcall( mw.loadData,
  −
                                            "Module:" .. Config.scripts )
  −
        if type( Config.multiScripts ) ~= "table" then
  −
            Config.multiScripts = { }
  −
        end
  −
    end
  −
    return Config.multiScripts
  −
end -- friend()
        Zeile 456: Zeile 503:  
     local r
 
     local r
 
     if arglist.Text1 then
 
     if arglist.Text1 then
 +
        local sep  = ""
 
         local slang = Config.slang
 
         local slang = Config.slang
 
         local params, s
 
         local params, s
Zeile 464: Zeile 512:  
                 arglist.style = "font-style:italic"
 
                 arglist.style = "font-style:italic"
 
             end
 
             end
 +
            sep = ","
 
             if arglist.Text2 then
 
             if arglist.Text2 then
 
                 arglist.Text2 = fault( "errInvalid", "Latn+2=" )
 
                 arglist.Text2 = fault( "errInvalid", "Latn+2=" )
Zeile 485: Zeile 534:  
                                               Config.slang ),
 
                                               Config.slang ),
 
                       style = "font-style:italic" }
 
                       style = "font-style:italic" }
             s = mw.text.tag( "span", params, arglist.Text2 )
+
             s     = mw.text.tag( "span", params, arglist.Text2 )
             r = string.format( "%s %s", r, s )
+
             r     = string.format( "%s %s", r, s )
 +
            sep    = ","
 
         end
 
         end
 
         if arglist.sanskrit then
 
         if arglist.sanskrit then
Zeile 516: Zeile 566:  
                 r = string.format( "%s, %s: ", r, fiast( "IAST" ) )
 
                 r = string.format( "%s, %s: ", r, fiast( "IAST" ) )
 
             else
 
             else
                 r = r .. " "
+
                 r   = r .. " "
                 s = fiast( s )
+
                 s   = fiast( s )
 +
                sep = ","
 
             end
 
             end
 
             r = r .. mw.text.tag( "span", params, s )
 
             r = r .. mw.text.tag( "span", params, s )
Zeile 547: Zeile 598:  
         if arglist.IPA then
 
         if arglist.IPA then
 
             params = { [1] = arglist.IPA }
 
             params = { [1] = arglist.IPA }
             s = Frame():expandTemplate{ title = Config.ipa,
+
             s     = Frame():expandTemplate{ title = Config.ipa,
                                        args  = params }
+
                                            args  = params }
             r = string.format( "%s [%s]", r, s )
+
             r     = string.format( "%s [%s]", r, s )
 +
            sep    = ","
 
         end
 
         end
 
         if arglist.trsl then
 
         if arglist.trsl then
             r = r .. foreigns( arglist.trsl )
+
             r = r .. foreigns( sep, arglist.trsl )
 
         end
 
         end
 
     elseif arglist.Text2 then
 
     elseif arglist.Text2 then
Zeile 597: Zeile 649:  
     if type( argsT ) == "table" then
 
     if type( argsT ) == "table" then
 
         local n = table.maxn( Config.params )
 
         local n = table.maxn( Config.params )
         local unknown
+
         local script, unknown
 
         for k, v in pairs( argsT ) do
 
         for k, v in pairs( argsT ) do
 
             s = type( k )
 
             s = type( k )
Zeile 627: Zeile 679:  
             elseif k:match( "^%l%l%l?-?" ) then
 
             elseif k:match( "^%l%l%l?-?" ) then
 
                 s = k:match( "^(%l%l%l?)$" )  or
 
                 s = k:match( "^(%l%l%l?)$" )  or
                     k:match( "^(%l%l%l?)-%u%u$" )  or
+
                     k:match( "^(%l%l%l?)%-%u%u$" )  or
                     k:match( "^(%l%l%l?)-%u%l%l%l$" )
+
                     k:match( "^(%l%l%l?)%-%u%l%l%l$" )
 
                 v = mw.text.trim( v )
 
                 v = mw.text.trim( v )
 
                 if v == "" then
 
                 if v == "" then
Zeile 637: Zeile 689:  
                   s ~= Config.slang  and
 
                   s ~= Config.slang  and
 
                   mw.language.isSupportedLanguage( s ) then
 
                   mw.language.isSupportedLanguage( s ) then
 +
                    script = k:match( "^%l%l%l?%-(%u%l%l%l)$" )
 +
                    if not script then
 +
                        script = fit( s )
 +
                        if script then
 +
                            k = string.format( "%s-%s", s, script )
 +
                        end
 +
                    end
 
                     if not r.trsl then
 
                     if not r.trsl then
 
                         r.trsl = { }
 
                         r.trsl = { }
 
                     end
 
                     end
 
                     table.insert( r.trsl,
 
                     table.insert( r.trsl,
                                   { n     = #r.trsl + 10,
+
                                   { n     = #r.trsl + 10,
                                     short = s,
+
                                    script = script,
                                     slang = k,
+
                                     short = s,
                                     story = v } )
+
                                     slang = k,
 +
                                     story = v } )
 
                     k = false
 
                     k = false
 
                 end
 
                 end
 
             elseif k == "IAST" then
 
             elseif k == "IAST" then
                 local trans = friend().trans
+
                 local trans = Friend().trans
 
                 if type( trans ) == "table"  and
 
                 if type( trans ) == "table"  and
 
                   trans[ Config.slang ] == "IAST" then
 
                   trans[ Config.slang ] == "IAST" then
Zeile 915: Zeile 975:  
     slang = slang:lower()
 
     slang = slang:lower()
 
     if not script then
 
     if not script then
         local written = friend().written
+
         script = fit( slang )
        if type( written ) == "table" then
  −
            script = written[ slang ]
  −
            if type( script ) == "table" then
  −
                script = script[ 1 ]
  −
            end
  −
        end
   
     end
 
     end
 
     if script then
 
     if script then
         local rtl = friend().rtl
+
         local rtl = Friend().rtl
 
         if type( rtl ) == "table" then
 
         if type( rtl ) == "table" then
 
             ltr = not rtl[ script ]
 
             ltr = not rtl[ script ]
Zeile 959: Zeile 1.013:  
                                     "Module:Vorlage:lang/Zwiebelfisch" )
 
                                     "Module:Vorlage:lang/Zwiebelfisch" )
 
             if type( x ) == "table"  and  type( x.f ) == "function" then
 
             if type( x ) == "table"  and  type( x.f ) == "function" then
                 x = x.f( friend().unicodes, apply, script )
+
                 x = x.f( Friend().unicodes, apply, script )
 
                 if type( x ) == "string" then
 
                 if type( x ) == "string" then
 
                     r = r .. x
 
                     r = r .. x
Zeile 1.020: Zeile 1.074:     
p.feedIAST = function ( frame )
 
p.feedIAST = function ( frame )
     local trans = friend().trans
+
     local trans = Friend().trans
 
     return type( trans ) == "table"  and
 
     return type( trans ) == "table"  and
 
           trans[ frame.args[ 1 ] ] == "IAST"  and
 
           trans[ frame.args[ 1 ] ] == "IAST"  and
Zeile 1.043: Zeile 1.097:  
     local r = Config.percents[ frame.args[ 1 ] ]
 
     local r = Config.percents[ frame.args[ 1 ] ]
 
     if type( r ) == "number" then
 
     if type( r ) == "number" then
         r = tostring( Config.percents )
+
         r = tostring( r )
 
     else
 
     else
 
         r = "100"
 
         r = "100"
Cookies helfen uns bei der Bereitstellung von imedwiki. Durch die Nutzung von imedwiki erklärst du dich damit einverstanden, dass wir Cookies speichern.

Navigationsmenü