webmcp

diff framework/env/locale/_get_translation_table.lua @ 563:2c31275322db

Allow inheritance in translation tables using __parent
author jbe
date Sun Mar 07 16:58:59 2021 +0100 (2021-03-07)
parents ba68ef9e7c90
children
line diff
     1.1 --- a/framework/env/locale/_get_translation_table.lua	Fri Feb 05 15:51:39 2021 +0100
     1.2 +++ b/framework/env/locale/_get_translation_table.lua	Sun Mar 07 16:58:59 2021 +0100
     1.3 @@ -17,6 +17,15 @@
     1.4      if type(translation_table) ~= "table" then
     1.5        error("Translation file did not return a table.")
     1.6      end
     1.7 +    local parent_code = translation_table["__parent"]
     1.8 +    if parent_code then
     1.9 +      local parent_table = locale._get_translation_table(parent_code)
    1.10 +      for key, value in pairs(parent_table) do
    1.11 +        if translation_table[key] == nil then
    1.12 +          translation_table[key] = value
    1.13 +        end
    1.14 +      end
    1.15 +    end
    1.16      locale._translation_tables[language_code] = translation_table
    1.17      return translation_table
    1.18    else

Impressum / About Us