Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:I18n: Difference between revisions

From ANANSI
Create i18n module
Tag: Reverted
No edit summary
Tag: Reverted
Line 1: Line 1:
local i18n = {}
local i18n = {
    label_upload_image = "Upload image",
    category_infobox_using_placeholder_image = "Pages using infobox placeholder image"
}


function i18n:new()
local p = {}
    local o = {}
    setmetatable(o, self)
    self.__index = self
    return o
end


function i18n:translate(key)
function p.new()
     return key  -- You can expand this later
    local self = setmetatable({}, { __index = i18n })
    function self.translate(_, key)
        return i18n[key] or key
    end
     return self
end
end


return i18n
return p

Revision as of 17:57, 24 May 2025

Documentation for this module may be created at Module:I18n/doc

local i18n = {
    label_upload_image = "Upload image",
    category_infobox_using_placeholder_image = "Pages using infobox placeholder image"
}

local p = {}

function p.new()
    local self = setmetatable({}, { __index = i18n })
    function self.translate(_, key)
        return i18n[key] or key
    end
    return self
end

return p