Module:Lang: Difference between revisions

Sur (talk | contribs)
m p.test
Sur (talk | contribs)
m fixed bug where get_string params were overwritten by local declaration
Line 32: Line 32:
-- If called internally (direct Lua call), args will be passed directly.
-- If called internally (direct Lua call), args will be passed directly.
     -- If called from wikitext, `key` will be the `frame` object, and we get args from `frame.args`.
     -- If called from wikitext, `key` will be the `frame` object, and we get args from `frame.args`.
local lang_code_override
 
local fallback_str
local remove_var_index
local upper_lower
     -- Handle the case where it's called via #invoke (i.e., from wikitext)
     -- Handle the case where it's called via #invoke (i.e., from wikitext)
     if type(key) == "table" and key.args then
     if type(key) == "table" and key.args then
Line 218: Line 214:
     local title = mw.title.getCurrentTitle()
     local title = mw.title.getCurrentTitle()
     local lang_code = title.fullText:match(".*/(.*)$")
     local lang_code = title.fullText:match(".*/(.*)$")
   
if lang_code == nil or lang_codes_set[lang_code] == nil then
if lang_code == nil or lang_codes_set[lang_code] == nil then
return 'en'
return 'en'