Module:Lang: Difference between revisions

Content deleted Content added
No edit summary
latf, latg, same as latf;
Line 1,011:
 
Conversely, when <text> is written using the Latn script, the IETF script subtag, if present, should be Latn.
 
For the purposes of this test, Latf (Fraktur) and Latg (Gaelic) are considered to be equivalent to Latn because
unicode treats these two scripts as font-specific variants of Latn.
 
Returns an error message when mismatch detected; nil else.
Line 1,017 ⟶ 1,020:
 
local function text_script_match_test (script, is_latn_text, pos)
local scripts_t = {['latf'] = true, ['latg'] = true, ['latn'] = true}; -- unicode 'latn' scripts; 'latf' and 'latg' are font variants so there are no Fraktur or Gaelic codepoints
if is_set (script) then -- don't bother with the rest of this if <script> is nil or empty string
script = script:lower(); -- lower case to index into <scripts_t>
if is_latn_text then -- when text is wholly Latn script
if ('Latn' ~= script and 'latn' ~=not scripts_t[script)] then -- but a non-Latn script is specified
return cfg.text_script_match_test_t.latn_txt_mismatch; -- emit an error message
end
else -- when text is not wholly Latn script
if ('Latn' == script or 'latn' == scripts_t[script)] then -- but a Latn script is specified
return substitute (cfg.text_script_match_test_t.latn_scr_mismatch, {pos}); -- emit an error message with position of first offending character
end