Módulo:Languages

De Wikiviajes, la guía libre de viajes
Ir a la navegación Ir a la búsqueda
Icono de documentación de módulo Documentación del módulo[ver] [editar] [historial] [purgar]

Uso

This modul transforms the Wikidata qualifier into the ISO-639-1 language code and readable language name.

Arrays

  • id2code – ISO 639-1-Code of a Wikidata-Qualifier.
  • lngProps – provides an array with language information of an ISO 639-1-Code:
    • q: Language entity id
    • n: German name of the language
    • e: English name of the language
    • w: Writing entity id
    • s: Writing/script label
    • d: Direction if rtl (right-to-left)
    • c: Wikipedia edits in millions per 2018/7/1 as a measure of importance
Esta documentación está transcluida desde Módulo:Languages/doc.
Los editores pueden experimentar en la zona de pruebas (crear) y en los casos de prueba (crear) del módulo.
Por favor, añade las categorías en la subpágina de documentación. Subpáginas de este módulo.

-- using ISO 639-1 code of the languages

-- documentation
local Languages = {
	suite  = 'Languages',
	serial = '2021-04-09',
	item   = 65439949
}

-- array indexes:
-- q: Language entity id
-- w: Writing entity id
-- s: Writing/script label
-- c: Wikipedia edits in millions per 2018/7/1 as a measure of importance
--    from https://de.wikipedia.org/wiki/Wikipedia:Sprachen

-- module variable and administration
local lg = {
	moduleInterface = Languages
}

lg.id2code = {
	Q27811  = 'aa',
	Q5111   = 'ab',
	Q14196  = 'af',
	Q28026  = 'ak',
	Q28244  = 'am',
	Q8765   = 'an',
	Q13955  = 'ar',
	Q29401  = 'as',
	Q29561  = 'av',
	Q4627   = 'ay',
	Q9292   = 'az',
	Q13389  = 'ba',
	Q9091   = 'be',
	Q7918   = 'bg',
	Q35452  = 'bi',
	Q33243  = 'bm',
	Q9610   = 'bn',
	Q34271  = 'bo',
	Q12107  = 'br',
	Q9303   = 'bs',
	Q7026   = 'ca',
	Q33350  = 'ce',
	Q33262  = 'ch',
	Q33111  = 'co',
	Q33390  = 'cr',
	Q9056   = 'cs',
	Q33348  = 'cv',
	Q9309   = 'cy',
	Q9035   = 'da',
	Q188    = 'de',
	Q32656  = 'dv',
	Q33081  = 'dz',
	Q30005  = 'ee',
	Q36510  = 'el', -- Modern Greek
	Q9129   = 'el', -- Greek
	Q1860   = 'en',
	Q7979   = 'en-gb',
	Q7976   = 'en-us',
	Q143    = 'eo',
	Q1321   = 'es',
	Q9072   = 'et',
	Q8752   = 'eu',
	Q9168   = 'fa',
	Q33454  = 'ff',
	Q1412   = 'fi',
	Q33298  = 'fil',
	Q33295  = 'fj',
	Q25258  = 'fo',
	Q150    = 'fr',
	Q27175  = 'fy',
	Q9142   = 'ga',
	Q9314   = 'gd',
	Q9307   = 'gl',
	Q35876  = 'gn',
	Q5137   = 'gu',
	Q12175  = 'gv',
	Q56475  = 'ha',
	Q9288   = 'he',
	Q1568   = 'hi',
	Q33617  = 'ho',
	Q6654   = 'hr',
	Q33491  = 'ht',
	Q9067   = 'hu',
	Q8785   = 'hy',
	Q33315  = 'hz',
	Q9240   = 'id',
	Q33578  = 'ig',
	Q34235  = 'ii',
	Q27183  = 'ik',
	Q294    = 'is',
	Q652    = 'it',
	Q29921  = 'iu',
	Q5287   = 'ja',
	Q33549  = 'jv',
	Q8108   = 'ka',
	Q33702  = 'kg',
	Q33587  = 'ki',
	Q1405077 = 'kj',
	Q9252   = 'kk',
	Q25355  = 'kl',
	Q9205   = 'km',
	Q33673  = 'kn',
	Q9176   = 'ko',
	Q36094  = 'kr',
	Q33552  = 'ks',
	Q36368  = 'ku',
	Q36126  = 'kv',
	Q25289  = 'kw',
	Q9255   = 'ky',
	Q9051   = 'lb',
	Q33368  = 'lg',
	Q102172 = 'li',
	Q36217  = 'ln',
	Q9211   = 'lo',
	Q9083   = 'lt',
	Q36157  = 'lu',
	Q9078   = 'lv',
	Q7930   = 'mg',
	Q36280  = 'mh',
	Q36451  = 'mi',
	Q9296   = 'mk',
	Q36236  = 'ml',
	Q9246   = 'mn',
	Q36392  = 'mo',
	Q1571   = 'mr',
	Q9237   = 'ms',
	Q9166   = 'mt',
	Q20923490 = 'mul',
	Q9228   = 'my',
	Q13307  = 'na',
	Q25167  = 'nb',
	Q35613  = 'nd',
	Q33823  = 'ne',
	Q33900  = 'ng',
	Q7411   = 'nl',
	Q25164  = 'nn',
	Q9043   = 'no',
	Q36785  = 'nr',
	Q33273  = 'ny',
	Q14185  = 'oc',
	Q33875  = 'oj',
	Q33864  = 'om',
	Q33810  = 'or',
	Q33968  = 'os',
	Q58635  = 'pa',
	Q36727  = 'pi',
	Q809    = 'pl',
	Q58680  = 'ps',
	Q5146   = 'pt',
	Q13199  = 'rm',
	Q33583  = 'rn',
	Q7913   = 'ro',
	Q7737   = 'ru',
	Q33573  = 'rw',
	Q11059  = 'sa',
	Q33976  = 'sc',
	Q33997  = 'sd',
	Q33947  = 'se',
	Q33954  = 'sg',
	Q13267  = 'si',
	Q9058   = 'sk',
	Q9063   = 'sl',
	Q34011  = 'sm',
	Q34004  = 'sn',
	Q13275  = 'so',
	Q8748   = 'sq',
	Q9299   = 'sr',
	Q8821   = 'sr-me',
	Q34014  = 'ss',
	Q34340  = 'st',
	Q34002  = 'su',
	Q9027   = 'sv',
	Q7838   = 'sw',
	Q5885   = 'ta',
	Q8097   = 'te',
	Q9260   = 'tg',
	Q9217   = 'th',
	Q34124  = 'ti',
	Q9267   = 'tk',
	Q34097  = 'tkl',
	Q34057  = 'tl',
	Q34137  = 'tn',
	Q34094  = 'to',
	Q256    = 'tr',
	Q34327  = 'ts',
	Q25285  = 'tt',
	Q34055  = 'tvl',
	Q36850  = 'tw',
	Q34128  = 'ty',
	Q13263  = 'ug',
	Q8798   = 'uk',
	Q1617   = 'ur',
	Q9264   = 'uz',
	Q32704  = 've',
	Q9199   = 'vi',
	Q34219  = 'wa',
	Q34257  = 'wo',
	Q13218  = 'xh',
	Q8641   = 'yi',
	Q34311  = 'yo',
	Q13216  = 'za',
	Q7850   = 'zh', -- Chinese
	Q727694 = 'zh', -- Standard Chinese
	Q10179  = 'zu'
}

lg.lngProps = {
	aa = { q = 'Q27811', w = 'Q8229', s = 'Latin script' },
	ab = { q = 'Q5111', w = 'Q8209', s = 'Cyrillic script' },
	af = { q = 'Q14196', w = 'Q8229', s = 'Latin script' },
	ak = { q = 'Q28026', w = 'Q8229', s = 'Latin script' },
	am = { q = 'Q28244', w = 'Q257634', s = "Ge'ez script"},
	an = { q = 'Q8765', w = 'Q8229', s = 'Latin script' },
	ar = { q = 'Q13955', w = 'Q8196', s = 'Arabic alphabet', c = 29 },
	as = { q = 'Q29401', w = 'Q191272', s = 'Assamese alphabet' },
	av = { q = 'Q29561', w = 'Q8209', s = 'Cyrillic script' },
	ay = { q = 'Q4627', w = 'Q8229', s = 'Latin script' },
	az = { q = 'Q9292', w = 'Q8229', s = 'Latin script' },
	ba = { q = 'Q13389', w = 'Q8209', s = 'Cyrillic script' },
	be = { q = 'Q9091', w = 'Q8209', s = 'Cyrillic script' },
	bg = { q = 'Q7918', w = 'Q8209', s = 'Cyrillic script' },
	bi = { q = 'Q35452', w = 'Q8229', s = 'Latin script' },
	bm = { q = 'Q33243', w = 'Q8229', s = 'Latin script' },
	bn = { q = 'Q9610', w = 'Q756802', s = 'Bengali alphabet' },
	bo = { q = 'Q34271', w = 'Q46861', s = 'Tibetan alphabet' },
	br = { q = 'Q12107', w = 'Q8229', s = 'Latin script' },
	bs = { q = 'Q9303', w = 'Q8229', s = 'Latin script' },
	ca = { q = 'Q7026', w = 'Q8229', s = 'Latin script', c = 20 },
	ce = { q = 'Q33350', w = 'Q8209', s = 'Cyrillic script' },
	ch = { q = 'Q33262', w = 'Q8229', s = 'Latin script' },
	co = { q = 'Q33111', w = 'Q8229', s = 'Latin script' },
	cr = { q = 'Q33390', w = 'Q8229', s = 'Latin script' },
	cs = { q = 'Q9056', w = 'Q8229', s = 'Latin script' },
	cv = { q = 'Q33348', w = 'Q8209', s = 'Cyrillic script' },
	cy = { q = 'Q9309', w = 'Q8229', s = 'Latin script' },
	da = { q = 'Q9035', w = 'Q8229', s = 'Latin script' },
	de = { q = 'Q188', w = 'Q8229', s = 'Latin script', c = 178 },
	dv = { q = 'Q32656', w = 'Q877906', s = 'Thaana' },
	dz = { q = 'Q33081', w = 'Q46861', s = 'Tibetan alphabet' },
	ee = { q = 'Q30005', w = 'Q8229', s = 'Latin script' },
	el = { q = 'Q9129', w = 'Q8216', s = 'Greek alphabet' },
	en = { q = 'Q1860', w = 'Q8229', s = 'Latin script', c = 844 },
	['en-gb'] = { q = 'Q7979', w = 'Q8229', s = 'Latin script' },
	['en-us'] = { q = 'Q7976', w = 'Q8229', s = 'Latin script' },
	eo = { q = 'Q143', w = 'Q8229', s = 'Latin script', c = 1 },
	es = { q = 'Q1321', w = 'Q8229', s = 'Latin script', c = 109 },
	et = { q = 'Q9072', w = 'Q8229', s = 'Latin script' },
	eu = { q = 'Q8752', w = 'Q8229', s = 'Latin script' },
	fa = { q = 'Q9168', w = 'Q8196', s = 'Arabic alphabet', c = 24 },
	ff = { q = 'Q33454', w = 'Q8229', s = 'Latin script' },
	fi = { q = 'Q1412', w = 'Q8229', s = 'Latin script' },
	fil = { q = 'Q33298', w = 'Q8229', s = 'Latin script' },
	fj = { q = 'Q33295', w = 'Q8229', s = 'Latin script' },
	fo = { q = 'Q25258', w = 'Q8229', s = 'Latin script' },
	fr = { q = 'Q150', w = 'Q8229', s = 'Latin script', c = 150 },
	fy = { q = 'Q27175', w = 'Q8229', s = 'Latin script' },
	ga = { q = 'Q9142', w = 'Q8229', s = 'Latin script' },
	gd = { q = 'Q9314', w = 'Q8229', s = 'Latin script' },
	gl = { q = 'Q9307', w = 'Q8229', s = 'Latin script' },
	gn = { q = 'Q35876', w = 'Q8229', s = 'Latin script' },
	gu = { q = 'Q5137', w = 'Q733944', s = 'Gujarati alphabet' },
	gv = { q = 'Q12175', w = 'Q8229', s = 'Latin script' },
	ha = { q = 'Q56475', w = 'Q8229', s = 'Latin script' },
	he = { q = 'Q9288', w = 'Q33513', s = 'Hebrew alphabet' },
	hi = { q = 'Q1568', w = 'Q38592', s = 'Devanagari' },
	ho = { q = 'Q33617', w = 'Q8229', s = 'Latin script' },
	hr = { q = 'Q6654', w = 'Q8229', s = 'Latin script' },
	ht = { q = 'Q33491', w = 'Q8229', s = 'Latin script' },
	hu = { q = 'Q9067', w = 'Q8229', s = 'Latin script' },
	hy = { q = 'Q8785', w = 'Q11932', s = 'Armenian alphabet' },
	hz = { q = 'Q33315', w = 'Q8229', s = 'Latin script' },
	id = { q = 'Q9240', w = 'Q8229', s = 'Latin script' },
	ig = { q = 'Q33578', w = 'Q8229', s = 'Latin script' },
	ii = { q = 'Q34235', w = 'Q1197646', s = 'Yi script' },
	ik = { q = 'Q27183', w = 'Q8229', s = 'Latin script' },
	is = { q = 'Q294', w = 'Q8229', s = 'Latin script' },
	it = { q = 'Q652', w = 'Q8229', s = 'Latin script', c = 98 },
	iu = { q = 'Q29921', w = 'Q2274646', s = 'Inuktitut syllabics' },
	ja = { q = 'Q5287', w = 'Q82772', s = 'Kanji', c = 69 },
	jv = { q = 'Q33549', w = 'Q8229', s = 'Latin script' },
	ka = { q = 'Q8108', w = 'Q161428', s = 'Georgian alphabet' },
	kg = { q = 'Q33702', w = 'Q8229', s = 'Latin script' },
	ki = { q = 'Q33587', w = 'Q8229', s = 'Latin script' },
	kj = { q = 'Q1405077', w = 'Q8229', s = 'Latin script' },
	kk = { q = 'Q9252', w = 'Q8209', s = 'Cyrillic script' },
	kl = { q = 'Q25355', w = 'Q8229', s = 'Latin script' },
	km = { q = 'Q9205', w = 'Q1054190', s = 'Khmer alphabet' },
	kn = { q = 'Q33673', w = 'Q839666', s = 'Kannada alphabet' },
	ko = { q = 'Q9176', w = 'Q8222', s = 'Hangul' },
	kr = { q = 'Q36094', w = 'Q8229', s = 'Latin script' },
	ks = { q = 'Q33552', w = 'Q38592', s = 'Devanagari' },
	ku = { q = 'Q36368', w = 'Q8229', s = 'Latin script' },
	kv = { q = 'Q36126', w = 'Q8209', s = 'Cyrillic script' },
	kw = { q = 'Q25289', w = 'Q8229', s = 'Latin script' },
	ky = { q = 'Q9255', w = 'Q8209', s = 'Cyrillic script' },
	lb = { q = 'Q9051', w = 'Q8229', s = 'Latin script' },
	lg = { q = 'Q33368', w = 'Q8229', s = 'Latin script' },
	li = { q = 'Q102172', w = 'Q8229', s = 'Latin script' },
	ln = { q = 'Q36217', w = 'Q8229', s = 'Latin script' },
	lo = { q = 'Q9211', w = 'Q1815229', s = 'Lao alphabet' },
	lt = { q = 'Q9083', w = 'Q8229', s = 'Latin script' },
	lu = { q = 'Q36157', w = 'Q8229', s = 'Latin script' },
	lv = { q = 'Q9078', w = 'Q8229', s = 'Latin script' },
	mg = { q = 'Q7930', w = 'Q8229', s = 'Latin script' },
	mh = { q = 'Q36280', w = 'Q8229', s = 'Latin script' },
	mi = { q = 'Q36451', w = 'Q8229', s = 'Latin script' },
	mk = { q = 'Q9296', w = 'Q8209', s = 'Cyrillic script' },
	ml = { q = 'Q36236', w = 'Q1164129', s = 'Malayalam script' },
	mn = { q = 'Q9246', w = 'Q8209', s = 'Cyrillic script' },
	mo = { q = 'Q36392', w = 'Q8229', s = 'Latin script' },
	mr = { q = 'Q1571', w = 'Q38592', s = 'Devanagari' },
	ms = { q = 'Q9237', w = 'Q8229', s = 'Latin script' },
	mt = { q = 'Q9166', w = 'Q8229', s = 'Latin script' },
	mul = { q = 'Q20923490', w = 'Q8229', s = 'Latin script' },
	my = { q = 'Q9228', w = 'Q854968', s = 'Burmese alphabet' },
	na = { q = 'Q13307', w = 'Q8229', s = 'Latin script' },
	nb = { q = 'Q25167', w = 'Q8229', s = 'Latin script' },
	nd = { q = 'Q35613', w = 'Q8229', s = 'Latin script' },
	ne = { q = 'Q33823', w = 'Q38592', s = 'Devanagari' },
	ng = { q = 'Q33900', w = 'Q8229', s = 'Latin script' },
	nl = { q = 'Q7411', w = 'Q8229', s = 'Latin script', c = 52 },
	nn = { q = 'Q25164', w = 'Q8229', s = 'Latin script' },
	no = { q = 'Q9043', w = 'Q8229', s = 'Latin script' },
	nr = { q = 'Q36785', w = 'Q8229', s = 'Latin script' },
	ny = { q = 'Q33273', w = 'Q8229', s = 'Latin script' },
	oc = { q = 'Q14185', w = 'Q8229', s = 'Latin script' },
	oj = { q = 'Q33875', w = 'Q8229', s = 'Latin script' },
	om = { q = 'Q33864', w = 'Q8229', s = 'Latin script' },
	['or'] = { q = 'Q33810', w = 'Q1760127', s = 'Odia alphabet' },
	['os'] = { q = 'Q33968', w = 'Q8209', s = 'Cyrillic script' },
	pa = { q = 'Q58635', w = 'Q38592', s = 'Devanagari' },
	pi = { q = 'Q36727', w = 'Q185083', s = 'Brahmi script' },
	pl = { q = 'Q809', w = 'Q8229', s = 'Latin script', c = 54 },
	ps = { q = 'Q58680', w = 'Q8196', s = 'Arabic alphabet' },
	pt = { q = 'Q5146', w = 'Q8229', s = 'Latin script', c = 52 },
	rm = { q = 'Q13199', w = 'Q8229', s = 'Latin script' },
	rn = { q = 'Q33583', w = 'Q8229', s = 'Latin script' },
	ro = { q = 'Q7913', w = 'Q8229', s = 'Latin script' },
	ru = { q = 'Q7737', w = 'Q8209', s = 'Cyrillic script', c = 93 },
	rw = { q = 'Q33573', w = 'Q8229', s = 'Latin script' },
	sa = { q = 'Q11059', w = 'Q38592', s = 'Devanagari' },
	sc = { q = 'Q33976', w = 'Q8229', s = 'Latin script' },
	sd = { q = 'Q33997', w = 'Q8196', s = 'Arabic alphabet' },
	se = { q = 'Q33947', w = 'Q8229', s = 'Latin script' },
	sg = { q = 'Q33954', w = 'Q8229', s = 'Latin script' },
	si = { q = 'Q13267', w = 'Q1574992', s = 'Sinhala script' },
	sk = { q = 'Q9058', w = 'Q8229', s = 'Latin script' },
	sl = { q = 'Q9063', w = 'Q8229', s = 'Latin script' },
	sm = { q = 'Q34011', w = 'Q8229', s = 'Latin script' },
	sn = { q = 'Q34004', w = 'Q8229', s = 'Latin script' },
	so = { q = 'Q13275', w = 'Q8229', s = 'Latin script' },
	sq = { q = 'Q8748', w = 'Q8229', s = 'Latin script' },
	sr = { q = 'Q9299', w = 'Q8209', s = 'Cyrillic script', c = 21 },
	['sr-me'] = { q = 'Q8821', w = 'Q8209', s = 'Cyrillic script' },
	ss = { q = 'Q34014', w = 'Q8229', s = 'Latin script' },
	st = { q = 'Q34340', w = 'Q8229', s = 'Latin script' },
	su = { q = 'Q34002', w = 'Q8229', s = 'Latin script' },
	sv = { q = 'Q9027', w = 'Q8229', s = 'Latin script', c = 43 },
	sw = { q = 'Q7838', w = 'Q8229', s = 'Latin script' },
	ta = { q = 'Q5885', w = 'Q26803', s = 'Tamil script' },
	te = { q = 'Q8097', w = 'Q570450', s = 'Telugu script' },
	tg = { q = 'Q9260', w = 'Q8209', s = 'Cyrillic script' },
	th = { q = 'Q9217', w = 'Q236376', s = 'Thai alphabet' },
	ti = { q = 'Q34124', w = 'Q257634', s = "Ge'ez script" },
	tk = { q = 'Q9267', w = 'Q8229', s = 'Latin script' },
	tkl = { q = 'Q34097', w = 'Q8229', s = 'Latin script' },
	tl = { q = 'Q34057', w = 'Q8229', s = 'Latin script' },
	tn = { q = 'Q34137', w = 'Q8229', s = 'Latin script' },
	to = { q = 'Q34094', w = 'Q8229', s = 'Latin script' },
	tr = { q = 'Q256', w = 'Q8229', s = 'Latin script' },
	ts = { q = 'Q34327', w = 'Q8229', s = 'Latin script' },
	tt = { q = 'Q25285', w = 'Q8209', s = 'Cyrillic script' },
	tvl = { q = 'Q34055', w = 'Q8229', s = 'Latin script' },
	tw = { q = 'Q36850', w = 'Q8229', s = 'Latin script' },
	ty = { q = 'Q34128', w = 'Q8229', s = 'Latin script' },
	ug = { q = 'Q13263', w = 'Q8196', s = 'Arabic alphabet' },
	uk = { q = 'Q8798', w = 'Q8209', s = 'Cyrillic script', c = 23 },
	ur = { q = 'Q1617', w = 'Q8196', s = 'Arabic alphabet' },
	uz = { q = 'Q9264', w = 'Q8229', s = 'Latin script' },
	ve = { q = 'Q32704', w = 'Q8229', s = 'Latin script' },
	vi = { q = 'Q9199', w = 'Q8229', s = 'Latin script', c = 41 },
	wa = { q = 'Q34219', w = 'Q8229', s = 'Latin script' },
	wo = { q = 'Q34257', w = 'Q8229', s = 'Latin script' },
	xh = { q = 'Q13218', w = 'Q33513', s = 'Hebrew alphabet' },
	yi = { q = 'Q8641', w = 'Q8229', s = 'Latin script' },
	yo = { q = 'Q34311', w = 'Q8229', s = 'Latin script' },
	za = { q = 'Q13216', w = 'Q8229', s = 'Latin script' },
	zh = { q = 'Q7850', w = 'Q8201', s = 'Chinese characters', c = 50 },
	zu = { q = 'Q10179', w = 'Q8229', s = 'Latin script'}
}

function lg.getProperty( lng, p )
	if not lng or lng == '' or not p or p == '' then
		return ''
	end

	local item = lg.lngProps[ lng ]
	if not item then
		local hyphen = lng:find( '-' )
		if not hyphen or hyphen == 1 then
			return ''
		else
			item = lg.lngProps[ lng:sub( 1, hyphen - 1 ) ]
			if not item then
				return ''
			end
		end
	end
	if p == 'c' then
		return item[ p ] or 0
	else
		return item[ p ] or ''
	end
end

return lg