1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 07:39:41 +02:00

feat: Migrate to Nuxt 3 framework (#5184)

Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
Hoa (Kyle) Trinh 2025-06-20 00:09:12 +07:00 committed by GitHub
parent 89ab7fac25
commit c24d532608
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
403 changed files with 23959 additions and 19557 deletions

View file

@ -1,52 +1,70 @@
<template>
<BaseDialog v-model="dialog" :icon="$globals.icons.translate" :title="$tc('language-dialog.choose-language')">
<BaseDialog
v-model="dialog"
:icon="$globals.icons.translate"
:title="$t('language-dialog.choose-language')"
>
<v-card-text>
{{ $t("language-dialog.select-description") }}
<v-autocomplete v-model="locale" :items="locales" item-text="name" class="my-3" hide-details outlined offset>
<template #item="{ item }">
<v-list-item-content>
<v-list-item-title> {{ item.name }} </v-list-item-title>
<v-list-item-subtitle> {{ item.progress }}% {{ $tc("language-dialog.translated") }} </v-list-item-subtitle>
</v-list-item-content>
<v-autocomplete
v-model="locale"
:items="locales"
item-title="name"
class="my-3"
hide-details
variant="outlined"
offset
>
<template #item="{ item, props }">
<div
v-bind="props"
class="px-2 py-2"
>
<v-list-item-title> {{ item.raw.name }} </v-list-item-title>
<v-list-item-subtitle>
{{ item.raw.progress }}% {{ $t("language-dialog.translated") }}
</v-list-item-subtitle>
</div>
</template>
</v-autocomplete>
<i18n path="language-dialog.how-to-contribute-description">
<i18n-t keypath="language-dialog.how-to-contribute-description">
<template #read-the-docs-link>
<a href="https://docs.mealie.io/contributors/translating/" target="_blank">{{
$t("language-dialog.read-the-docs")
}}</a>
<a
href="https://docs.mealie.io/contributors/translating/"
target="_blank"
>
{{ $t("language-dialog.read-the-docs") }}
</a>
</template>
</i18n>
</i18n-t>
</v-card-text>
</BaseDialog>
</template>
<script lang="ts">
import { computed, defineComponent } from "@nuxtjs/composition-api";
import type { LocaleObject } from "@nuxtjs/i18n";
import { useLocales } from "~/composables/use-locales";
export default defineComponent({
export default defineNuxtComponent({
props: {
value: {
modelValue: {
type: Boolean,
default: false,
required: true,
},
},
setup(props, context) {
const dialog = computed<boolean>({
get() {
return props.value;
},
set(val) {
context.emit("input", val);
},
emits: ["update:modelValue"],
setup(props, { emit }) {
const dialog = computed({
get: () => props.modelValue,
set: value => emit("update:modelValue", value),
});
const { locales: LOCALES, locale, i18n } = useLocales();
watch(locale, () => {
dialog.value = false; // Close dialog when locale changes
});
const locales = LOCALES.filter((locale) =>
(i18n.locales as LocaleObject[]).map((i18nLocale) => i18nLocale.code).includes(locale.value)
const locales = LOCALES.filter(lc =>
i18n.locales.value.map(i18nLocale => i18nLocale.code).includes(lc.value as any),
);
return {
@ -58,5 +76,3 @@ export default defineComponent({
},
});
</script>
<style scoped></style>