add strings for charts country selection

This commit is contained in:
vrifox 2023-07-18 16:30:24 +02:00 committed by Shiny Nematoda
parent 311f3a698e
commit a50892c49d
4 changed files with 328 additions and 0 deletions

View file

@ -4,6 +4,7 @@ import { ref, reactive, watch, onMounted } from 'vue';
import AlbumItem from '@/components/AlbumItem.vue'; import AlbumItem from '@/components/AlbumItem.vue';
import SongItem from '@/components/SongItem.vue'; import SongItem from '@/components/SongItem.vue';
import { translateCountryNames } from '@/scripts/countries.js';
import { getJsonHyp } from '@/scripts/fetch.js'; import { getJsonHyp } from '@/scripts/fetch.js';
import { useResults, useArtist } from '@/stores/results.js'; import { useResults, useArtist } from '@/stores/results.js';
@ -32,6 +33,9 @@ async function getCharts() {
if (!id.value) if (!id.value)
id.value = json.options.all.find(i => i.title == json.options.default).id; id.value = json.options.all.find(i => i.title == json.options.default).id;
translateCountryNames(json.options.all);
console.log(json.options.all)
data.options = json.options.all; data.options = json.options.all;
data.songs = json.trending; data.songs = json.trending;
data.artists = json.artists; data.artists = json.artists;

View file

@ -84,5 +84,69 @@
"lyrics": { "lyrics": {
"load": "Abrufen von Liedtexten", "load": "Abrufen von Liedtexten",
"void": "Keine Liedtexte" "void": "Keine Liedtexte"
},
"countries": {
"AE": "Vereinigte Arabische Emirate",
"AR": "Argentien",
"AT": "Österreich",
"AU": "Australien",
"BE": "Belgien",
"BO": "Bolivien",
"BR": "Brasilien",
"CA": "Kanada",
"CH": "Schweiz",
"CL": "Chile",
"CO": "Kolumbien",
"CR": "Costa Rica",
"CZ": "Tschechien",
"DE": "Deutschland",
"DK": "Dänemark",
"DO": "Dominikanische Republik",
"EC": "Ecuador",
"EE": "Estland",
"EG": "Ägypten",
"ES": "Spanien",
"FI": "Finnland",
"FR": "Frankreich",
"GB": "Großbritannien",
"GT": "Guatemala",
"HN": "Honduras",
"HU": "Ungarn",
"ID": "Indonesien",
"IE": "Irland",
"IL": "Israel",
"IN": "Indien",
"IS": "Island",
"IT": "Italien",
"JP": "Japan",
"KE": "Kenia",
"KR": "Südkorea",
"LU": "Luxemburg",
"MX": "Mexiko",
"NG": "Nigeria",
"NI": "Nicaragua",
"NL": "Niederlande",
"NO": "Norwegen",
"NZ": "Neuseeland",
"PA": "Panama",
"PE": "Peru",
"PL": "Polen",
"PT": "Portugal",
"PY": "Paraguay",
"RO": "Rumänien",
"RS": "Serbien",
"RU": "Russland",
"SA": "Saudi Arabien",
"SE": "Schweden",
"SV": "El Salvador",
"TR": "Türkei",
"TZ": "Tansania",
"UA": "Ukraine",
"UG": "Uganda",
"US": "Vereinigten Staaten von Amerika",
"UY": "Uruguay",
"ZA": "Südafrika",
"ZW": "Simbabwe",
"ZZ": "Global"
} }
} }

View file

@ -84,5 +84,69 @@
"lyrics": { "lyrics": {
"load": "Fetching Lyrics", "load": "Fetching Lyrics",
"void": "No Lyrics" "void": "No Lyrics"
},
"countries": {
"AE": "United Arab Emirates",
"AR": "Argentina",
"AT": "Austria",
"AU": "Australia",
"BE": "Belgium",
"BO": "Bolivia",
"BR": "Brazil",
"CA": "Canada",
"CH": "Switzerland",
"CL": "Chile",
"CO": "Colombia",
"CR": "Costa Rica",
"CZ": "Czechia",
"DE": "Germany",
"DK": "Denmark",
"DO": "Dominican Republic",
"EC": "Ecuador",
"EE": "Estonia",
"EG": "Egypt",
"ES": "Spain",
"FI": "Finland",
"FR": "France",
"GB": "United Kingdom",
"GT": "Guatemala",
"HN": "Honduras",
"HU": "Hungary",
"ID": "Indonesia",
"IE": "Ireland",
"IL": "Israel",
"IN": "India",
"IS": "Iceland",
"IT": "Italy",
"JP": "Japan",
"KE": "Kenya",
"KR": "South Korea",
"LU": "Luxembourg",
"MX": "Mexico",
"NG": "Nigeria",
"NI": "Nicaragua",
"NL": "Netherlands",
"NO": "Norway",
"NZ": "New Zealand",
"PA": "Panama",
"PE": "Peru",
"PL": "Poland",
"PT": "Portugal",
"PY": "Paraguay",
"RO": "Romania",
"RS": "Serbia",
"RU": "Russia",
"SA": "Saudi Arabia",
"SE": "Sweden",
"SV": "El Salvador",
"TR": "Turkey",
"TZ": "Tanzania",
"UA": "Ukraine",
"UG": "Uganda",
"US": "United States",
"UY": "Uruguay",
"ZA": "South Africa",
"ZW": "Zimbabwe",
"ZZ": "Global"
} }
} }

196
src/scripts/countries.js Normal file
View file

@ -0,0 +1,196 @@
import { useI18n } from '@/stores/misc.js';
const { t } = useI18n();
export function translateCountryNames(countries) {
for (const country of countries) {
switch (country.id) {
case "AE":
country.title = t('countries.AE');
break;
case "AR":
country.title = t('countries.AR');
break;
case "AT":
country.title = t('countries.AT');
break;
case "AU":
country.title = t('countries.AU');
break;
case "BE":
country.title = t('countries.BE');
break;
case "BO":
country.title = t('countries.BO');
break;
case "BR":
country.title = t('countries.BR');
break;
case "CA":
country.title = t('countries.CA');
break;
case "CH":
country.title = t('countries.CH');
break;
case "CL":
country.title = t('countries.CL');
break;
case "CO":
country.title = t('countries.CO');
break;
case "CR":
country.title = t('countries.CR');
break;
case "CZ":
country.title = t('countries.CZ');
break;
case "DE":
country.title = t('countries.DE');
break;
case "DK":
country.title = t('countries.DK');;
break;
case "DO":
country.title = t('countries.DO');
break;
case "EC":
country.title = t('countries.EC');
break;
case "EE":
country.title = t('countries.EE');
break;
case "EG":
country.title = t('countries.EG');
break;
case "ES":
country.title = t('countries.ES');
break;
case "FI":
country.title = t('countries.FI');
break;
case "FR":
country.title = t('countries.FR');
break;
case "GB":
country.title = t('countries.GB');
break;
case "GT":
country.title = t('countries.GT');
break;
case "HN":
country.title = t('countries.HN');
break;
case "HU":
country.title = t('countries.HU');
break;
case "ID":
country.title = t('countries.ID');
break;
case "IE":
country.title = t('countries.IE');
break;
case "IL":
country.title = t('countries.IL');
break;
case "IN":
country.title = t('countries.IN');
break;
case "IS":
country.title = t('countries.IS');
break;
case "IT":
country.title = t('countries.IT');
break;
case "JP":
country.title = t('countries.JP');
break;
case "KE":
country.title = t('countries.KE');
break;
case "KR":
country.title = t('countries.KR');
break;
case "LU":
country.title = t('countries.LU');
break;
case "MX":
country.title = t('countries.MX');
break;
case "NG":
country.title = t('countries.NG');
break;
case "NI":
country.title = t('countries.NI');
break;
case "NL":
country.title = t('countries.NL');
break;
case "NO":
country.title = t('countries.NO');
break;
case "NZ":
country.title = t('countries.NZ');
break;
case "PA":
country.title = t('countries.PA');
break;
case "PE":
country.title = t('countries.PE');
break;
case "PL":
country.title = t('countries.PL');
break;
case "PT":
country.title = t('countries.PT');
break;
case "PY":
country.title = t('countries.PY');
break;
case "RO":
country.title = t('countries.RO');
break;
case "RS":
country.title = t('countries.RS');
break;
case "RU":
country.title = t('countries.RU');
break;
case "SA":
country.title = t('countries.SA');
break;
case "SE":
country.title = t('countries.SE');
break;
case "SV":
country.title = t('countries.SV');
break;
case "TR":
country.title = t('countries.TR');
break;
case "TZ":
country.title = t('countries.TZ');
break;
case "UA":
country.title = t('countries.UA');
break;
case "UG":
country.title = t('countries.UG');
break;
case "US":
country.title = t('countries.US');
break;
case "UY":
country.title = t('countries.UY');
break;
case "ZA":
country.title = t('countries.ZA');
break;
case "ZW":
country.title = t('countries.ZW');
break;
case "ZZ":
country.title = t('countries.ZZ');
break;
}
};
};