mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-04 21:45:26 +02:00
17 lines
399 B
TypeScript
17 lines
399 B
TypeScript
import Cookies from "js-cookie";
|
|
import type { LanguageCode } from "@/lib/languages";
|
|
|
|
export default function useLocale() {
|
|
const currentLocale = (Cookies.get("DOKPLOY_LOCALE") ?? "en") as LanguageCode;
|
|
|
|
const setLocale = (locale: LanguageCode) => {
|
|
Cookies.set("DOKPLOY_LOCALE", locale, { expires: 365 });
|
|
window.location.reload();
|
|
};
|
|
|
|
return {
|
|
locale: currentLocale,
|
|
setLocale,
|
|
};
|
|
}
|