Open main menu

Changes

Module:Lang

917 bytes added, 18:23, 6 December 2021
m
1 revision imported
end
end
else -- cheap way to determine if there are prefixes; fonipa and others don't have prefixes; # operator always returns 0 if variant_table[variant]['prefixes'][1] and not in_array (code, variant_table[variant]['prefixes']) then
return code, script, region, nil, nil, table.concat ({'unrecognized variant: ', variant, ' for code: ', code});
end
end
end
if is_set (private) then
private = private:lower(); -- ensure that we use and return lower case version of this
table.insert (html, table.concat ({'<', tag})); -- open the <i>, <span>, or <div> html tag
code = code:gsub ('%-x%-.*', ''); -- strip private use subtag from code tag because meaningless outside of wikipedia
table.insert (html, table.concat ({' lang="', code, '\"'})); -- add language attribute
table.insert (html, ' collective text'); -- for collective languages
else
table.insert (html, ' -language text'); -- for individual languages
end
table.insert (html, '\">'); -- close the opening html tag
args.text = proto_prefix (args.text, language_name, args.proto); -- prefix proto-language text with a splat
table.insert (out, make_text_html (args.code, args.text, tag, args.rtl, args.italic, args.size, ('none' == args.label) and language_name or nil))
if is_set (args.translit) and not unicode.is_Latin (args.text) then -- transliteration (not supported in {{lang}}); not supported when args.text is wholly latn text (this is an imperfect test)
table.insert (out, make_wikilink ('Literal translation', 'lit.'));
end
table.insert (out, "&nbspthinsp;</small>");
end
table.insert (out, table.concat ({'&#39;', args.translation, '&#39;'})); -- use html entities to avoid wiki markup confusion
local function is_ietf_tag (frame)
return _is_ietf_tag (getArgs(frame)[1]); -- args[1] is the ietf language tag to be tested; also get parent frameend  --[[--------------------------< I S _ I E T F _ T A G _ F R A M E >-------------------------------------------- Module entry point from an {{#invoke:}}; same as is_ietf_tag() except does not get parameters from the parent(template) frame. This function not useful when called by {{lang|fn=is_ietf_tag_frame|<tag>}} because <tag>is in the parent frame. ]] local function is_ietf_tag_frame (frame) return _is_ietf_tag (getArgs(frame, {frameOnly = true,}) so we also [1]); -- args[1] is the ietf language tag to be tested; do not get parent frame
end
local title_table = lang_data.translit_title_table; -- table of transliteration standards and the language codes and scripts that apply to those standards
local language_name; -- language name that matches language code; used for tool tip
local translit; -- translitterated transliterated text to display
local script; -- IANA script
local msg; -- for when called functions return an error message
lang_xx_italic = lang_xx_italic,
is_ietf_tag = is_ietf_tag,
is_ietf_tag_frame = is_ietf_tag_frame,
is_lang_name = is_lang_name,
tag_from_name = tag_from_name, -- returns ietf tag associated with language name