prmbr-image-mksaas/src/stores/locale-store.ts
javayhu df1c75f56a chore: upgrade next-intl to version 4.0.0 and update type definitions
- Update `next-intl` dependency from version 3.26.5 to 4.0.0
- Modify global type definitions to include new `Locale` and `Messages` types
- Refactor various components and pages to use `Locale` type for params
- Enhance internationalization handling by integrating `hasLocale` checks
- Clean up imports and ensure consistent usage of `next-intl` features
2025-03-13 00:23:37 +08:00

22 lines
570 B
TypeScript

import { Locale } from 'next-intl';
import { create } from 'zustand';
interface LocaleState {
currentLocale: Locale;
setCurrentLocale: (locale: Locale) => void;
}
/**
* Zustand create function
* create lets you create a React Hook with API utilities attached.
*
* https://zustand.docs.pmnd.rs/apis/create
*/
export const useLocaleStore = create<LocaleState>((set) => ({
currentLocale: '', // don't change, it will affect the language detection switch judgment
setCurrentLocale: (locale) =>
set((state) => ({
currentLocale: locale,
})),
}));