From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001 From: rxliuli Date: Tue, 4 Nov 2025 05:03:50 +0800 Subject: init commit --- .../@jet-app/app-store/tmp/src/common/locale.js | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 node_modules/@jet-app/app-store/tmp/src/common/locale.js (limited to 'node_modules/@jet-app/app-store/tmp/src/common/locale.js') diff --git a/node_modules/@jet-app/app-store/tmp/src/common/locale.js b/node_modules/@jet-app/app-store/tmp/src/common/locale.js new file mode 100644 index 0000000..b829f75 --- /dev/null +++ b/node_modules/@jet-app/app-store/tmp/src/common/locale.js @@ -0,0 +1,36 @@ +/** + * Retrieve the active {@linkcode NormalizedLocale} for the client + * + * This can be useful in cases where you need to create a `RoutableIntent` + * but do not have access to an existing `RoutableIntent` to read the locale + * information off of. + * + * Note: this should be used only as a last resort. Wherever possible, prefer to + * retrieve the {@linkcode NormalizedLocale} data off of an existing `RoutableIntent` + * instead of depending on the global state in the {@linkcode AppStoreObjectGraph}. + */ +export function getLocale(objectGraph) { + return { + storefront: objectGraph.locale.activeStorefront, + language: objectGraph.locale.activeLanguage, + }; +} +/** + * Determine how the `NormalizedStorefront` should be encoded into a URL + * + * This provides a means by which the app can determine how the storefront and language + * should be represented when creating a URL that includes locale information. + * + * This can be used, for example, to opt out of expressing an explicit language when it would + * be the default for the given storefront. + */ +export function deriveLocaleForUrl(objectGraph, storefront) { + return objectGraph.locale.deriveLocaleForUrl(storefront); +} +/** + * Turns an {@linkcode UnnormalizedLocale} into a {@linkcode NormalizedLocale} + */ +export function normalizeLocale(objectGraph, unnormalizedLocale) { + return objectGraph.locale.normalize(unnormalizedLocale); +} +//# sourceMappingURL=locale.js.map \ No newline at end of file -- cgit v1.2.3