sync from sandbox;
Arjunaraoc (చర్చ | రచనలు) చి (en:Module:Lang నుండి కూర్పును దిగుమతి చేసాం: తాజా) |
(sync from sandbox;) |
||
require('Module:No globals');
local initial_style_state; -- set by lang_xx_normal() and lang_xx_italic()▼
local getArgs = require ('Module:Arguments').getArgs;
local yesno = require ('Module:Yesno');
local
local lang_name_table = lang_data.lang_name_table; -- language codes, names, regions, scripts, suppressed scripts
local lang_table = lang_data.lang_name_table.lang;
local script_table = lang_data.lang_name_table.script;
local region_table = lang_data.lang_name_table.region;
local variant_table = lang_data.lang_name_table.variant;
local suppressed_table = lang_data.lang_name_table.suppressed;
local override_table = lang_data.override;
local synonym_table = mw.loadData ('Module:Lang/ISO 639 synonyms'); -- ISO 639-2/639-2T code translation to 639-1 code
local namespace = mw.title.getCurrentTitle().namespace; -- used for categorization
local this_wiki_lang = mw.language.getContentLanguage().code; -- get this wiki's language
▲local initial_style_state; -- set by lang_xx_normal() and lang_xx_italic()
local maint_cats = {}; -- maintenance categories go here
script subtag - four character IANA script code
region subtag - two-letter or three digit IANA region code
variant subtag - four digit or 5-8 alnum variant code; only one variant subtag supported
private subtag - x- followed by 1-8 alnum private code; only supported with the primary language tag
code = code:lower(); -- ensure that we use and return lower case version of this
if not (
return nil, nil, nil, nil, nil, table.concat ({'unrecognized language code: ', code}); -- invalid language code, don't know about the others (don't care?)
end
if is_set (script) then
script = script:lower(); -- ensure that we use and return lower case version of this
if not
return code, nil, nil, nil, nil, table.concat ({'unrecognized script: ', script, ' for code: ', code}); -- language code ok, invalid script, don't know about the others (don't care?)
end
end
if
if in_array (code,
return code, nil, nil, nil, nil, table.concat ({'script: ', script, ' not supported for code: ', code}); -- language code ok, script is suppressed for this code
end
if is_set (region) then
region = region:lower(); -- ensure that we use and return lower case version of this
if not
return code, script, nil, nil, nil, table.concat ({'unrecognized region: ', region, ' for code: ', code});
end
if is_set (variant) then
variant = variant:lower(); -- ensure that we use and return lower case version of this
if not
return code, script, region, nil, nil, table.concat ({'unrecognized variant: ', variant});
end -- does this duplicate/replace tests in lang() and lang_xx()?
if is_set (script) then -- if script set it must be part of the 'prefix'
if not in_array (table.concat ({code, '-', script}),
return code, script, region, nil, nil, table.concat ({'unrecognized variant: ', variant, ' for code-script pair: ', code, '-', script});
end
elseif is_set (region) then -- if region set, there are some prefixes that require lang code and region (en-CA-newfound)
if not in_array (code,
if not in_array (table.concat ({code, '-', region}),
return code, script, region, nil, nil, table.concat ({'unrecognized variant: ', variant, ' for code-region pair: ', code, '-', region});
end
end
else
if not in_array (code,
return code, script, region, nil, nil, table.concat ({'unrecognized variant: ', variant, ' for code: ', code});
end
if is_set (private) then
private = private:lower(); -- ensure that we use and return lower case version of this
if not
return code, script, region, nil, nil, table.concat ({'unrecognized private tag: ', private});
end
if language_name:find ('languages') then
--
end
if 'en' == code then
table.insert (cat, 'explicitly cited
else
table.insert (cat, language_name);
table.insert (cat, '-language text]]');
end
if title_table[std] then -- and if standard is legitimate
if title_table[std][tscript] then -- and if script for that standard is legitimate
table.insert (tout, table.concat ({title_table[std][tscript:lower()], ' (',
else
table.insert (tout, title_table[std]['default']); -- use the default if script not in std table; TODO: maint cat? error message because script not found for this standard?
if title_table[std][code] then -- if language code is in the table (transl may not provide a language code)
table.insert (tout, table.concat ({title_table[std][code:lower()], ' (',
else -- code doesn't match
table.insert (tout, title_table[std]['default']); -- so use the standard's default
local function language_name_get (ietf, code, variant)
if override_table[ietf] then -- look for whole IETF tag in override table
return override_table[ietf][1];
elseif
return
elseif
end
end
--[[--------------------------< _ L A N G >--------------------------------------------------------------------
end
msg = validate_text (template, args);
if is_set (msg) then -- msg is an already-formatted error message
return msg;
if 'none' ~= args.label then
table.insert (out, '<small>');
if
translit_script_name =
else
translit_script_name = language_name; -- fall back on language name
if args[1] and '' ~= args[1] then
local data = mw.loadData ('Module:Lang/name to tag/sandbox');
local lang = args[1]:lower(); -- allow any-case for the language name (speeling must till be correct)
local tag = data.
if tag then
end
else
return make_error_msg ('missing language / script code', args, 'transl');
end
end
if
language_name =
elseif
language_name =
elseif
language_name =
script = args.code; -- code was an ISO 15924 script so use that instead
args.code = ''; -- unset because not a language code
local code; -- the language code
local msg; -- gets an error message if IETF language tag is malformed or invalid
local
code, subtags.script, subtags.region, subtags.variant, subtags.private, msg = get_ietf_parts (raw_code);
raw_code = format_ietf_tag (code, subtags.script, subtags.region, subtags.variant, subtags.private); -- format to recommended subtag styles; private omitted because private
return category_name;
▲ return make_category (code, language_name, nil, true)
end
|