Մոդուլ:Wd/i18n

Վիքիբառարան-ից

Documentation for this module may be created at Մոդուլ:Wd/i18n/doc

-- The values and functions in this submodule should be localized per wiki.

-- load submodule "aliasesP" that lives next to this submodule
local aliasesP = mw.loadData((...):sub(1, (...):match('^.*()/') - 1).."/aliasesP")

local p = {
	["errors"] = {
		["unknown-data-type"]          = "Անհայտ կամ չաջակցված տվյալների շտեմարան «$1».",
		["missing-required-parameter"] = "Սահմանված պարամետրեր սահմանված չեն, առնվազն մեկի կարիքն ունի",
		["extra-required-parameter"]   = "«$1» պարամետրը պետք է սահմանվի որպես պարտադիր",
		["no-function-specified"]      = "Զանգահարելու համար դուք պետք է նշեք գործառույթ",  -- equal to the standard module error message
		["main-called-twice"]          = '«Հիմնական» գործառույթը չի կարելի երկու անգամ անվանել',
		["no-such-function"]           = '«$1» գործառույթը գոյություն չունի'  -- equal to the standard module error message
	},
	["info"] = {
		["edit-on-wikidata"] = "Խմբագրել սա Wikidata- ում"
	},
	["numeric"] = {
		["decimal-mark"] = ".",
		["delimiter"]    = ","
	},
	["datetime"] = {
		["prefixes"] = {
			["decade-period"] = ""
		},
		["suffixes"] = {
			["decade-period"] = "-ական թթ",
			["millennium"]    = " հազարամյակ",
			["century"]       = " դարում",
			["million-years"] = " միլիոն տարի",
			["billion-years"] = " միլիարդ տարի",
			["year"]          = " տարի",
			["years"]         = " տարիներ"
		},
		["julian-calendar"] = "Julուլյան օրացույց",  -- linked page title
		["julian"]          = "Julուլիան",
		["BCE"]             = "Մ.թ.ա.",
		["CE"]              = "Մ.թ.",
		["common-era"]      = "Ընդհանուր դարաշրջան"  -- linked page title
	},
	["coord"] = {
		["latitude-north"] = "Հյ",
		["latitude-south"] = "Հա",
		["longitude-east"] = "Արևե",
		["longitude-west"] = "Արևմ",
		["degrees"]        = "°",
		["minutes"]        = "'",
		["seconds"]        = '"',
		["separator"]      = ", "
	},
	["values"] = {
		["unknown"] = "անհայտ",
		["none"]    = "ոչ ոք"
	},
	["cite"] = {
		["version"] = "2",  -- increase this each time the below parameters are changed to avoid conflict errors
		["web"] = {
			-- <= left side: all allowed reference properties for *web page sources* per https://www.wikidata.org/wiki/Help:Sources
			-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite web]] (if non-existent, keep empty i.e. "")
			[aliasesP.statedIn]        = "կայք",
			[aliasesP.referenceURL]    = "url",
			[aliasesP.publicationDate] = "ամսաթվով",
			[aliasesP.retrieved]       = "մուտքի-ամսաթիվ",
			[aliasesP.title]           = "կոչում",
			[aliasesP.archiveURL]      = "արխիվ-ուրլ",
			[aliasesP.archiveDate]     = "արխիվ-ամսաթիվ",
			[aliasesP.language]        = "լեզու",
			[aliasesP.author]          = "հեղինակ",  -- existence of author1, author2, author3, etc. is assumed
			[aliasesP.publisher]       = "հրատարակիչ",
			[aliasesP.quote]           = "մեջբերում",
			[aliasesP.pages]           = "էջեր"  -- extra option
		},
		["q"] = {
			-- <= left side: all allowed reference properties for *sources other than web pages* per https://www.wikidata.org/wiki/Help:Sources
			-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite Q]] (if non-existent, keep empty i.e. "")
			[aliasesP.statedIn]                = "1",
			[aliasesP.pages]                   = "էջեր",
			[aliasesP.column]                  = "ժամը",
			[aliasesP.chapter]                 = "գլուխ",
			[aliasesP.sectionVerseOrParagraph] = "Բաժին",
			["external-id"]                    = "իդ",  -- used for any type of database property ID
			[aliasesP.title]                   = "կոչում",
			[aliasesP.publicationDate]         = "ամսաթվով",
			[aliasesP.retrieved]               = "մուտքի-ամսաթիվ"
		}
	}
}

function p.getOrdinalSuffix(num)
	if tostring(num):sub(-2,-2) == '1' then
		return "th"  -- 10th, 11th, 12th, 13th, ... 19th
	end
	
	num = tostring(num):sub(-1)
	
	if num == '1' then
		return "-ին"
	elseif num == '2' then
		return "-րդ"
	elseif num == '3' then
		return "-րդ"
	else
		return "-րդ"
	end
end

function p.addDelimiters(n)
	local left, num, right = string.match(n, "^([^%d]*%d)(%d*)(.-)$")
	
	if left and num and right then
		return left .. (num:reverse():gsub("(%d%d%d)", "%1" .. p['numeric']['delimiter']):reverse()) .. right
	else
		return n
	end
end

return p