Module:I18n: Difference between revisions

From Elwiki
(Add i18n support module)
 
m (Fix non-existent translations)
Line 39: Line 39:
     for _, translate_line in ipairs(translate_lines) do
     for _, translate_line in ipairs(translate_lines) do
         -- Key should always without spaces, so apply trim to it directly.
         -- Key should always without spaces, so apply trim to it directly.
         local equal_start, equal_end = string.find(translate_line, '=')
         local equal_start, equal_end = string.find(translate_line, '=')
         local key = trim(string.sub(translate_line, 1, equal_start - 1))
         if equal_start then
        local value = string.sub(translate_line, equal_end + 1)
            local key = trim(string.sub(translate_line, 1, equal_start - 1))
       
            local value = string.sub(translate_line, equal_end + 1)
        if trimValues ~= false then
            value = trim(value)
        end


        if key then
            if trimValues ~= false then
            translations[key] = value
                value = trim(value)
            end
 
            if key then
                translations[key] = value
            end
         end
         end
     end
     end