Module

IsLatin

From Halal Explorer

[view] [edit] [history] [purge] Documentation

Example Usage

Text Code Result
Sports {{#invoke:IsLatin|IsLatin|Sports}} Lua error: Cannot create process: proc_open(/dev/null): Failed to open stream: Operation not permitted
Ştefăneşti {{#invoke:IsLatin|IsLatin|Ştefăneşti}} Lua error: Cannot create process: proc_open(/dev/null): Failed to open stream: Operation not permitted
大谷川ユースホステル {{#invoke:IsLatin|IsLatin|大谷川ユースホステル}} Lua error: Cannot create process: proc_open(/dev/null): Failed to open stream: Operation not permitted
€55 {{#invoke:IsLatin|IsLatin|€55}} Lua error: Cannot create process: proc_open(/dev/null): Failed to open stream: Operation not permitted
£55 {{#invoke:IsLatin|IsLatin|£55}} Lua error: Cannot create process: proc_open(/dev/null): Failed to open stream: Operation not permitted
$55 {{#invoke:IsLatin|IsLatin|$55}} Lua error: Cannot create process: proc_open(/dev/null): Failed to open stream: Operation not permitted

Script error: Lua error: Cannot create process: proc_open(/dev/null): Failed to open stream: Operation not permitted

local i = {}
 
function i.IsLatin(frame)
    local txt = frame.args[1];
    if txt == '' then
        return '';
    end
    
    local len = mw.ustring.len(txt);
    local pos = 1;
    while ( pos <= len ) do
        charval = mw.ustring.codepoint(mw.ustring.sub(txt, pos))
        -- note 8364 is the € symbol
        if charval>687 and charval~=8364 then
            return "no";
        end 
        pos = pos + 1;
    end
    return "yes";
end

return i;