Content deleted Content added
sync from live |
+ native_name_lang(); |
||
Line 103:
table.insert (result, table.concat (cats)); -- add categories
return table.concat (result); -- make a big string and done
end
--[[--------------------------< N A T I V E _ N A M E _ L A N G >----------------------------------------------
implements combined is_ietf_code() and name_to_code() in Module:Lang for various infoboxen that support a
|native_name_lang= parameter.
if {{{1}}} is a valid ietf language tag, returns that tag;
if {{{1}}} is a properly spelled (case agnostic) language name, returns the ietf language tag associated with that name
error messages else
entry point from an {{#invoke:Lang|native_name_lang|<language name or tag>|template=<template name>}}
]]
local function native_name_lang (frame)
local lang_module = require ('Module:Lang/sandbox');
local getArgs = require ('Module:Arguments').getArgs;
local args = getArgs(frame);
if lang_module._is_ietf_code (args[1]) then
return args[1]; -- if a code, return the code
else
return lang_module._code_from_name (args); -- not a code, attempt to get a code from the args[1] input value; return code or error message
end
end
Line 111 ⟶ 137:
return {
in_lang = in_lang,
native_name_lang = native_name_lang,
set_italics = set_italics,
}
|