Merge branch 'feature/language-chooser'

This commit is contained in:
pietervdvn 2022-06-24 16:55:01 +02:00
commit 2a0d4a1e54
4 changed files with 1660 additions and 4 deletions

View file

@ -0,0 +1,721 @@
{
"AD": [
"ca"
],
"AE": [
"ar"
],
"AF": [
"uz",
"tk",
"ar",
"ps"
],
"AG": [
"en",
"en"
],
"AL": [
"sq"
],
"AM": [
"hy"
],
"AO": [
"pt"
],
"AR": [
"es"
],
"AT": [
"de"
],
"AU": [
"en",
"en"
],
"AZ": [
"az"
],
"BA": [
"hr",
"sr",
"bs"
],
"BB": [
"en"
],
"BD": [
"bn"
],
"BE": [
"fr",
"de",
"nl"
],
"BF": [
"fr"
],
"BG": [
"bg"
],
"BH": [
"ar"
],
"BI": [
"fr",
"en",
"rn"
],
"BJ": [
"fr"
],
"BN": [
"en",
"ms"
],
"BO": [
"es",
"ay",
"qu",
"gn"
],
"BR": [
"pt"
],
"BS": [
"en",
"en"
],
"BT": [
"dz",
"dz"
],
"BW": [
"en"
],
"BY": [
"ru",
"be"
],
"BZ": [
"en"
],
"CA": [
"fr",
"en"
],
"CD": [
"fr"
],
"CF": [
"fr",
"sg"
],
"CG": [
"fr"
],
"CH": [
"fr",
"de",
"it",
"rm"
],
"CI": [
"fr"
],
"CL": [
"es"
],
"CM": [
"fr",
"en"
],
"CN": [
"zh"
],
"CO": [
"es"
],
"CR": [
"es"
],
"CU": [
"es"
],
"CV": [
"pt"
],
"CY": [
"tr",
"el"
],
"CZ": [
"cs"
],
"DE": [
"de",
"de"
],
"DJ": [
"fr",
"ar"
],
"DK": [
"da",
"da"
],
"DM": [
"en"
],
"DO": [
"es"
],
"DZ": [
"ar",
"ar"
],
"EC": [
"es"
],
"EE": [
"et",
"et"
],
"EG": [
"ar",
"ar"
],
"ER": [
"en",
"ar",
"ti"
],
"ES": [
"es"
],
"ET": [
"am"
],
"FI": [
"fi",
"sv",
"fi",
"sv"
],
"FJ": [
"en",
"fj"
],
"FM": [
"en"
],
"FR": [
"fr",
"fr"
],
"GA": [
"fr"
],
"GB": [
"en",
"en",
"en"
],
"GD": [
"en",
"en"
],
"GE": [
"ab",
"ka"
],
"GH": [
"en"
],
"GI": [
"en"
],
"GM": [
"en"
],
"GN": [
"fr"
],
"GQ": [
"fr",
"es",
"pt"
],
"GT": [
"es"
],
"GW": [
"pt"
],
"GY": [
"en"
],
"HN": [
"es"
],
"HR": [
"hr",
"hr"
],
"HT": [
"fr",
"ht"
],
"HU": [
"hu"
],
"ID": [
"id",
"jv"
],
"IE": [
"en",
"ga"
],
"IL": [
"he",
"he"
],
"IN": [
"hi",
"en"
],
"IQ": [
"ar",
"ku"
],
"IR": [
"fa"
],
"IS": [
"is"
],
"IT": [
"it"
],
"JM": [
"en",
"en"
],
"JO": [
"ar"
],
"JP": [
"ja"
],
"KE": [
"en",
"sw"
],
"KG": [
"ru",
"ky"
],
"KH": [
"km"
],
"KI": [
"en"
],
"KM": [
"fr",
"ar"
],
"KN": [
"en",
"en"
],
"KP": [
"ko",
"ko"
],
"KR": [
"ko"
],
"KW": [
"ar"
],
"KZ": [
"ru",
"kk"
],
"LA": [
"lo"
],
"LB": [
"ar",
"ar"
],
"LC": [
"en",
"en"
],
"LI": [
"de"
],
"LK": [
"ta",
"si"
],
"LR": [
"en"
],
"LS": [
"en",
"st"
],
"LT": [
"lt",
"lt"
],
"LU": [
"fr",
"de",
"lb"
],
"LV": [
"lv",
"lv"
],
"LY": [
"ar",
"ar"
],
"MA": [
"ar",
"ar"
],
"MC": [
"fr"
],
"MD": [
"ro"
],
"MG": [
"fr",
"mg"
],
"MH": [
"en",
"mh"
],
"MK": [
"sq",
"mk"
],
"ML": [
"fr"
],
"MM": [
"my"
],
"MN": [
"mn"
],
"MR": [
"ar"
],
"MT": [
"en",
"mt"
],
"MU": [
"fr",
"en"
],
"MV": [
"dv"
],
"MW": [
"en",
"ny"
],
"MX": [
"es",
"es"
],
"MY": [
"ms"
],
"MZ": [
"pt"
],
"NA": [
"en"
],
"NE": [
"fr"
],
"NG": [
"en",
"yo"
],
"NI": [
"es"
],
"NL": [
"nl",
"nl"
],
"NO": [
"no",
"nn",
"nb"
],
"NP": [
"ne"
],
"NR": [
"en",
"na"
],
"NZ": [
"en",
"mi",
"en",
"mi"
],
"OM": [
"ar"
],
"PA": [
"es"
],
"PE": [
"es",
"ay",
"qu"
],
"PG": [
"en",
"ho",
"en",
"ho"
],
"PH": [
"en"
],
"PK": [
"ur",
"en",
"ar"
],
"PL": [
"pl",
"pl"
],
"PS": [
"ar"
],
"PT": [
"pt",
"pt"
],
"PW": [
"en",
"ja"
],
"PY": [
"es",
"gn"
],
"QA": [
"ar"
],
"RO": [
"ro"
],
"RS": [
"sr"
],
"RU": [
"ru"
],
"RW": [
"fr",
"en",
"sw",
"rw"
],
"SA": [
"ar"
],
"SB": [
"en",
"en"
],
"SC": [
"fr",
"en"
],
"SD": [
"en",
"ar"
],
"SE": [
"sv",
"sv"
],
"SG": [
"en",
"ta",
"ms"
],
"SI": [
"sl",
"sl"
],
"SK": [
"sk"
],
"SL": [
"en"
],
"SM": [
"it"
],
"SN": [
"fr",
"wo"
],
"SO": [
"so",
"ar"
],
"SR": [
"nl"
],
"SS": [
"en",
"ar"
],
"ST": [
"pt"
],
"SV": [
"es"
],
"SY": [
"ar",
"ar"
],
"SZ": [
"en",
"ss"
],
"TD": [
"fr",
"ar"
],
"TG": [
"fr"
],
"TH": [
"th"
],
"TJ": [
"ru",
"tg"
],
"TL": [
"pt"
],
"TM": [
"tk"
],
"TN": [
"ar",
"ar"
],
"TO": [
"en",
"to"
],
"TR": [
"tr",
"tr"
],
"TT": [
"en"
],
"TV": [
"en",
"en"
],
"TZ": [
"en",
"sw"
],
"UA": [
"uk"
],
"UG": [
"en",
"sw"
],
"UY": [
"es"
],
"UZ": [
"uz"
],
"VA": [
"fr",
"la",
"it"
],
"VC": [
"en",
"en"
],
"VE": [
"es"
],
"VN": [
"vi"
],
"VU": [
"fr",
"en",
"bi"
],
"WS": [
"en",
"sm"
],
"YE": [
"ar"
],
"ZA": [
"af",
"ve",
"ss",
"tn",
"ts",
"st",
"nr",
"en",
"zu",
"xh"
],
"ZM": [
"en"
],
"ZW": [
"en",
"xh",
"ve",
"ny",
"sn",
"tn",
"ts",
"st",
"nd"
]
}

View file

@ -0,0 +1,864 @@
{
"id": "language",
"description": "Various tagRenderings to help language tooling",
"tagRenderings": {
"id": "official-language",
"mappings": [
{
"if": "language=ca",
"then": {
"ca": "català",
"da": "catalansk",
"de": "Katalanisch",
"en": "Catalan",
"eo": "kataluna lingvo",
"es": "catalán",
"fi": "katalaani",
"fr": "catalan",
"gl": "lingua catalá",
"hu": "katalán",
"id": "Bahasa Katala",
"it": "catalano",
"ja": "カタルーニャ語",
"nb_NO": "katalansk",
"nl": "Catalaans",
"pl": "język kataloński",
"pt": "língua catalã",
"pt_BR": "língua catalã",
"ru": "каталанский язык",
"sl": "Katalonščina",
"sv": "katalanska",
"zh_Hans": "加泰罗尼亚语",
"zh_Hant": "加泰隆尼亞語"
},
"hideInAnswer": "_country=ad"
},
{
"if": "language=ar",
"hideInAnswer": "_country=ae|af|bh|dj|dz|eg|er|iq|jo|km|kw|lb|ly|ma|mr|om|pk|ps|qa|sa|sd|so|ss|sy|td|tn|ye"
},
{
"if": "language=uz",
"hideInAnswer": "_country=af|uz"
},
{
"if": "language=tk",
"hideInAnswer": "_country=af|tm"
},
{
"if": "language=ps",
"hideInAnswer": "_country=af"
},
{
"if": "language=en",
"then": {
"ca": "anglès",
"da": "engelsk",
"de": "Englisch",
"en": "English",
"eo": "angla lingvo",
"es": "inglés",
"fi": "englanti",
"fr": "anglais",
"gl": "lingua inglesa",
"hu": "angol",
"id": "Inggris",
"it": "inglese",
"ja": "英語",
"nb_NO": "engelsk",
"nl": "Engels",
"pl": "język angielski",
"pt": "inglês",
"pt_BR": "inglês",
"ru": "английский язык",
"sl": "angleščina",
"sv": "engelska",
"zh_Hans": "英语",
"zh_Hant": "英語"
},
"hideInAnswer": "_country=ag|au|bb|bi|bn|bs|bw|bz|ca|cm|dm|er|fj|fm|gb|gd|gh|gi|gm|gy|ie|in|jm|ke|ki|kn|lc|lr|ls|mh|mt|mu|mw|na|ng|nr|nz|pg|ph|pk|pw|rw|sb|sc|sd|sg|sl|ss|sz|to|tt|tv|tz|ug|vc|vu|ws|za|zm|zw"
},
{
"if": "language=sq",
"hideInAnswer": "_country=al|mk"
},
{
"if": "language=hy",
"hideInAnswer": "_country=am"
},
{
"if": "language=pt",
"then": {
"ca": "portuguès",
"da": "portugisisk",
"de": "Portugiesisch",
"en": "Portuguese",
"eo": "portugala lingvo",
"es": "portugués",
"fi": "portugali",
"fr": "portugais",
"gl": "lingua portuguesa",
"hu": "portugál",
"id": "Portugis",
"it": "portoghese",
"ja": "ポルトガル語",
"nb_NO": "portugisisk",
"nl": "Portugees",
"pl": "język portugalski",
"pt": "português",
"pt_BR": "português",
"ru": "португальский язык",
"sl": "portugalščina",
"sv": "portugisiska",
"zh_Hans": "葡萄牙语",
"zh_Hant": "葡萄牙語"
},
"hideInAnswer": "_country=ao|br|cv|gq|gw|mz|pt|st|tl"
},
{
"if": "language=es",
"then": {
"ca": "castellà",
"da": "spansk",
"de": "Spanisch",
"en": "Spanish",
"eo": "hispana lingvo",
"es": "español",
"fi": "espanja",
"fr": "espagnol",
"gl": "lingua castelá",
"hu": "spanyol",
"id": "Spanyol",
"it": "spagnolo",
"ja": "スペイン語",
"nb_NO": "spansk",
"nl": "Spaans",
"pl": "język hiszpański",
"pt": "espanhol",
"pt_BR": "espanhol",
"ru": "испанский язык",
"sl": "španščina",
"sv": "spanska",
"zh_Hans": "西班牙语",
"zh_Hant": "西班牙語"
},
"hideInAnswer": "_country=ar|bo|cl|co|cr|cu|do|ec|es|gq|gt|hn|mx|ni|pa|pe|py|sv|uy|ve"
},
{
"if": "language=de",
"then": {
"ca": "alemany",
"da": "tysk",
"de": "Deutsch",
"en": "German",
"eo": "germana lingvo",
"es": "alemán",
"fi": "saksa",
"fr": "allemand",
"gl": "lingua alemá",
"hu": "német",
"id": "Jerman",
"it": "tedesco",
"ja": "ドイツ語",
"nb_NO": "tysk",
"nl": "Duits",
"pl": "język niemiecki",
"pt": "alemão",
"pt_BR": "alemão",
"ru": "немецкий язык",
"sl": "nemščina",
"sv": "tyska",
"zh_Hans": "德语",
"zh_Hant": "德語"
},
"hideInAnswer": "_country=at|be|ch|de|li|lu"
},
{
"if": "language=az",
"hideInAnswer": "_country=az"
},
{
"if": "language=hr",
"hideInAnswer": "_country=ba|hr"
},
{
"if": "language=sr",
"hideInAnswer": "_country=ba|rs"
},
{
"if": "language=bs",
"hideInAnswer": "_country=ba"
},
{
"if": "language=bn",
"hideInAnswer": "_country=bd"
},
{
"if": "language=fr",
"then": {
"ca": "francès",
"da": "fransk",
"de": "Französisch",
"en": "French",
"eo": "franca lingvo",
"es": "francés",
"fi": "ranska",
"fr": "français",
"gl": "lingua francesa",
"hu": "francia",
"id": "Prancis",
"it": "francese",
"ja": "フランス語",
"nb_NO": "fransk",
"nl": "Frans",
"pl": "język francuski",
"pt": "francês",
"pt_BR": "francês",
"ru": "французский язык",
"sl": "francoščina",
"sv": "franska",
"zh_Hans": "法语",
"zh_Hant": "法語"
},
"hideInAnswer": "_country=be|bf|bi|bj|ca|cd|cf|cg|ch|ci|cm|dj|fr|ga|gn|gq|ht|km|lu|mc|mg|ml|mu|ne|rw|sc|sn|td|tg|va|vu"
},
{
"if": "language=nl",
"then": {
"ca": "neerlandès",
"da": "nederlandsk",
"de": "Niederländisch",
"en": "Dutch",
"eo": "nederlanda lingvo",
"es": "neerlandés",
"fi": "hollanti",
"fr": "néerlandais",
"gl": "lingua neerlandesa",
"hu": "holland",
"id": "Belanda",
"it": "olandese",
"ja": "オランダ語",
"nb_NO": "nederlandsk",
"nl": "Nederlands",
"pl": "język niderlandzki",
"pt": "neerlandês",
"pt_BR": "neerlandês",
"ru": "нидерландский язык",
"sl": "Nizozemščina",
"sv": "nederländska",
"zh_Hans": "荷兰语",
"zh_Hant": "荷蘭語"
},
"hideInAnswer": "_country=be|nl|sr"
},
{
"if": "language=bg",
"hideInAnswer": "_country=bg"
},
{
"if": "language=rn",
"hideInAnswer": "_country=bi"
},
{
"if": "language=ms",
"hideInAnswer": "_country=bn|my|sg"
},
{
"if": "language=ay",
"hideInAnswer": "_country=bo|pe"
},
{
"if": "language=qu",
"hideInAnswer": "_country=bo|pe"
},
{
"if": "language=gn",
"hideInAnswer": "_country=bo|py"
},
{
"if": "language=dz",
"hideInAnswer": "_country=bt"
},
{
"if": "language=ru",
"then": {
"ca": "rus",
"da": "russisk",
"de": "Russisch",
"en": "Russian",
"eo": "rusa lingvo",
"es": "ruso",
"fi": "venäjä",
"fr": "russe",
"gl": "lingua rusa",
"hu": "orosz",
"id": "Rusia",
"it": "russo",
"ja": "ロシア語",
"nb_NO": "russisk",
"nl": "Russisch",
"pl": "język rosyjski",
"pt": "russo",
"pt_BR": "russo",
"ru": "русский язык",
"sl": "ruščina",
"sv": "ryska",
"zh_Hans": "俄语",
"zh_Hant": "俄語"
},
"hideInAnswer": "_country=by|kg|kz|ru|tj"
},
{
"if": "language=be",
"hideInAnswer": "_country=by"
},
{
"if": "language=sg",
"hideInAnswer": "_country=cf"
},
{
"if": "language=it",
"then": {
"ca": "italià",
"da": "italiensk",
"de": "Italienisch",
"en": "Italian",
"eo": "itala lingvo",
"es": "italiano",
"fi": "italia",
"fr": "italien",
"gl": "lingua italiana",
"hu": "olasz",
"id": "Italia",
"it": "italiano",
"ja": "イタリア語",
"nb_NO": "italiensk",
"nl": "Italiaans",
"pl": "język włoski",
"pt": "italiano",
"pt_BR": "língua italiana",
"ru": "итальянский язык",
"sl": "italijanščina",
"sv": "italienska",
"zh_Hans": "意大利语",
"zh_Hant": "義大利語"
},
"hideInAnswer": "_country=ch|it|sm|va"
},
{
"if": "language=rm",
"hideInAnswer": "_country=ch"
},
{
"if": "language=zh",
"hideInAnswer": "_country=cn"
},
{
"if": "language=tr",
"hideInAnswer": "_country=cy|tr"
},
{
"if": "language=el",
"hideInAnswer": "_country=cy"
},
{
"if": "language=cs",
"hideInAnswer": "_country=cz"
},
{
"if": "language=da",
"then": {
"ca": "danès",
"da": "dansk",
"de": "Dänisch",
"en": "Danish",
"eo": "dana lingvo",
"es": "danés",
"fi": "tanska",
"fr": "danois",
"gl": "lingua dinamarquesa",
"hu": "dán",
"id": "Bahasa Denmark",
"it": "danese",
"ja": "デンマーク語",
"nb_NO": "dansk",
"nl": "Deens",
"pl": "język duński",
"pt": "dinamarquês",
"pt_BR": "dinamarquês",
"ru": "датский язык",
"sl": "Danščina",
"sv": "danska",
"zh_Hans": "丹麦语",
"zh_Hant": "丹麥語"
},
"hideInAnswer": "_country=dk"
},
{
"if": "language=et",
"hideInAnswer": "_country=ee"
},
{
"if": "language=ti",
"hideInAnswer": "_country=er"
},
{
"if": "language=am",
"hideInAnswer": "_country=et"
},
{
"if": "language=fi",
"then": {
"ca": "finès",
"da": "finsk",
"de": "Finnisch",
"en": "Finnish",
"eo": "finna lingvo",
"es": "finés",
"fi": "suomi",
"fr": "finnois",
"gl": "finés",
"hu": "finn",
"id": "Finlandia",
"it": "finlandese",
"ja": "フィンランド語",
"nb_NO": "finsk",
"nl": "Fins",
"pl": "język fiński",
"pt": "finlandês",
"pt_BR": "língua finlandesa",
"ru": "финский язык",
"sl": "finščina",
"sv": "finska",
"zh_Hans": "芬兰语",
"zh_Hant": "芬蘭語"
},
"hideInAnswer": "_country=fi"
},
{
"if": "language=sv",
"then": {
"ca": "suec",
"da": "svensk",
"de": "Schwedisch",
"en": "Swedish",
"eo": "sveda lingvo",
"es": "sueco",
"fi": "ruotsi",
"fr": "suédois",
"gl": "lingua sueca",
"hu": "svéd",
"id": "Swedia",
"it": "svedese",
"ja": "スウェーデン語",
"nb_NO": "svensk",
"nl": "Zweeds",
"pl": "język szwedzki",
"pt": "língua sueca",
"pt_BR": "língua sueca",
"ru": "шведский язык",
"sl": "švedščina",
"sv": "svenska",
"zh_Hant": "瑞典語"
},
"hideInAnswer": "_country=fi|se"
},
{
"if": "language=fj",
"hideInAnswer": "_country=fj"
},
{
"if": "language=ab",
"hideInAnswer": "_country=ge"
},
{
"if": "language=ka",
"hideInAnswer": "_country=ge"
},
{
"if": "language=ht",
"hideInAnswer": "_country=ht"
},
{
"if": "language=hu",
"then": {
"ca": "hongarès",
"da": "ungarsk",
"de": "Ungarisch",
"en": "Hungarian",
"eo": "hungara lingvo",
"es": "húngaro",
"fi": "unkari",
"fr": "hongrois",
"gl": "lingua húngara",
"hu": "magyar",
"id": "Hongaria",
"it": "ungherese",
"ja": "ハンガリー語",
"nb_NO": "ungarsk",
"nl": "Hongaars",
"pl": "język węgierski",
"pt": "húngaro",
"pt_BR": "língua húngara",
"ru": "венгерский язык",
"sl": "madžarščina",
"sv": "ungerska",
"zh_Hant": "匈牙利語"
},
"hideInAnswer": "_country=hu"
},
{
"if": "language=id",
"then": {
"ca": "indonesi",
"da": "indonesisk",
"de": "Indonesisch",
"en": "Indonesian",
"eo": "indonezia lingvo",
"es": "indonesio",
"fi": "indonesia",
"fr": "indonésien",
"gl": "lingua indonesia",
"hu": "indonéz",
"id": "Indonesia",
"it": "indonesiano",
"ja": "インドネシア語",
"nb_NO": "indonesisk",
"nl": "Indonesisch",
"pl": "język indonezyjski",
"pt": "língua indonésia",
"pt_BR": "língua indonésia",
"ru": "индонезийский язык",
"sl": "indonezijščina",
"sv": "indonesiska",
"zh_Hans": "印度尼西亚语",
"zh_Hant": "印尼語"
},
"hideInAnswer": "_country=id"
},
{
"if": "language=jv",
"hideInAnswer": "_country=id"
},
{
"if": "language=ga",
"hideInAnswer": "_country=ie"
},
{
"if": "language=he",
"hideInAnswer": "_country=il"
},
{
"if": "language=hi",
"hideInAnswer": "_country=in"
},
{
"if": "language=ku",
"hideInAnswer": "_country=iq"
},
{
"if": "language=fa",
"hideInAnswer": "_country=ir"
},
{
"if": "language=is",
"hideInAnswer": "_country=is"
},
{
"if": "language=ja",
"then": {
"ca": "japonès",
"da": "japansk",
"de": "Japanisch",
"en": "Japanese",
"eo": "japana lingvo",
"es": "japonés",
"fi": "japani",
"fr": "japonais",
"gl": "lingua xaponesa",
"hu": "japán",
"id": "bahasa Jepang",
"it": "giapponese",
"ja": "日本語",
"nb_NO": "japansk",
"nl": "Japans",
"pl": "język japoński",
"pt": "japonês",
"pt_BR": "língua japonesa",
"ru": "японский язык",
"sl": "Japonščina",
"sv": "japanska",
"zh_Hans": "日语",
"zh_Hant": "日語"
},
"hideInAnswer": "_country=jp|pw"
},
{
"if": "language=sw",
"hideInAnswer": "_country=ke|rw|tz|ug"
},
{
"if": "language=ky",
"hideInAnswer": "_country=kg"
},
{
"if": "language=km",
"hideInAnswer": "_country=kh"
},
{
"if": "language=ko",
"hideInAnswer": "_country=kp|kr"
},
{
"if": "language=kk",
"hideInAnswer": "_country=kz"
},
{
"if": "language=lo",
"hideInAnswer": "_country=la"
},
{
"if": "language=ta",
"hideInAnswer": "_country=lk|sg"
},
{
"if": "language=si",
"hideInAnswer": "_country=lk"
},
{
"if": "language=st",
"hideInAnswer": "_country=ls|za|zw"
},
{
"if": "language=lt",
"hideInAnswer": "_country=lt"
},
{
"if": "language=lb",
"hideInAnswer": "_country=lu"
},
{
"if": "language=lv",
"hideInAnswer": "_country=lv"
},
{
"if": "language=ro",
"hideInAnswer": "_country=md|ro"
},
{
"if": "language=mg",
"hideInAnswer": "_country=mg"
},
{
"if": "language=mh",
"hideInAnswer": "_country=mh"
},
{
"if": "language=mk",
"hideInAnswer": "_country=mk"
},
{
"if": "language=my",
"hideInAnswer": "_country=mm"
},
{
"if": "language=mn",
"hideInAnswer": "_country=mn"
},
{
"if": "language=mt",
"hideInAnswer": "_country=mt"
},
{
"if": "language=dv",
"hideInAnswer": "_country=mv"
},
{
"if": "language=ny",
"hideInAnswer": "_country=mw|zw"
},
{
"if": "language=yo",
"hideInAnswer": "_country=ng"
},
{
"if": "language=no",
"hideInAnswer": "_country=no"
},
{
"if": "language=nn",
"hideInAnswer": "_country=no"
},
{
"if": "language=nb",
"hideInAnswer": "_country=no"
},
{
"if": "language=ne",
"hideInAnswer": "_country=np"
},
{
"if": "language=na",
"hideInAnswer": "_country=nr"
},
{
"if": "language=mi",
"hideInAnswer": "_country=nz"
},
{
"if": "language=ho",
"hideInAnswer": "_country=pg"
},
{
"if": "language=ur",
"hideInAnswer": "_country=pk"
},
{
"if": "language=pl",
"then": {
"ca": "polonès",
"da": "polsk",
"de": "Polnisch",
"en": "Polish",
"eo": "pola lingvo",
"es": "polaco",
"fi": "puola",
"fr": "polonais",
"gl": "lingua polaca",
"hu": "lengyel",
"id": "Polandia",
"it": "polacco",
"ja": "ポーランド語",
"nb_NO": "polsk",
"nl": "Pools",
"pl": "język polski",
"pt": "polaco",
"pt_BR": "língua polonesa",
"ru": "польский язык",
"sl": "poljščina",
"sv": "polska",
"zh_Hans": "波兰语",
"zh_Hant": "波蘭語"
},
"hideInAnswer": "_country=pl"
},
{
"if": "language=rw",
"hideInAnswer": "_country=rw"
},
{
"if": "language=sl",
"then": {
"ca": "eslovè",
"da": "slovensk",
"de": "Slowenisch",
"en": "Slovene",
"eo": "slovena lingvo",
"es": "esloveno",
"fi": "sloveeni",
"fr": "slovène",
"gl": "lingua eslovena",
"hu": "szlovén",
"id": "Bahasa Slovenia",
"it": "sloveno",
"ja": "スロベニア語",
"nb_NO": "slovensk",
"nl": "Sloveens",
"pl": "język słoweński",
"pt": "língua eslovena",
"pt_BR": "língua eslovena",
"ru": "словенский язык",
"sl": "slovenščina",
"sv": "slovenska",
"zh_Hant": "斯洛維尼亞語"
},
"hideInAnswer": "_country=si"
},
{
"if": "language=sk",
"hideInAnswer": "_country=sk"
},
{
"if": "language=wo",
"hideInAnswer": "_country=sn"
},
{
"if": "language=so",
"hideInAnswer": "_country=so"
},
{
"if": "language=ss",
"hideInAnswer": "_country=sz|za"
},
{
"if": "language=th",
"hideInAnswer": "_country=th"
},
{
"if": "language=tg",
"hideInAnswer": "_country=tj"
},
{
"if": "language=to",
"hideInAnswer": "_country=to"
},
{
"if": "language=uk",
"hideInAnswer": "_country=ua"
},
{
"if": "language=la",
"hideInAnswer": "_country=va"
},
{
"if": "language=vi",
"hideInAnswer": "_country=vn"
},
{
"if": "language=bi",
"hideInAnswer": "_country=vu"
},
{
"if": "language=sm",
"hideInAnswer": "_country=ws"
},
{
"if": "language=af",
"hideInAnswer": "_country=za"
},
{
"if": "language=ve",
"hideInAnswer": "_country=za|zw"
},
{
"if": "language=tn",
"hideInAnswer": "_country=za|zw"
},
{
"if": "language=ts",
"hideInAnswer": "_country=za|zw"
},
{
"if": "language=nr",
"hideInAnswer": "_country=za"
},
{
"if": "language=zu",
"hideInAnswer": "_country=za"
},
{
"if": "language=xh",
"hideInAnswer": "_country=za|zw"
},
{
"if": "language=sn",
"hideInAnswer": "_country=zw"
},
{
"if": "language=nd",
"hideInAnswer": "_country=zw"
}
],
"question": "What languages are spoken here?"
}
}

View file

@ -7,6 +7,9 @@ import {Utils} from "../Utils";
import ScriptUtils from "./ScriptUtils";
import {existsSync, readFileSync, writeFileSync} from "fs";
import * as used_languages from "../assets/generated/used_languages.json"
import {QuestionableTagRenderingConfigJson} from "../Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson";
import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson";
const languageRemap = {
// MapComplete (or weblate) on the left, language of wikimedia on the right
"nb":"nb_NO",
@ -25,7 +28,6 @@ async function fetch(target: string){
async function fetchRegularLanguages() {
ScriptUtils.fixUtils()
console.log("Fetching languages")
const sparql = 'SELECT ?lang ?label ?code \n' +
@ -67,7 +69,6 @@ async function fetchSpecial(id: number, code: string) {
'} '
const url = wds.sparqlQuery(sparql)
// request the generated URL with your favorite HTTP request library
const result = await Utils.downloadJson(url, {"User-Agent": "MapComplete script"})
const bindings = result.results.bindings
bindings.forEach(binding => binding["code"] = {value: code})
@ -107,6 +108,32 @@ function getNativeList(langs: Map<string, Map<string, string>>){
return native
}
async function getOfficialLanguagesPerCountry() : Promise<Map<string, string[]>>{
const lngs = new Map<string, string[]>();
const sparql = `SELECT ?country ?countryLabel ?countryCode ?language ?languageCode ?languageLabel
WHERE
{
?country wdt:P31/wdt:P279* wd:Q3624078;
wdt:P297 ?countryCode;
wdt:P37 ?language.
?language wdt:P218 ?languageCode.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}`
const url = wds.sparqlQuery(sparql)
const result = await Utils.downloadJson(url, {"User-Agent": "MapComplete script"})
const bindings : {countryCode: {value: string}, languageCode: {value: string}}[]= result.results.bindings
for (const binding of bindings) {
const countryCode = binding.countryCode.value
const language = binding.languageCode.value
if(lngs.get(countryCode) === undefined){
lngs.set(countryCode, [])
}
lngs.get(countryCode).push(language)
}
return lngs;
}
async function main(wipeCache = false){
const cacheFile = "./assets/generated/languages-wd.json"
if(wipeCache || !existsSync(cacheFile)){
@ -121,7 +148,7 @@ async function main(wipeCache = false){
writeFileSync("./assets/language_native.json", JSON.stringify(nativeList, null, " "))
const translations = Utils.MapToObj<Map<string, string>>(perId, (value, key) => {
const translations = Utils.MapToObj(perId, (value, key) => {
if(!usedLanguages.has(key)){
return undefined // Remove unused languages
}
@ -135,7 +162,44 @@ async function main(wipeCache = false){
writeFileSync("./assets/language_translations.json",
JSON.stringify(translations, null, " "))
let officialLanguages : Record<string, string[]>;
const officialLanguagesPath = "./assets/language_in_country.json"
if(existsSync("./assets/languages_in_country.json") && !wipeCache){
officialLanguages = JSON.parse(readFileSync(officialLanguagesPath, "utf8"))
}else {
officialLanguages = Utils.MapToObj(await getOfficialLanguagesPerCountry(), t => t)
writeFileSync(officialLanguagesPath, JSON.stringify(officialLanguages, null, " "))
}
const perLanguage = Utils.TransposeMap(officialLanguages);
console.log(JSON.stringify(perLanguage, null, " "))
const mappings: {if: string, then: Record<string, string>, hideInAnswer: string}[] = []
for (const language of Object.keys(perLanguage)) {
const countries = Utils.Dedup(perLanguage[language].map(c => c.toLowerCase()))
mappings.push({
if: "language="+language,
then: translations[language],
hideInAnswer : "_country="+countries.join("|")
})
}
const tagRenderings = <QuestionableTagRenderingConfigJson> {
id: "official-language",
mappings,
question: "What languages are spoken here?"
}
writeFileSync("./assets/layers/language/language.json", JSON.stringify(<LayerConfigJson>{
id:"language",
description: "Various tagRenderings to help language tooling",
tagRenderings
}, null, " "))
}
const forceRefresh = process.argv[2] === "--force-refresh"
main(forceRefresh).then(() => console.log("Done!"))
ScriptUtils.fixUtils()
main(forceRefresh).then(() => console.log("Done!"))

View file

@ -32,6 +32,10 @@ class TranslationPart {
}
addTranslationObject(translations: any, context?: string) {
if(translations["#"] === "no-translations"){
console.log("Ignoring object at ",context,"which has '#':'no-translations'")
return;
}
for (const translationsKey in translations) {
if (!translations.hasOwnProperty(translationsKey)) {
continue;
@ -267,6 +271,9 @@ class TranslationPart {
* @param tr
*/
function isTranslation(tr: any): boolean {
if(tr["#"] === "no-translations") {
return false
}
for (const key in tr) {
if (typeof tr[key] !== "string") {
return false;