@sunshaobei/dsh-session-manager 3.1.2 → 3.1.3
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/client.js +3 -1
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -224,7 +224,9 @@ window.__ModuleLoader__.load({
|
|
|
224
224
|
let hostTranslate;
|
|
225
225
|
|
|
226
226
|
function attachHostLocale(ctx) {
|
|
227
|
-
|
|
227
|
+
// 宿主暴露方式因版本而异:0.2.x 直接挂在 ctx.locale;旧版经 ctx.get('locale')。两种都试。
|
|
228
|
+
hostLocale = (ctx && ctx.locale && typeof ctx.locale.register === 'function') ? ctx.locale : undefined;
|
|
229
|
+
if (!hostLocale && typeof ctx?.get === 'function') { try { hostLocale = ctx.get('locale'); } catch { /* keep undefined */ } }
|
|
228
230
|
if (!hostLocale || typeof hostLocale.register !== 'function' || typeof hostLocale.bind !== 'function') return;
|
|
229
231
|
try {
|
|
230
232
|
const dispose = hostLocale.register(LOCALE_NS, MESSAGES);
|
package/package.json
CHANGED