@freelog/tools-lib 0.1.105 → 0.1.106
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/tools-lib.cjs.development.js +17 -6
- package/dist/tools-lib.cjs.development.js.map +1 -1
- package/dist/tools-lib.cjs.production.min.js +1 -1
- package/dist/tools-lib.cjs.production.min.js.map +1 -1
- package/dist/tools-lib.esm.js +17 -6
- package/dist/tools-lib.esm.js.map +1 -1
- package/package.json +67 -65
- package/src/i18n/I18nNext.ts +146 -134
- package/src/i18n/index.ts +7 -7
- package/src/index.ts +9 -9
- package/src/service-API/i18n.ts +35 -35
- package/src/service-API/index.ts +35 -35
- package/src/utils/index.ts +20 -20
package/dist/tools-lib.esm.js
CHANGED
|
@@ -6,6 +6,7 @@ import NProgress from 'nprogress';
|
|
|
6
6
|
import 'nprogress/nprogress.css';
|
|
7
7
|
import { lib, SHA1 } from 'crypto-js';
|
|
8
8
|
import i18next from 'i18next';
|
|
9
|
+
import Cookies from 'js-cookie';
|
|
9
10
|
|
|
10
11
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
11
12
|
try {
|
|
@@ -2984,7 +2985,7 @@ var FUtil = {
|
|
|
2984
2985
|
};
|
|
2985
2986
|
|
|
2986
2987
|
var ossJsonUrl = 'https://freelog-i18n.oss-cn-shenzhen.aliyuncs.com/configs/i18n.json';
|
|
2987
|
-
var localStorage_i18nextLng_key = '
|
|
2988
|
+
var localStorage_i18nextLng_key = 'locale';
|
|
2988
2989
|
var localStorage_i18nextResources_key = 'i18nextResources';
|
|
2989
2990
|
var allLanguage = [{
|
|
2990
2991
|
value: 'en_US',
|
|
@@ -2998,8 +2999,9 @@ var self;
|
|
|
2998
2999
|
var I18nNext = /*#__PURE__*/function () {
|
|
2999
3000
|
function I18nNext() {
|
|
3000
3001
|
this._loadingData = 'NotStart';
|
|
3001
|
-
this._taskQueue = [];
|
|
3002
|
-
|
|
3002
|
+
this._taskQueue = []; // private _currentLanguage: LanguageKeyType = window.localStorage.getItem(localStorage_i18nextLng_key) as null || 'zh_CN';
|
|
3003
|
+
|
|
3004
|
+
this._currentLanguage = Cookies.get(localStorage_i18nextLng_key) || 'zh_CN';
|
|
3003
3005
|
self = this;
|
|
3004
3006
|
self.ready();
|
|
3005
3007
|
}
|
|
@@ -3093,7 +3095,11 @@ var I18nNext = /*#__PURE__*/function () {
|
|
|
3093
3095
|
|
|
3094
3096
|
_proto.changeLanguage = function changeLanguage(lng) {
|
|
3095
3097
|
// return i18next.changeLanguage(lng);
|
|
3096
|
-
window.localStorage.setItem(localStorage_i18nextLng_key, lng)
|
|
3098
|
+
// window.localStorage.setItem(localStorage_i18nextLng_key, lng)
|
|
3099
|
+
Cookies.set(localStorage_i18nextLng_key, lng, {
|
|
3100
|
+
expires: 36525,
|
|
3101
|
+
domain: FUtil.Format.completeUrlByDomain('').replace(/http(s)?:\/\//, '')
|
|
3102
|
+
});
|
|
3097
3103
|
};
|
|
3098
3104
|
|
|
3099
3105
|
_proto.getAllLanguage = function getAllLanguage() {
|
|
@@ -3112,7 +3118,8 @@ var I18nNext = /*#__PURE__*/function () {
|
|
|
3112
3118
|
switch (_context3.prev = _context3.next) {
|
|
3113
3119
|
case 0:
|
|
3114
3120
|
lng = self._currentLanguage;
|
|
3115
|
-
resource = window.localStorage.getItem(localStorage_i18nextResources_key);
|
|
3121
|
+
resource = window.localStorage.getItem(localStorage_i18nextResources_key); // const resource: string | undefined = Cookies.get(decodeURIComponent(localStorage_i18nextResources_key));
|
|
3122
|
+
|
|
3116
3123
|
i18nextResources = resource ? JSON.parse(resource) : null;
|
|
3117
3124
|
|
|
3118
3125
|
if (i18nextResources) {
|
|
@@ -3195,7 +3202,11 @@ var I18nNext = /*#__PURE__*/function () {
|
|
|
3195
3202
|
}
|
|
3196
3203
|
}; // console.log(result, 'result093sdolkfjlsdkjl');
|
|
3197
3204
|
|
|
3198
|
-
window.localStorage.setItem(localStorage_i18nextResources_key, JSON.stringify(result));
|
|
3205
|
+
window.localStorage.setItem(localStorage_i18nextResources_key, JSON.stringify(result)); // Cookies.set(localStorage_i18nextResources_key, encodeURIComponent(JSON.stringify(result)), {
|
|
3206
|
+
// expires: 36525,
|
|
3207
|
+
// domain: FUtil.Format.completeUrlByDomain('').replace(/http(s)?:\/\//, ''),
|
|
3208
|
+
// });
|
|
3209
|
+
|
|
3199
3210
|
return _context4.abrupt("return", result);
|
|
3200
3211
|
|
|
3201
3212
|
case 9:
|