Module:Lang: Difference between revisionsGive feedback
m p.test |
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`. | ||
-- 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' | ||