next-intl 4.0.0-beta-c8eb4ad → 4.0.0-beta-7b755e9

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,4 +1,9 @@
1
+ import validateLocales from './validateLocales.js';
2
+
1
3
  function defineRouting(config) {
4
+ {
5
+ validateLocales(config.locales);
6
+ }
2
7
  return config;
3
8
  }
4
9
 
@@ -0,0 +1,14 @@
1
+ function validateLocales(locales) {
2
+ for (const locale of locales) {
3
+ try {
4
+ const constructed = new Intl.Locale(locale);
5
+ if (!constructed.language) {
6
+ throw new Error('Language is required');
7
+ }
8
+ } catch {
9
+ console.error(`Found invalid locale within provided \`locales\`: "${locale}"\nPlease ensure you're using a valid Unicode locale identifier (e.g. "en-US").`);
10
+ }
11
+ }
12
+ }
13
+
14
+ export { validateLocales as default };
@@ -0,0 +1,2 @@
1
+ import type { Locales } from './types.tsx';
2
+ export default function validateLocales(locales: Locales): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "4.0.0-beta-c8eb4ad",
3
+ "version": "4.0.0-beta-7b755e9",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -112,7 +112,7 @@
112
112
  "dependencies": {
113
113
  "@formatjs/intl-localematcher": "^0.5.4",
114
114
  "negotiator": "^1.0.0",
115
- "use-intl": "4.0.0-beta-c8eb4ad"
115
+ "use-intl": "4.0.0-beta-7b755e9"
116
116
  },
117
117
  "peerDependencies": {
118
118
  "next": "^13.0.0 || ^14.0.0 || ^15.0.0",
@@ -124,5 +124,5 @@
124
124
  "optional": true
125
125
  }
126
126
  },
127
- "gitHead": "0f3e1b49035abd86291ea92248a9b042e53fc549"
127
+ "gitHead": "ff4d528b0becc2d1c27232ea8f53351ff655cc50"
128
128
  }