@dcloudio/uni-quickapp-webview 2.0.1-32920211122003 → 2.0.1-33420211228002

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.
Files changed (2) hide show
  1. package/dist/index.js +37 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -314,7 +314,7 @@ const promiseInterceptor = {
314
314
  };
315
315
 
316
316
  const SYNC_API_RE =
317
- /^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale/;
317
+ /^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale/;
318
318
 
319
319
  const CONTEXT_API_RE = /^create|Manager$/;
320
320
 
@@ -1445,12 +1445,34 @@ function handleEvent (event) {
1445
1445
  }
1446
1446
  }
1447
1447
 
1448
+ const messages = {};
1449
+
1448
1450
  let locale;
1449
1451
 
1450
1452
  {
1451
1453
  locale = qa.getSystemInfoSync().language;
1452
1454
  }
1453
1455
 
1456
+ function initI18nMessages () {
1457
+ if (!isEnableLocale()) {
1458
+ return
1459
+ }
1460
+ const localeKeys = Object.keys(__uniConfig.locales);
1461
+ if (localeKeys.length) {
1462
+ localeKeys.forEach((locale) => {
1463
+ const curMessages = messages[locale];
1464
+ const userMessages = __uniConfig.locales[locale];
1465
+ if (curMessages) {
1466
+ Object.assign(curMessages, userMessages);
1467
+ } else {
1468
+ messages[locale] = userMessages;
1469
+ }
1470
+ });
1471
+ }
1472
+ }
1473
+
1474
+ initI18nMessages();
1475
+
1454
1476
  const i18n = initVueI18n(
1455
1477
  locale,
1456
1478
  {}
@@ -1491,7 +1513,20 @@ function initAppLocale (Vue, appVm, locale) {
1491
1513
  localeWatchers.forEach(watch => watch(v));
1492
1514
  }
1493
1515
  });
1494
- }
1516
+ }
1517
+
1518
+ function isEnableLocale () {
1519
+ return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length
1520
+ }
1521
+
1522
+ // export function initI18n() {
1523
+ // const localeKeys = Object.keys(__uniConfig.locales || {})
1524
+ // if (localeKeys.length) {
1525
+ // localeKeys.forEach((locale) =>
1526
+ // i18n.add(locale, __uniConfig.locales[locale])
1527
+ // )
1528
+ // }
1529
+ // }
1495
1530
 
1496
1531
  const hooks = [
1497
1532
  'onShow',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-quickapp-webview",
3
- "version": "2.0.1-32920211122003",
3
+ "version": "2.0.1-33420211228002",
4
4
  "description": "uni-app quickapp-webview",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -17,5 +17,5 @@
17
17
  "name": "quickapp-webview",
18
18
  "title": "快应用(Webview)版"
19
19
  },
20
- "gitHead": "547072012788a28569b9b8d073b22715a9f6dbb1"
20
+ "gitHead": "638b12e8f1886590d8f16562c14240c354a66bb2"
21
21
  }