improve country translation & sort them afterwards

This commit is contained in:
vrifox 2023-07-19 10:22:13 +02:00
parent 86976a1cd5
commit f04bef0864
No known key found for this signature in database
GPG key ID: D40098E5B60B2197
2 changed files with 10 additions and 200 deletions

View file

@ -4,7 +4,6 @@ import { ref, reactive, watch, onMounted } from 'vue';
import AlbumItem from '@/components/AlbumItem.vue';
import SongItem from '@/components/SongItem.vue';
import { translateCountryNames } from '@/scripts/countries.js';
import { getJsonHyp } from '@/scripts/fetch.js';
import { useResults, useArtist } from '@/stores/results.js';
@ -35,10 +34,17 @@ async function getCharts() {
i => i.title == json.options.default,
)[0].id;
translateCountryNames(json.options.all);
console.log(json.options.all)
for (const country of json.options.all) {
const countryLocaleId = `countries.${country.id}`;
data.options = json.options.all;
if (t(countryLocaleId) !== countryLocaleId) {
country.title = t(countryLocaleId);
}
}
data.options = json.options.all.sort((a, b) => {
return a.title.localeCompare(b.title)
});
data.songs = json.trending;
data.artists = json.artists;
}