יחידה:שפת קישור: הבדלים בין גרסאות בדף

מתוך חב"דציטוט, מאגר ציטוטים חב"דים חופשי.
קפיצה לניווט קפיצה לחיפוש
(מקור: https://he.wikipedia.org/w/index.php?title=%D7%99%D7%97%D7%99%D7%93%D7%94:%D7%A9%D7%A4%D7%AA_%D7%A7%D7%99%D7%A9%D7%95%D7%A8&action=history)
מ (גרסה אחת יובאה)
 
(אין הבדלים)

גרסה אחרונה מ־00:08, 27 ביוני 2024

ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:שפת קישור/תיעוד

local Arguments = require( "Module:Arguments" )

local function getLocalLangNameWithPrefix(langCodeOrLocalName)
	local localName = langCodeOrLocalName

	if not mw.ustring.match(langCodeOrLocalName, '[א-ת]+') then
		-- tanslate
		if langCodeOrLocalName == 'iw' then -- legacy code for modern hebrew
			localName = 'עברית'
		else
			localName = mw.language.fetchLanguageName(langCodeOrLocalName, 'he')
		end
	end
	
	-- add prefix
	if  mw.ustring.match(localName, '[א-ת]+') then
		return 'ב' .. localName
	else
		return 'ב־' .. localName
	end
end

local function render(frame)
    local args = Arguments.getArgs(frame, { ['trim'] = true, ['removeBlanks'] = true })
    local langs = {}
    for _, v in pairs(args) do
        table.insert(langs, getLocalLangNameWithPrefix(v))
    end
    
    if #langs == 0 then
        table.insert(langs, 'ב{{{שפה}}}')
    end
    
    -- הסרנו את החלק הזה:
    -- local templatestyles = frame:extensionTag{
    --     name = 'templatestyles', args = { src = 'יחידה:שפת קישור/styles.css' }
    -- }
    
    -- שינינו את השורה הזו כדי להסיר את templatestyles
    local res = '<span dir="rtl" class="languageicon">('.. mw.text.listToText( langs, ', ', ' ו' )  .. ')</span>'
    return res
end

return  {
    ['שפת קישור']=render
}