mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 05:25:26 +02:00
Merge branch 'mealie-next' into fix/warn-on-edit-nav
This commit is contained in:
commit
abf4b7706f
199 changed files with 5226 additions and 2441 deletions
|
@ -4,7 +4,7 @@ import { usePublicExploreApi } from "../api/api-client";
|
|||
import { useUserApi } from "~/composables/api";
|
||||
import { IngredientFood } from "~/lib/api/types/recipe";
|
||||
|
||||
let foodStore: Ref<IngredientFood[] | null> | null = null;
|
||||
let foodStore: Ref<IngredientFood[] | null> = ref([]);
|
||||
|
||||
/**
|
||||
* useFoodData returns a template reactive object
|
||||
|
@ -39,11 +39,11 @@ export const usePublicFoodStore = function (groupSlug: string) {
|
|||
const actions = {
|
||||
...usePublicStoreActions(api.foods, foodStore, loading),
|
||||
flushStore() {
|
||||
foodStore = null;
|
||||
foodStore = ref([]);
|
||||
},
|
||||
};
|
||||
|
||||
if (!foodStore) {
|
||||
if (!foodStore.value) {
|
||||
foodStore = actions.getAll();
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ export const useFoodStore = function () {
|
|||
const actions = {
|
||||
...useStoreActions(api.foods, foodStore, loading),
|
||||
flushStore() {
|
||||
foodStore = null;
|
||||
foodStore.value = [];
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useStoreActions } from "../partials/use-actions-factory";
|
|||
import { MultiPurposeLabelOut } from "~/lib/api/types/labels";
|
||||
import { useUserApi } from "~/composables/api";
|
||||
|
||||
let labelStore: Ref<MultiPurposeLabelOut[] | null> | null = null;
|
||||
let labelStore: Ref<MultiPurposeLabelOut[] | null> = ref([]);
|
||||
|
||||
export function useLabelData() {
|
||||
const data = reactive({
|
||||
|
@ -33,11 +33,11 @@ export function useLabelStore() {
|
|||
const actions = {
|
||||
...useStoreActions<MultiPurposeLabelOut>(api.multiPurposeLabels, labelStore, loading),
|
||||
flushStore() {
|
||||
labelStore = null;
|
||||
labelStore.value =[];
|
||||
},
|
||||
};
|
||||
|
||||
if (!labelStore) {
|
||||
if (!labelStore.value) {
|
||||
labelStore = actions.getAll();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useStoreActions } from "../partials/use-actions-factory";
|
|||
import { useUserApi } from "~/composables/api";
|
||||
import { IngredientUnit } from "~/lib/api/types/recipe";
|
||||
|
||||
let unitStore: Ref<IngredientUnit[] | null> | null = null;
|
||||
let unitStore: Ref<IngredientUnit[] | null> = ref([]);
|
||||
|
||||
/**
|
||||
* useUnitData returns a template reactive object
|
||||
|
@ -40,11 +40,11 @@ export const useUnitStore = function () {
|
|||
const actions = {
|
||||
...useStoreActions<IngredientUnit>(api.units, unitStore, loading),
|
||||
flushStore() {
|
||||
unitStore = null;
|
||||
unitStore.value = [];
|
||||
},
|
||||
};
|
||||
|
||||
if (!unitStore) {
|
||||
if (!unitStore.value) {
|
||||
unitStore = actions.getAll();
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ export const useCookbooks = function () {
|
|||
}
|
||||
|
||||
loading.value = false;
|
||||
return data;
|
||||
},
|
||||
async updateOne(updateData: UpdateCookBook) {
|
||||
if (!updateData.id) {
|
||||
|
|
|
@ -3,196 +3,241 @@ export const LOCALES = [
|
|||
{
|
||||
name: "繁體中文 (Chinese traditional)",
|
||||
value: "zh-TW",
|
||||
progress: 28,
|
||||
progress: 30,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "简体中文 (Chinese simplified)",
|
||||
value: "zh-CN",
|
||||
progress: 65,
|
||||
progress: 98,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Tiếng Việt (Vietnamese)",
|
||||
value: "vi-VN",
|
||||
progress: 2,
|
||||
progress: 1,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Українська (Ukrainian)",
|
||||
value: "uk-UA",
|
||||
progress: 99,
|
||||
progress: 100,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Türkçe (Turkish)",
|
||||
value: "tr-TR",
|
||||
progress: 50,
|
||||
progress: 53,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Svenska (Swedish)",
|
||||
value: "sv-SE",
|
||||
progress: 71,
|
||||
progress: 94,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "српски (Serbian)",
|
||||
value: "sr-SP",
|
||||
progress: 4,
|
||||
progress: 32,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Slovenian",
|
||||
value: "sl-SI",
|
||||
progress: 49,
|
||||
progress: 47,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Slovak",
|
||||
value: "sk-SK",
|
||||
progress: 97,
|
||||
progress: 93,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Pусский (Russian)",
|
||||
value: "ru-RU",
|
||||
progress: 99,
|
||||
progress: 98,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Română (Romanian)",
|
||||
value: "ro-RO",
|
||||
progress: 32,
|
||||
progress: 42,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Português (Portuguese)",
|
||||
value: "pt-PT",
|
||||
progress: 99,
|
||||
progress: 100,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Português do Brasil (Brazilian Portuguese)",
|
||||
value: "pt-BR",
|
||||
progress: 98,
|
||||
progress: 97,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Polski (Polish)",
|
||||
value: "pl-PL",
|
||||
progress: 97,
|
||||
progress: 98,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Norsk (Norwegian)",
|
||||
value: "no-NO",
|
||||
progress: 85,
|
||||
progress: 99,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Nederlands (Dutch)",
|
||||
value: "nl-NL",
|
||||
progress: 98,
|
||||
progress: 100,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Latvian",
|
||||
value: "lv-LV",
|
||||
progress: 1,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Lithuanian",
|
||||
value: "lt-LT",
|
||||
progress: 97,
|
||||
progress: 93,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "한국어 (Korean)",
|
||||
value: "ko-KR",
|
||||
progress: 5,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "日本語 (Japanese)",
|
||||
value: "ja-JP",
|
||||
progress: 11,
|
||||
progress: 12,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Italiano (Italian)",
|
||||
value: "it-IT",
|
||||
progress: 96,
|
||||
progress: 100,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Icelandic",
|
||||
value: "is-IS",
|
||||
progress: 0,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Magyar (Hungarian)",
|
||||
value: "hu-HU",
|
||||
progress: 99,
|
||||
progress: 100,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Croatian",
|
||||
value: "hr-HR",
|
||||
progress: 97,
|
||||
progress: 93,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "עברית (Hebrew)",
|
||||
value: "he-IL",
|
||||
progress: 99,
|
||||
progress: 97,
|
||||
dir: "rtl",
|
||||
},
|
||||
{
|
||||
name: "Galician",
|
||||
value: "gl-ES",
|
||||
progress: 1,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Français (French)",
|
||||
value: "fr-FR",
|
||||
progress: 99,
|
||||
progress: 100,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "French, Canada",
|
||||
value: "fr-CA",
|
||||
progress: 97,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Suomi (Finnish)",
|
||||
value: "fi-FI",
|
||||
progress: 95,
|
||||
progress: 91,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Español (Spanish)",
|
||||
value: "es-ES",
|
||||
progress: 76,
|
||||
progress: 79,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "American English",
|
||||
value: "en-US",
|
||||
progress: 100.0,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "British English",
|
||||
value: "en-GB",
|
||||
progress: 4,
|
||||
progress: 3,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Ελληνικά (Greek)",
|
||||
value: "el-GR",
|
||||
progress: 35,
|
||||
progress: 34,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Deutsch (German)",
|
||||
value: "de-DE",
|
||||
progress: 99,
|
||||
progress: 100,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Dansk (Danish)",
|
||||
value: "da-DK",
|
||||
progress: 100,
|
||||
progress: 98,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Čeština (Czech)",
|
||||
value: "cs-CZ",
|
||||
progress: 66,
|
||||
progress: 64,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Català (Catalan)",
|
||||
value: "ca-ES",
|
||||
progress: 61,
|
||||
progress: 75,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "Bulgarian",
|
||||
value: "bg-BG",
|
||||
progress: 99,
|
||||
dir: "ltr",
|
||||
},
|
||||
{
|
||||
name: "العربية (Arabic)",
|
||||
value: "ar-SA",
|
||||
progress: 16,
|
||||
progress: 20,
|
||||
dir: "rtl",
|
||||
},
|
||||
{
|
||||
name: "Afrikaans (Afrikaans)",
|
||||
value: "af-ZA",
|
||||
progress: 96,
|
||||
progress: 92,
|
||||
dir: "ltr",
|
||||
},
|
||||
]
|
||||
|
|
|
@ -4,14 +4,31 @@ import { LOCALES } from "./available-locales";
|
|||
export const useLocales = () => {
|
||||
const { i18n, $vuetify } = useContext();
|
||||
|
||||
function getLocale(value: string) {
|
||||
const currentLocale = LOCALES.filter((locale) => locale.value === value);
|
||||
return currentLocale.length ? currentLocale[0] : null;
|
||||
}
|
||||
|
||||
const locale = computed<string>({
|
||||
get() {
|
||||
$vuetify.lang.current = i18n.locale; // dirty hack
|
||||
// dirty hack
|
||||
$vuetify.lang.current = i18n.locale;
|
||||
const currentLocale = getLocale(i18n.locale);
|
||||
if (currentLocale) {
|
||||
$vuetify.rtl = currentLocale.dir === "rtl";
|
||||
}
|
||||
|
||||
return i18n.locale;
|
||||
},
|
||||
set(value) {
|
||||
i18n.setLocale(value);
|
||||
$vuetify.lang.current = value; // this does not persist after window reload :-(
|
||||
|
||||
// this does not persist after window reload :-(
|
||||
$vuetify.lang.current = value;
|
||||
const currentLocale = getLocale(value);
|
||||
if (currentLocale) {
|
||||
$vuetify.rtl = currentLocale.dir === "rtl";
|
||||
}
|
||||
|
||||
// Reload the page to update the language - not all strings are reactive
|
||||
window.location.reload();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue