Content deleted Content added
Created Crimean Tatar language module for {{crh}} |
added custom label param |
||
(4 intermediate revisions by the same user not shown) | |||
Line 4:
-- Errors
local err_category = {
['crh'] = '[[Category:crh template errors]]'
Line 17 ⟶ 13:
-- Helper function to parse boolean parameters
local function isFalse(value)
if value == "no" or value == "n" or value == "false" or value == "0" or value == "off" or value == "none" then
return true
else
return false
local function parseBoolean(value, default)
if value == nil then
Line 24 ⟶ 28:
if value == "yes" or value == "y" or value == "true" or value == "1" or value == "on" then
return true
elseif isFalse(value
return false
end
Line 53 ⟶ 57:
local link = parseBoolean(args["link"], true)
local lead = parseBoolean(args["lead"], true)
local label = args["label"]
local labelOnly = parseBoolean(args["label-only"], true)
▲ end
local output = {}
local parts = {}
if
if not isFalse(label) then
table.insert(output, "[[Crimean Tatar language|Crimean Tatar]]: ")▼
elseif lead and not link then▼
else▼
▲ table.insert(output, "Crimean Tatar: ")
end▼
elseif lead then
if link then
▲ table.insert(output, "[[Crimean Tatar language|Crimean Tatar]]: ")
else
table.insert(output, "Crimean Tatar: ")
end
end
--
-- do return end
table.insert(parts, "Latin: ''" .. latinText .. "''")▼
-- elseif lead and link then
▲ else
▲ end
-- table.insert(output, "Crimean Tatar: ")
-- end
if latinText then
if cyrillicText and not labelOnly and link then▼
local spannedLatin = "<span title=\"Crimean Tatar-language text\" lang=\"crh-Latn\">" .. latinText .. "</span>"
table.insert(parts, "[[Cyrillic script|Cyrillic]]: " .. cyrillicText)▼
table.insert(parts, "
elseif
table.insert(parts,
end
end
if
local spannedCyrillic = "<span title=\"Crimean Tatar-language text\" lang=\"crh-Cyrl\">" .. cyrillicText .. "</span>"
table.insert(parts, "[[Arabic script|Arabic]]: " .. arabicText)▼
table.insert(parts, "
elseif
table.insert(parts,
elseif cyrillicText and labelOnly then
▲ end
table.insert(parts, spannedCyrillic)
end
end
if arabicText then
local spannedArabic = "<span title=\"Crimean Tatar-language text\" lang=\"crh-Arab\" dir=\"rtl\">" .. arabicText .. "</span>"
elseif not labelOnly and not link then
elseif labelOnly then
table.insert(parts, spannedArabic)
end
end
if literalTranslation and link then
|