This commit is contained in:
parent
563af3d90f
commit
0f599d2069
2 changed files with 7 additions and 6 deletions
|
@ -127,7 +127,7 @@ export const {
|
||||||
} = new i18n(config);
|
} = new i18n(config);
|
||||||
|
|
||||||
locale.subscribe(($locale) => {
|
locale.subscribe(($locale) => {
|
||||||
if (typeof document !== 'undefined') {
|
// if (typeof document !== 'undefined') {
|
||||||
document.cookie = `locale=${$locale}; path=/; SameSite=None; Secure`;
|
// document.cookie = `locale=${$locale}; path=/; SameSite=None; Secure`;
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,9 +41,10 @@ function localeFromHeader(header) {
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').ServerLoad}*/
|
/** @type {import('@sveltejs/kit').ServerLoad}*/
|
||||||
export async function load({ url, request, cookies }) {
|
export async function load({ url, request, cookies }) {
|
||||||
const cookieLocale = localeFromCookies(cookies);
|
// const cookieLocale = localeFromCookies(cookies);
|
||||||
const headerLocale = localeFromHeader(request.headers.get('accept-language'));
|
// const headerLocale = localeFromHeader(request.headers.get('accept-language'));
|
||||||
const language = cookieLocale || headerLocale || SUPPORTED_LOCALES.EN_US;
|
// const language = cookieLocale || headerLocale || SUPPORTED_LOCALES.EN_US;
|
||||||
|
const language = SUPPORTED_LOCALES.EN_US;
|
||||||
const route = url.pathname;
|
const route = url.pathname;
|
||||||
|
|
||||||
await loadTranslations(language, route);
|
await loadTranslations(language, route);
|
||||||
|
|
Loading…
Add table
Reference in a new issue