@astroscope/i18n 0.4.3 → 0.4.4
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/index.js +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -65,6 +65,10 @@ function createI18nChunkMiddleware() {
|
|
|
65
65
|
if (!pathname.startsWith(I18N_ENDPOINT_PREFIX)) {
|
|
66
66
|
return next();
|
|
67
67
|
}
|
|
68
|
+
if (!i18n.isConfigured()) {
|
|
69
|
+
console.warn(`[@astroscope/i18n] not configured, passing through: ${pathname}`);
|
|
70
|
+
return next();
|
|
71
|
+
}
|
|
68
72
|
const path = pathname.slice(I18N_ENDPOINT_PREFIX.length);
|
|
69
73
|
const slashIdx = path.indexOf("/");
|
|
70
74
|
if (slashIdx === -1) {
|
|
@@ -110,6 +114,10 @@ function createI18nMiddleware(options) {
|
|
|
110
114
|
if (shouldExclude(ctx, options.exclude ?? RECOMMENDED_EXCLUDES)) {
|
|
111
115
|
return next();
|
|
112
116
|
}
|
|
117
|
+
if (!i18n.isConfigured()) {
|
|
118
|
+
console.warn(`[@astroscope/i18n] not configured, passing through: ${ctx.url.pathname}`);
|
|
119
|
+
return next();
|
|
120
|
+
}
|
|
113
121
|
const locale = options.locale(ctx);
|
|
114
122
|
const context = {
|
|
115
123
|
locale,
|
package/package.json
CHANGED