ماڈیول:Lan
ظاہری ہیئت
| شاید آپ اس اسکریبنٹو ماڈیول کا دستاویزی صفحہ تخلیق کرنا چاہتے ہیں۔ صارفین ماڈیول کے تختہ مشق (تخلیق | آئینہ) اور ثابتات (تخلیق) میں تجربات کرسکتے ہیں۔ براہ کرم /دستاویز کے ذیلی صفحہ پر زمرہ جات شامل فرمائیں۔ اس ماڈیول کے ذیلی صفحات۔ |
local l = {}
function l._main ( args , frame )
local langCode = args[1] -- Expects the language code as the first argument (e.g., 'en', 'ar')
if not langCode then
return '' -- Return empty if no language code provided
end
-- Attempt to fetch the language name using MediaWiki's built-in function
-- This will return the name of the language (e.g., "English", "العربية") in the content language of the wiki (Urdu).
local langName = mw.language.fetchLanguageName( langCode, mw.getContentLanguage():getCode() )
-- Fallback to the language code itself if a name isn't found
return langName or langCode
end
function l.main ( frame )
local getArgs = require('Module:Arguments').getArgs
local args = getArgs( frame, { parentFirst = true } )
-- Pass the first unnamed argument (which should be the lang code) to _main
return l._main( { args[1] }, frame )
end
return l