mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
chore: lint
This commit is contained in:
@@ -34,14 +34,16 @@ import { useTheme } from "next-themes";
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
|
||||||
|
|
||||||
|
const languageCodes = Object.values(Languages).map(lang => lang.code) as string[];
|
||||||
const appearanceFormSchema = z.object({
|
const appearanceFormSchema = z.object({
|
||||||
theme: z.enum(["light", "dark", "system"], {
|
theme: z.enum(["light", "dark", "system"], {
|
||||||
required_error: "Please select a theme.",
|
required_error: "Please select a theme.",
|
||||||
}),
|
}),
|
||||||
|
|
||||||
language: z.enum(Object.values(Languages).map(lang => lang.code), {
|
language: z.enum(languageCodes, {
|
||||||
required_error: "Please select a language.",
|
required_error: "Please select a language.",
|
||||||
}),
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
type AppearanceFormValues = z.infer<typeof appearanceFormSchema>;
|
type AppearanceFormValues = z.infer<typeof appearanceFormSchema>;
|
||||||
|
|||||||
@@ -17,3 +17,5 @@ export const Languages = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type Language = keyof typeof Languages;
|
export type Language = keyof typeof Languages;
|
||||||
|
export type LanguageCode = (typeof Languages)[keyof typeof Languages]["code"];
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export default api.withTRPC(
|
|||||||
appWithTranslation(MyApp, {
|
appWithTranslation(MyApp, {
|
||||||
i18n: {
|
i18n: {
|
||||||
defaultLocale: "en",
|
defaultLocale: "en",
|
||||||
locales: Object.values(Languages),
|
locales: Object.values(Languages).map(language => language.code),
|
||||||
localeDetection: false,
|
localeDetection: false,
|
||||||
},
|
},
|
||||||
fallbackLng: "en",
|
fallbackLng: "en",
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import type { Languages } from "@/lib/languages";
|
import { LanguageCode } from "@/lib/languages";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
export default function useLocale() {
|
export default function useLocale() {
|
||||||
const currentLocale = (Cookies.get("DOKPLOY_LOCALE") ?? "en") as Languages;
|
|
||||||
|
|
||||||
const setLocale = (locale: Languages) => {
|
const currentLocale = (Cookies.get("DOKPLOY_LOCALE") ?? "en") as LanguageCode;
|
||||||
|
|
||||||
|
const setLocale = (locale: LanguageCode) => {
|
||||||
Cookies.set("DOKPLOY_LOCALE", locale, { expires: 365 });
|
Cookies.set("DOKPLOY_LOCALE", locale, { expires: 365 });
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export const serverSideTranslations = (
|
|||||||
keySeparator: false,
|
keySeparator: false,
|
||||||
i18n: {
|
i18n: {
|
||||||
defaultLocale: "en",
|
defaultLocale: "en",
|
||||||
locales: Object.values(Languages),
|
locales: Object.values(Languages).map(language => language.code),
|
||||||
localeDetection: false,
|
localeDetection: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user