intor 2.3.28 → 2.3.29

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.
@@ -1,6 +1,7 @@
1
1
  import { headers, cookies } from 'next/headers';
2
2
  import { INTOR_HEADERS } from '../../../core/constants/headers.js';
3
3
  import '../../../core/error/intor-error.js';
4
+ import { normalizeLocale } from '../../../core/utils/normalizers/normalize-locale.js';
4
5
  import 'logry';
5
6
  import 'p-limit';
6
7
 
@@ -21,7 +22,9 @@ const getLocale = async (config) => {
21
22
  const cookieStore = await cookies();
22
23
  const cookieLocale = cookieStore.get(config.cookie.name)?.value;
23
24
  if (cookieLocale) {
24
- return cookieLocale;
25
+ const resolved = normalizeLocale(cookieLocale, config.supportedLocales);
26
+ if (resolved)
27
+ return resolved;
25
28
  }
26
29
  // Explicit default
27
30
  return config.defaultLocale;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intor",
3
- "version": "2.3.28",
3
+ "version": "2.3.29",
4
4
  "description": "The i18n library for modern JavaScript",
5
5
  "author": "Yiming Liao",
6
6
  "homepage": "https://github.com/yiming-liao/intor#readme",