mirror of
https://github.com/theoludwig/theoludwig.git
synced 2024-11-05 04:51:30 +01:00
Théo LUDWIG
6b29ce9b15
Improvements: - Hide switch theme input (ugly little white square) - i18n without subpath (e.g: /fr or /en), same url whatever the locale used
13 lines
385 B
TypeScript
13 lines
385 B
TypeScript
import UniversalCookie from 'universal-cookie'
|
|
import type { I18n } from 'i18n-js'
|
|
|
|
import { i18n } from './i18n'
|
|
|
|
export type CookiesStore = string | object | null | undefined
|
|
|
|
export const useI18n = (cookiesStore: CookiesStore): I18n => {
|
|
const universalCookie = new UniversalCookie(cookiesStore)
|
|
i18n.locale = universalCookie.get('locale') ?? i18n.defaultLocale
|
|
return i18n
|
|
}
|