Add i18n support for data

This commit is contained in:
BlossomiShymae
2024-09-09 15:58:00 -05:00
parent b0491d569a
commit 90de82ba20
18 changed files with 210 additions and 41 deletions

View File

@@ -20,13 +20,20 @@
import Badge from '~/components/Badge.vue';
import { useRoute } from 'vue-router';
import useClient from '../../../composables/useClient';
import useLocale from '~/composables/useLocale';
import { SummonerIcon } from '~/core/models';
const route = useRoute();
const id = route.params.id as unknown;
const { client } = useClient();
const { currentLocale } = useLocale();
const getIcons = async () => await client.summonerIcons.listAsync({locale: currentLocale.value, version: "latest"});
const icons = await client.summonerIcons.listAsync({locale: "default", version: "latest"});
const icon = icons.find((x) => x.id == id) || new SummonerIcon({});
const icons = ref(await getIcons());
watch(currentLocale, async() => {
icons.value = await getIcons();
});
const icon = icons.value.find((x) => x.id == id) || new SummonerIcon({});
</script>