Actions

Module

language: Difference between revisions

From SUALEX

No edit summary
No edit summary
 
Line 22: Line 22:


     if plain then
     if plain then
         return info.display
         return info.plain
     end
     end



Latest revision as of 00:00, 31 January 2026

Documentation for this module may be created at Module:language/doc

-- Module:language

local p = {}

local format    = require("Module:format")
local languages = require("Module:languages")

function p.invoke(frame)
    local args = frame.args or {}
    local lang_param = args[1]

    if not lang_param or lang_param == "" then
        return ""
    end

    local info = languages.get_name_and_display(lang_param)
    if not info then
        return ""
    end

    local plain = args.plain or args[2]

    if plain then
        return info.plain
    end

    return format.language_name(info)
end

return p