- 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
22 lines
570 B
TypeScript
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,
|
|
})),
|
|
}));
|