Modul:Multilingual: Unterschied zwischen den Versionen

2019-11-12
w>PerfektesChaos
(2019-11-02)
w>PerfektesChaos
(2019-11-12)
Zeile 1: Zeile 1:
local Multilingual = { suite  = "Multilingual",
local Multilingual = { suite  = "Multilingual",
                       serial  = "2019-11-02",
                       serial  = "2019-11-12",
                       item    = 47541920,
                       item    = 47541920,
                       globals = { ISO15924 = 71584769,
                       globals = { ISO15924 = 71584769,
Zeile 26: Zeile 26:
* userLangCode()
* userLangCode()
* wikibase()
* wikibase()
* failsafe()
loadData: Multilingual/config Multilingual/names
loadData: Multilingual/config Multilingual/names
]=]
]=]
Zeile 45: Zeile 46:
       ger      = "de",
       ger      = "de",
       gr        = "el",
       gr        = "el",
      ["in"]    = "id",
       iw        = "he",
       iw        = "he",
       jp        = "ja",
       jp        = "ja",
Zeile 763: Zeile 763:
     return r
     return r
end -- Multilingual.getName()
end -- Multilingual.getName()
Multilingual.getScriptName = function ( assigned, alien, add )
    -- OBSOLETE
    -- Retrieve script name, hopefully linked
    -- Precondition:
    --    assigned  -- string, with ISO 15924 script code
    --    alien    -- string, with ISO language code, or not
    --    add      -- arbitrary additional information
    -- Postcondition:
    --    Returns string
    local bib = fetch( "ISO15924" )
    local r
    if bib  and
      type( bib.getScriptName ) == "function" then
        r = bib.getScriptName( assigned, alien, add )
    end
    return r or ""
end -- Multilingual.getScriptName()




Zeile 1.141: Zeile 1.121:
     --    frame    -- frame, if available
     --    frame    -- frame, if available
     -- Postcondition:
     -- Postcondition:
     --    Returns string with appropriate code
     --    Returns
    --        1. string, with selected message
    --        2. string, with language code, or not
     local s = type( all )
     local s = type( all )
     local object, r
     local object, r, r2
     if s == "table" then
     if s == "table" then
         object = all
         object = all
Zeile 1.150: Zeile 1.132:
     end
     end
     if type( object ) == "table" then
     if type( object ) == "table" then
         if about then
         if about and  about ~= "labels" then
             s = "descriptions"
             s = "descriptions"
         else
         else
Zeile 1.158: Zeile 1.140:
         if type( object ) == "table" then
         if type( object ) == "table" then
             if object[ attempt ] then
             if object[ attempt ] then
                 r = object[ attempt ].value
                 r = object[ attempt ].value
                r2 = attempt
             else
             else
                 local poly
                 local poly
Zeile 1.166: Zeile 1.149:
                 end -- for k, v
                 end -- for k, v
                 if poly then
                 if poly then
                     r = Multilingual.i18n( poly, nil, frame )
                     r, r2 = Multilingual.i18n( poly, nil, frame )
                 end
                 end
             end
             end
         end
         end
     end
     end
     return r  or  ""
     return r  or  "",  r2
end -- Multilingual.wikibase()
end -- Multilingual.wikibase()


Zeile 1.324: Zeile 1.307:
     return r or ""
     return r or ""
end -- p.getName
end -- p.getName
p.getScriptName = function ( frame )
    -- OBSOLETE
    -- Retrieve script name from ISO 15924 script code, hopefully linked
    --    1  -- code
    --    2  -- optional additional key
    local s1 = mw.text.trim( frame.args[ 1 ]  or  "????" )
    local s2 = frame.args[ 2 ]
    if s2 then
        s2 = mw.text.trim( s2 )
    end
    return Multilingual.getScriptName( s1, false, s2 )
end -- p.getScriptName




Zeile 1.467: Zeile 1.435:
     -- Optimal translation of wikibase component
     -- Optimal translation of wikibase component
     --    1  -- object ID
     --    1  -- object ID
     --    2  -- either "descriptions" or "labels"
     --    2  -- 1 for "descriptions", 0 for "labels".
    --          or either "descriptions" or "labels"
     local r
     local r
     local s = mw.text.trim( frame.args[ 1 ]  or  "" )
     local s = mw.text.trim( frame.args[ 1 ]  or  "" )
Anonymer Benutzer