Changes

Module:InfoboxImage

389 bytes added, 19:08, 14 January 2014
change as per request by [[User:Nullzero]] to make file & image prefixes work with other languages
The following lines were added (+) and removed (-):
     -- remove file: or image: prefix if exists     -- remove prefix if exists     if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "file:" then     local allNames = mw.site.namespaces[6].aliases        image = mw.ustring.sub(image,6);    allNames[#allNames + 1] = mw.site.namespaces[6].name     end    allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName    if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "image:" then     for i, name in ipairs(allNames) do        image = mw.ustring.sub(image,7);        if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then            image = mw.ustring.sub(image, mw.ustring.len(name) + 2);            break        end     if frame.args["suppressplaceholder"] == "yes" then     if frame.args["suppressplaceholder"] ~= "no" then         -- remove file: or image: prefix if exists         -- remove prefix if exists         if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "file:" then         local allNames = mw.site.namespaces[6].aliases            image = mw.ustring.sub(image,6);        allNames[#allNames + 1] = mw.site.namespaces[6].name         end        allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName        if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "image:" then         for i, name in ipairs(allNames) do            image = mw.ustring.sub(image,7);            if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then                image = mw.ustring.sub(image, mw.ustring.len(name) + 2);                break            end
Anonymous user
WOSlinker