FANDOM


--  Receives a card/set name and a language.
--  Returns the name of that card/set in the given language.
local Values = {};
 
function Values.localized_name( name, language )
    local _name = mw.ustring.gsub( name, '#', '' )
    local _language = language
    local out = ''
    --  SMW:
    if not mw.smw then
        return 'mw.smw module not found'
    end
    local result = mw.smw.ask{ '[[' .._name.. ']]', '?' .._language.. ' name=', limit = 1, mainlabel = '-' }
 
    --  Process SMW resutlt:
    if result == nil or result == '' then
        return nil
    end
 
    for _, v in ipairs(result) do
        local aux = ''
        for _, p in ipairs(v) do
            aux = aux .. p
        end
        out = out .. aux -- Should have only one value.
    end
 
   return out
end
 
return Values

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.