Module:Lang: Difference between revisionsGive feedback
More general check for subpage lang code |
added nil check for lang code |
||
| Line 45: | Line 45: | ||
local lang_code = title.fullText:match(".*/(.*)$") | local lang_code = title.fullText:match(".*/(.*)$") | ||
-- if the last part the url is two letters, then | -- if the last part the url is not two letters, then its not a lang code, | ||
if (string.len(lang_code) | -- so default to english | ||
return | if (lang_code == nil or string.len(lang_code) ~= 2) then | ||
return 'en' | |||
end | end | ||
return lang_code | |||
return | |||
end | end | ||
return p | return p | ||