@inlang/paraglide-js 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler/compiler-options.d.ts +7 -0
- package/dist/compiler/compiler-options.d.ts.map +1 -1
- package/dist/compiler/compiler-options.js +1 -0
- package/dist/compiler/runtime/create-runtime.d.ts +1 -0
- package/dist/compiler/runtime/create-runtime.d.ts.map +1 -1
- package/dist/compiler/runtime/create-runtime.js +2 -1
- package/dist/compiler/runtime/get-locale.test.js +3 -3
- package/dist/compiler/runtime/set-locale.d.ts +1 -1
- package/dist/compiler/runtime/set-locale.d.ts.map +1 -1
- package/dist/compiler/runtime/set-locale.js +4 -4
- package/dist/compiler/runtime/set-locale.test.js +8 -8
- package/dist/compiler/runtime/type.d.ts +1 -0
- package/dist/compiler/runtime/type.d.ts.map +1 -1
- package/dist/compiler/runtime/variables.d.ts +2 -0
- package/dist/compiler/runtime/variables.d.ts.map +1 -1
- package/dist/compiler/runtime/variables.js +2 -0
- package/dist/services/env-variables/index.js +1 -1
- package/package.json +5 -5
|
@@ -11,6 +11,7 @@ export declare const defaultCompilerOptions: {
|
|
|
11
11
|
readonly isServer: "typeof window === 'undefined'";
|
|
12
12
|
readonly strategy: ["cookie", "globalVariable", "baseLocale"];
|
|
13
13
|
readonly cookieName: "PARAGLIDE_LOCALE";
|
|
14
|
+
readonly cookieMaxAge: number;
|
|
14
15
|
};
|
|
15
16
|
export type CompilerOptions = {
|
|
16
17
|
/**
|
|
@@ -94,6 +95,12 @@ export type CompilerOptions = {
|
|
|
94
95
|
* @default 'PARAGLIDE_LOCALE'
|
|
95
96
|
*/
|
|
96
97
|
cookieName?: string;
|
|
98
|
+
/**
|
|
99
|
+
* The max-age in seconds of the cookie until it expires.
|
|
100
|
+
*
|
|
101
|
+
* @default 60 * 60 * 24 * 400
|
|
102
|
+
*/
|
|
103
|
+
cookieMaxAge?: number;
|
|
97
104
|
/**
|
|
98
105
|
* The `additionalFiles` option is an array of paths to additional files that should be copied to the output directory.
|
|
99
106
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler-options.d.ts","sourceRoot":"","sources":["../../src/compiler/compiler-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"compiler-options.d.ts","sourceRoot":"","sources":["../../src/compiler/compiler-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;CAaU,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC7B;;;;;;;;;;OAUG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;OAUG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/B;;;;;;;;;;;;;;OAcG;IACH,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAChD;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACrC;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,eAAe,CAAC,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;IACvD;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,EAAE,CAAC,EAAE,GAAG,CAAC;CACT,CAAC"}
|
|
@@ -8,6 +8,7 @@ export declare function createRuntimeFile(args: {
|
|
|
8
8
|
compilerOptions: {
|
|
9
9
|
strategy: NonNullable<CompilerOptions["strategy"]>;
|
|
10
10
|
cookieName: NonNullable<CompilerOptions["cookieName"]>;
|
|
11
|
+
cookieMaxAge: NonNullable<CompilerOptions["cookieMaxAge"]>;
|
|
11
12
|
urlPatterns?: CompilerOptions["urlPatterns"];
|
|
12
13
|
experimentalMiddlewareLocaleSplitting: CompilerOptions["experimentalMiddlewareLocaleSplitting"];
|
|
13
14
|
isServer: CompilerOptions["isServer"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-runtime.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/create-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE;QAChB,QAAQ,EAAE,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;QACnD,UAAU,EAAE,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;QACvD,WAAW,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;QAC7C,qCAAqC,EAAE,eAAe,CAAC,uCAAuC,CAAC,CAAC;QAChG,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;QACtC,eAAe,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;QACpD,wBAAwB,EAAE,WAAW,CACpC,eAAe,CAAC,0BAA0B,CAAC,CAC3C,CAAC;KACF,CAAC;CACF,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"create-runtime.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/create-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE;QAChB,QAAQ,EAAE,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;QACnD,UAAU,EAAE,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;QACvD,YAAY,EAAE,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC;QAC3D,WAAW,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;QAC7C,qCAAqC,EAAE,eAAe,CAAC,uCAAuC,CAAC,CAAC;QAChG,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;QACtC,eAAe,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;QACpD,wBAAwB,EAAE,WAAW,CACpC,eAAe,CAAC,0BAA0B,CAAC,CAC3C,CAAC;KACF,CAAC;CACF,GAAG,MAAM,CAiIT"}
|
|
@@ -34,6 +34,7 @@ ${injectCode("./variables.js")
|
|
|
34
34
|
.replace(`export const locales = /** @type {const} */ (["en", "de"]);`, `export const locales = /** @type {const} */ (["${args.locales.join('", "')}"]);`)
|
|
35
35
|
.replace(`export const strategy = ["globalVariable"];`, `export const strategy = ${JSON.stringify(args.compilerOptions.strategy, null, 2)};`)
|
|
36
36
|
.replace(`<cookie-name>`, `${args.compilerOptions.cookieName}`)
|
|
37
|
+
.replace(`60 * 60 * 24 * 400`, `${args.compilerOptions.cookieMaxAge}`)
|
|
37
38
|
.replace(`export const TREE_SHAKE_COOKIE_STRATEGY_USED = false;`, `const TREE_SHAKE_COOKIE_STRATEGY_USED = ${args.compilerOptions.strategy.includes("cookie")};`)
|
|
38
39
|
.replace(`export const TREE_SHAKE_URL_STRATEGY_USED = false;`, `const TREE_SHAKE_URL_STRATEGY_USED = ${args.compilerOptions.strategy.includes("url")};`)
|
|
39
40
|
.replace(`export const TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;`, `const TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = ${args.compilerOptions.strategy.includes("globalVariable")};`)
|
|
@@ -48,7 +49,7 @@ ${injectCode("./variables.js")
|
|
|
48
49
|
|
|
49
50
|
globalThis.__paraglide = {}
|
|
50
51
|
|
|
51
|
-
${injectCode("./get-locale.js")}
|
|
52
|
+
${injectCode("./get-locale.js")}
|
|
52
53
|
|
|
53
54
|
${injectCode("./set-locale.js")}
|
|
54
55
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { test, expect, vi } from "vitest";
|
|
2
|
-
import { createParaglide } from "../create-paraglide.js";
|
|
3
1
|
import { newProject } from "@inlang/sdk";
|
|
2
|
+
import { expect, test, vi } from "vitest";
|
|
3
|
+
import { createParaglide } from "../create-paraglide.js";
|
|
4
4
|
test("matching by strategy works", async () => {
|
|
5
5
|
const baseLocale = "en";
|
|
6
6
|
const runtime = await createParaglide({
|
|
@@ -195,6 +195,6 @@ test("initially sets the locale after resolving it for the first time", async ()
|
|
|
195
195
|
// First call to getLocale should resolve and set the locale
|
|
196
196
|
expect(runtime.getLocale()).toBe("de");
|
|
197
197
|
// Cookie should be set, proving that the locale was initially set
|
|
198
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path
|
|
198
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000");
|
|
199
199
|
expect(globalThis.window.location.href).toBe("https://example.com/de/page");
|
|
200
200
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Set locale reloads the site by default on the client. Reloading
|
|
5
5
|
* can be disabled by passing \`reload: false\` as an option. If
|
|
6
|
-
* reloading is
|
|
6
|
+
* reloading is disabled, you need to ensure that the UI is updated
|
|
7
7
|
* to reflect the new locale.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-locale.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/set-locale.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"set-locale.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/set-locale.js"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;GAeG;AACH,sBAFU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,CA2EnE;AAgBK,uCAFI,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,QAIrC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { cookieName, isServer, localStorageKey, strategy, TREE_SHAKE_COOKIE_STRATEGY_USED, TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED, TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED, TREE_SHAKE_URL_STRATEGY_USED, } from "./variables.js";
|
|
2
|
-
import { localizeUrl } from "./localize-url.js";
|
|
3
1
|
import { getLocale } from "./get-locale.js";
|
|
2
|
+
import { localizeUrl } from "./localize-url.js";
|
|
3
|
+
import { cookieMaxAge, cookieName, isServer, localStorageKey, strategy, TREE_SHAKE_COOKIE_STRATEGY_USED, TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED, TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED, TREE_SHAKE_URL_STRATEGY_USED, } from "./variables.js";
|
|
4
4
|
/**
|
|
5
5
|
* Set the locale.
|
|
6
6
|
*
|
|
7
7
|
* Set locale reloads the site by default on the client. Reloading
|
|
8
8
|
* can be disabled by passing \`reload: false\` as an option. If
|
|
9
|
-
* reloading is
|
|
9
|
+
* reloading is disabled, you need to ensure that the UI is updated
|
|
10
10
|
* to reflect the new locale.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
@@ -45,7 +45,7 @@ export let setLocale = (newLocale, options) => {
|
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
47
|
// set the cookie
|
|
48
|
-
document.cookie = `${cookieName}=${newLocale}; path
|
|
48
|
+
document.cookie = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
|
|
49
49
|
}
|
|
50
50
|
else if (strat === "baseLocale") {
|
|
51
51
|
// nothing to be set here. baseLocale is only a fallback
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { test, expect, vi } from "vitest";
|
|
2
|
-
import { createParaglide } from "../create-paraglide.js";
|
|
3
1
|
import { newProject } from "@inlang/sdk";
|
|
2
|
+
import { expect, test, vi } from "vitest";
|
|
3
|
+
import { createParaglide } from "../create-paraglide.js";
|
|
4
4
|
test("sets the cookie to a different locale", async () => {
|
|
5
5
|
// @ts-expect-error - global variable definition
|
|
6
6
|
globalThis.document = {};
|
|
@@ -24,7 +24,7 @@ test("sets the cookie to a different locale", async () => {
|
|
|
24
24
|
globalThis.document.cookie = "PARAGLIDE_LOCALE=en";
|
|
25
25
|
runtime.setLocale("de");
|
|
26
26
|
// set the locale
|
|
27
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path
|
|
27
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000");
|
|
28
28
|
// reloads the site if window is available
|
|
29
29
|
expect(globalThis.window.location.reload).toBeCalled();
|
|
30
30
|
});
|
|
@@ -75,7 +75,7 @@ test("sets the cookie when it's an empty string", async () => {
|
|
|
75
75
|
/** @ts-expect-error - client side api */
|
|
76
76
|
globalThis.document = { cookie: "" };
|
|
77
77
|
runtime.setLocale("en");
|
|
78
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path
|
|
78
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000");
|
|
79
79
|
});
|
|
80
80
|
test("when strategy precedes URL, it should set the locale and re-direct to the URL", async () => {
|
|
81
81
|
const runtime = await createParaglide({
|
|
@@ -108,7 +108,7 @@ test("when strategy precedes URL, it should set the locale and re-direct to the
|
|
|
108
108
|
// Cookie strategy should determine locale as French
|
|
109
109
|
expect(runtime.getLocale()).toBe("fr");
|
|
110
110
|
runtime.setLocale("en");
|
|
111
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path
|
|
111
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000");
|
|
112
112
|
expect(globalThis.window.location.href).toBe("https://example.com/en/some-path");
|
|
113
113
|
});
|
|
114
114
|
// https://github.com/opral/inlang-paraglide-js/issues/430
|
|
@@ -136,12 +136,12 @@ test("should not reload when setting locale to current locale", async () => {
|
|
|
136
136
|
// Setting to the current locale (en)
|
|
137
137
|
runtime.setLocale("en");
|
|
138
138
|
// Cookie should remain unchanged
|
|
139
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path
|
|
139
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000");
|
|
140
140
|
// Should not trigger a reload
|
|
141
141
|
expect(globalThis.window.location.reload).not.toBeCalled();
|
|
142
142
|
// Setting to a different locale should still work
|
|
143
143
|
runtime.setLocale("de");
|
|
144
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path
|
|
144
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000");
|
|
145
145
|
expect(globalThis.window.location.reload).toBeCalled();
|
|
146
146
|
});
|
|
147
147
|
test("sets the locale to localStorage", async () => {
|
|
@@ -211,5 +211,5 @@ test("should set locale in all configured storage mechanisms regardless of which
|
|
|
211
211
|
// Verify that all storage mechanisms are updated
|
|
212
212
|
expect(globalThis.window.location.href).toBe("https://example.com/fr/page");
|
|
213
213
|
expect(globalThis.localStorage.setItem).toHaveBeenCalledWith("PARAGLIDE_LOCALE", "fr");
|
|
214
|
-
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=fr; path
|
|
214
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=fr; path=/; max-age=34560000");
|
|
215
215
|
});
|
|
@@ -6,6 +6,7 @@ export type Runtime = {
|
|
|
6
6
|
locales: typeof import("./variables.js").locales;
|
|
7
7
|
strategy: typeof import("./variables.js").strategy;
|
|
8
8
|
cookieName: typeof import("./variables.js").cookieName;
|
|
9
|
+
cookieMaxAge: typeof import("./variables.js").cookieMaxAge;
|
|
9
10
|
urlPatterns: typeof import("./variables.js").urlPatterns;
|
|
10
11
|
disableAsyncLocalStorage: typeof import("./variables.js").disableAsyncLocalStorage;
|
|
11
12
|
serverAsyncLocalStorage: typeof import("./variables.js").serverAsyncLocalStorage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG;IACrB,UAAU,EAAE,cAAc,gBAAgB,EAAE,UAAU,CAAC;IACvD,OAAO,EAAE,cAAc,gBAAgB,EAAE,OAAO,CAAC;IACjD,QAAQ,EAAE,cAAc,gBAAgB,EAAE,QAAQ,CAAC;IACnD,UAAU,EAAE,cAAc,gBAAgB,EAAE,UAAU,CAAC;IACvD,WAAW,EAAE,cAAc,gBAAgB,EAAE,WAAW,CAAC;IACzD,wBAAwB,EA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5D,aAAa,EAAE,cAAc,mBAAmB,EAAE,aAAa,CAAC;IAChE,oBAAoB,EAAE,cAAc,8BAA8B,EAAE,oBAAoB,CAAC;IACzF,wBAAwB,EAAE,cAAc,kCAAkC,EAAE,wBAAwB,CAAC;IACrG,uBAAuB,EAAE,cAAc,iCAAiC,EAAE,uBAAuB,CAAC;IAClG,2BAA2B,EAAE,cAAc,qCAAqC,EAAE,2BAA2B,CAAC;IAC9G,gBAAgB,EAAE,cAAc,yBAAyB,EAAE,gBAAgB,CAAC;CAC5E,CAAC"}
|
|
@@ -29,6 +29,8 @@ export const baseLocale: "en";
|
|
|
29
29
|
export const locales: readonly ["en", "de"];
|
|
30
30
|
/** @type {string} */
|
|
31
31
|
export const cookieName: string;
|
|
32
|
+
/** @type {number} */
|
|
33
|
+
export const cookieMaxAge: number;
|
|
32
34
|
/** @type {string} */
|
|
33
35
|
export const localStorageKey: string;
|
|
34
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/variables.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/variables.js"],"names":[],"mappings":"AAqEA;;;;;;;;;GASG;AACH,wDAFW,0BAA0B,GAAG,SAAS,QAIhD;AAjFD;;;;;;;GAOG;AACH,yBAA0B,IAAI,CAAC;AAE/B;;;;;;;GAOG;AACH,4CAA2D;AAE3D,qBAAqB;AACrB,yBADW,MAAM,CACyB;AAE1C,qBAAqB;AACrB,2BADW,MAAM,CAC8B;AAE/C,qBAAqB;AACrB,8BADW,MAAM,CACiC;AAElD;;GAEG;AACH,uBAFU,KAAK,CAAC,QAAQ,GAAG,YAAY,GAAG,gBAAgB,GAAG,KAAK,GAAG,mBAAmB,GAAG,cAAc,CAAC,CAE/D;AAE3C;;;;GAIG;AACH,0BAFU,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC,CAE1C;AAE9B;;;;;;;;;;GAUG;AAEH;;;;;;;GAOG;AACH,oCAFU,0BAA0B,GAAG,SAAS,CAED;AAE/C,uCAAwC,KAAK,CAAC;AAE9C,oDAAqD,KAAK,CAAC;AAE3D,+BAAsD;AAgBtD,8CAA+C,KAAK,CAAC;AAErD,2CAA4C,KAAK,CAAC;AAElD,uDAAwD,KAAK,CAAC;AAE9D,0DAA2D,KAAK,CAAC;AAEjE,kDAAmD,KAAK,CAAC;AAEzD,qDAAsD,KAAK,CAAC;yCAnD/C;IACR,QAAQ,IAAI;QACV,MAAM,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;KACzB,GAAG,SAAS,CAAC;IACf,GAAG,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;KAAC,EAC3E,EAAE,EAAE,GAAG,KAAK,GAAG,CAAA;CACjB"}
|
|
@@ -18,6 +18,8 @@ export const baseLocale = "en";
|
|
|
18
18
|
export const locales = /** @type {const} */ (["en", "de"]);
|
|
19
19
|
/** @type {string} */
|
|
20
20
|
export const cookieName = "<cookie-name>";
|
|
21
|
+
/** @type {number} */
|
|
22
|
+
export const cookieMaxAge = 60 * 60 * 24 * 400;
|
|
21
23
|
/** @type {string} */
|
|
22
24
|
export const localStorageKey = "PARAGLIDE_LOCALE";
|
|
23
25
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inlang/paraglide-js",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"unplugin": "^2.1.2",
|
|
33
33
|
"urlpattern-polyfill": "^10.0.0",
|
|
34
34
|
"@inlang/recommend-sherlock": "0.2.1",
|
|
35
|
-
"@inlang/sdk": "2.4.
|
|
35
|
+
"@inlang/sdk": "2.4.4"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@eslint/js": "^9.18.0",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"typescript": "^5.7.3",
|
|
51
51
|
"typescript-eslint": "^8.20.0",
|
|
52
52
|
"vitest": "2.1.8",
|
|
53
|
-
"@inlang/
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
53
|
+
"@inlang/plugin-message-format": "4.0.0",
|
|
54
|
+
"@inlang/paraglide-js": "2.0.5",
|
|
55
|
+
"@opral/tsconfig": "1.1.0"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [
|
|
58
58
|
"inlang",
|