@norcy/react-native-toolkit 0.1.9 → 0.1.10
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/lib/commonjs/WeChatLoginUtil.js +2 -2
- package/lib/commonjs/WeChatLoginUtil.js.map +1 -1
- package/lib/commonjs/index.js +0 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/WeChatLoginUtil.js +2 -2
- package/lib/module/WeChatLoginUtil.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/{src/index.d.ts → index.d.ts} +0 -1
- package/package.json +1 -1
- package/src/WeChatLoginUtil.ts +2 -2
- package/src/index.tsx +0 -1
- package/lib/commonjs/i18n.js +0 -46
- package/lib/commonjs/i18n.js.map +0 -1
- package/lib/module/i18n.js +0 -39
- package/lib/module/i18n.js.map +0 -1
- package/lib/typescript/src/i18n.d.ts +0 -5
- package/src/i18n.ts +0 -42
- /package/lib/typescript/{src/AppleLoginUtil.d.ts → AppleLoginUtil.d.ts} +0 -0
- /package/lib/typescript/{src/Notification.d.ts → Notification.d.ts} +0 -0
- /package/lib/typescript/{src/PrefData.d.ts → PrefData.d.ts} +0 -0
- /package/lib/typescript/{src/ReportUtil.d.ts → ReportUtil.d.ts} +0 -0
- /package/lib/typescript/{src/SentryManager.d.ts → SentryManager.d.ts} +0 -0
- /package/lib/typescript/{src/SyncPrefData.d.ts → SyncPrefData.d.ts} +0 -0
- /package/lib/typescript/{src/WeChatLoginUtil.d.ts → WeChatLoginUtil.d.ts} +0 -0
- /package/lib/typescript/{src/constant.d.ts → constant.d.ts} +0 -0
|
@@ -17,8 +17,8 @@ const WeChatLoginUtil = exports.WeChatLoginUtil = {
|
|
|
17
17
|
}).then(res => {
|
|
18
18
|
console.log('wechat get access code success: ', res.access_token);
|
|
19
19
|
let userInfoUrl = 'https://api.weixin.qq.com/sns/userinfo?access_token=' + res.access_token + '&openid=' + res.openid;
|
|
20
|
-
fetch(userInfoUrl).then(
|
|
21
|
-
return
|
|
20
|
+
fetch(userInfoUrl).then(res2 => {
|
|
21
|
+
return res2.json();
|
|
22
22
|
}).then(json => {
|
|
23
23
|
console.log('wechat get user info success: ', json);
|
|
24
24
|
callback({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WeChat","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","WeChatLoginUtil","exports","doLogin","WeiXinId","WeiXinSecret","callback","sendAuthRequest","then","ret","console","log","accessTokenUrl","code","fetch","res","json","access_token","userInfoUrl","openid","nickname","headimgurl","unionid","catch","e","warn","error"],"sources":["WeChatLoginUtil.ts"],"sourcesContent":["import * as WeChat from 'react-native-wechat-lib';\n\nexport const WeChatLoginUtil = {\n doLogin: (WeiXinId: string, WeiXinSecret: string, callback: Function) => {\n WeChat.sendAuthRequest('snsapi_userinfo')\n .then((ret) => {\n console.log('wechat auth success ', ret);\n\n let accessTokenUrl =\n 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' +\n WeiXinId +\n '&secret=' +\n WeiXinSecret +\n '&code=' +\n ret.code +\n '&grant_type=authorization_code';\n fetch(accessTokenUrl)\n .then((res) => {\n return res.json();\n })\n .then((res) => {\n console.log('wechat get access code success: ', res.access_token);\n let userInfoUrl =\n 'https://api.weixin.qq.com/sns/userinfo?access_token=' +\n res.access_token +\n '&openid=' +\n res.openid;\n fetch(userInfoUrl)\n .then((
|
|
1
|
+
{"version":3,"names":["WeChat","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","WeChatLoginUtil","exports","doLogin","WeiXinId","WeiXinSecret","callback","sendAuthRequest","then","ret","console","log","accessTokenUrl","code","fetch","res","json","access_token","userInfoUrl","openid","res2","nickname","headimgurl","unionid","catch","e","warn","error"],"sources":["WeChatLoginUtil.ts"],"sourcesContent":["import * as WeChat from 'react-native-wechat-lib';\n\nexport const WeChatLoginUtil = {\n doLogin: (WeiXinId: string, WeiXinSecret: string, callback: Function) => {\n WeChat.sendAuthRequest('snsapi_userinfo')\n .then((ret) => {\n console.log('wechat auth success ', ret);\n\n let accessTokenUrl =\n 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' +\n WeiXinId +\n '&secret=' +\n WeiXinSecret +\n '&code=' +\n ret.code +\n '&grant_type=authorization_code';\n fetch(accessTokenUrl)\n .then((res) => {\n return res.json();\n })\n .then((res) => {\n console.log('wechat get access code success: ', res.access_token);\n let userInfoUrl =\n 'https://api.weixin.qq.com/sns/userinfo?access_token=' +\n res.access_token +\n '&openid=' +\n res.openid;\n fetch(userInfoUrl)\n .then((res2) => {\n return res2.json();\n })\n .then((json) => {\n console.log('wechat get user info success: ', json);\n callback({\n nickname: json.nickname,\n headimgurl: json.headimgurl,\n openid: json.openid,\n unionid: json.unionid,\n });\n })\n .catch((e) => {\n console.warn('wechat get user info fail ', e);\n callback({ error: e });\n });\n })\n .catch((e) => {\n console.warn('wechat get access code fail ', e);\n callback({ error: e });\n });\n })\n .catch((e: any) => {\n console.warn('wechat auth fail ', e);\n callback({ error: e });\n });\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAkD,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA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EF;MAAE,CAAC,CAAC;IACxB,CAAC,CAAC;EACN;AACF,CAAC"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -102,18 +102,6 @@ Object.keys(_constant).forEach(function (key) {
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
var _i18n = require("./i18n");
|
|
106
|
-
Object.keys(_i18n).forEach(function (key) {
|
|
107
|
-
if (key === "default" || key === "__esModule") return;
|
|
108
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
109
|
-
if (key in exports && exports[key] === _i18n[key]) return;
|
|
110
|
-
Object.defineProperty(exports, key, {
|
|
111
|
-
enumerable: true,
|
|
112
|
-
get: function () {
|
|
113
|
-
return _i18n[key];
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
105
|
const {
|
|
118
106
|
ReactNativeToolkit
|
|
119
107
|
} = _reactNative.NativeModules;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_AppleLoginUtil","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Notification","_PrefData","_ReportUtil","_SentryManager","_SyncPrefData","_WeChatLoginUtil","_constant","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_AppleLoginUtil","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Notification","_PrefData","_ReportUtil","_SentryManager","_SyncPrefData","_WeChatLoginUtil","_constant","ReactNativeToolkit","NativeModules","_default","default"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules } from 'react-native';\n\ntype ReactNativeToolkitType = {\n multiply(a: number, b: number): Promise<number>;\n};\n\nconst { ReactNativeToolkit } = NativeModules;\n\nexport default ReactNativeToolkit as ReactNativeToolkitType;\nexport * from './AppleLoginUtil';\nexport * from './Notification';\nexport * from './PrefData';\nexport * from './ReportUtil';\nexport * from './SentryManager';\nexport * from './SyncPrefData';\nexport * from './W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AC,GAAGC,0BAAa;AAAC,IAAAC,QAAA,GAAAb,OAAA,CAAAc,OAAA,GAE9BH,kBAAkB"}
|
|
@@ -9,8 +9,8 @@ export const WeChatLoginUtil = {
|
|
|
9
9
|
}).then(res => {
|
|
10
10
|
console.log('wechat get access code success: ', res.access_token);
|
|
11
11
|
let userInfoUrl = 'https://api.weixin.qq.com/sns/userinfo?access_token=' + res.access_token + '&openid=' + res.openid;
|
|
12
|
-
fetch(userInfoUrl).then(
|
|
13
|
-
return
|
|
12
|
+
fetch(userInfoUrl).then(res2 => {
|
|
13
|
+
return res2.json();
|
|
14
14
|
}).then(json => {
|
|
15
15
|
console.log('wechat get user info success: ', json);
|
|
16
16
|
callback({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WeChat","WeChatLoginUtil","doLogin","WeiXinId","WeiXinSecret","callback","sendAuthRequest","then","ret","console","log","accessTokenUrl","code","fetch","res","json","access_token","userInfoUrl","openid","nickname","headimgurl","unionid","catch","e","warn","error"],"sources":["WeChatLoginUtil.ts"],"sourcesContent":["import * as WeChat from 'react-native-wechat-lib';\n\nexport const WeChatLoginUtil = {\n doLogin: (WeiXinId: string, WeiXinSecret: string, callback: Function) => {\n WeChat.sendAuthRequest('snsapi_userinfo')\n .then((ret) => {\n console.log('wechat auth success ', ret);\n\n let accessTokenUrl =\n 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' +\n WeiXinId +\n '&secret=' +\n WeiXinSecret +\n '&code=' +\n ret.code +\n '&grant_type=authorization_code';\n fetch(accessTokenUrl)\n .then((res) => {\n return res.json();\n })\n .then((res) => {\n console.log('wechat get access code success: ', res.access_token);\n let userInfoUrl =\n 'https://api.weixin.qq.com/sns/userinfo?access_token=' +\n res.access_token +\n '&openid=' +\n res.openid;\n fetch(userInfoUrl)\n .then((
|
|
1
|
+
{"version":3,"names":["WeChat","WeChatLoginUtil","doLogin","WeiXinId","WeiXinSecret","callback","sendAuthRequest","then","ret","console","log","accessTokenUrl","code","fetch","res","json","access_token","userInfoUrl","openid","res2","nickname","headimgurl","unionid","catch","e","warn","error"],"sources":["WeChatLoginUtil.ts"],"sourcesContent":["import * as WeChat from 'react-native-wechat-lib';\n\nexport const WeChatLoginUtil = {\n doLogin: (WeiXinId: string, WeiXinSecret: string, callback: Function) => {\n WeChat.sendAuthRequest('snsapi_userinfo')\n .then((ret) => {\n console.log('wechat auth success ', ret);\n\n let accessTokenUrl =\n 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' +\n WeiXinId +\n '&secret=' +\n WeiXinSecret +\n '&code=' +\n ret.code +\n '&grant_type=authorization_code';\n fetch(accessTokenUrl)\n .then((res) => {\n return res.json();\n })\n .then((res) => {\n console.log('wechat get access code success: ', res.access_token);\n let userInfoUrl =\n 'https://api.weixin.qq.com/sns/userinfo?access_token=' +\n res.access_token +\n '&openid=' +\n res.openid;\n fetch(userInfoUrl)\n .then((res2) => {\n return res2.json();\n })\n .then((json) => {\n console.log('wechat get user info success: ', json);\n callback({\n nickname: json.nickname,\n headimgurl: json.headimgurl,\n openid: json.openid,\n unionid: json.unionid,\n });\n })\n .catch((e) => {\n console.warn('wechat get user info fail ', e);\n callback({ error: e });\n });\n })\n .catch((e) => {\n console.warn('wechat get access code fail ', e);\n callback({ error: e });\n });\n })\n .catch((e: any) => {\n console.warn('wechat auth fail ', e);\n callback({ error: e });\n });\n },\n};\n"],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,yBAAyB;AAEjD,OAAO,MAAMC,eAAe,GAAG;EAC7BC,OAAO,EAAEA,CAACC,QAAgB,EAAEC,YAAoB,EAAEC,QAAkB,KAAK;IACvEL,MAAM,CAACM,eAAe,CAAC,iBAAiB,CAAC,CACtCC,IAAI,CAAEC,GAAG,IAAK;MACbC,OAAO,CAACC,GAAG,CAAC,sBAAsB,EAAEF,GAAG,CAAC;MAExC,IAAIG,cAAc,GAChB,0DAA0D,GAC1DR,QAAQ,GACR,UAAU,GACVC,YAAY,GACZ,QAAQ,GAC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CAAC;MACpCnB,QAAQ,CAAC;QAAEqB,KAAK,EAAEF;MAAE,CAAC,CAAC;IACxB,CAAC,CAAC;EACN;AACF,CAAC"}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","ReactNativeToolkit"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules } from 'react-native';\n\ntype ReactNativeToolkitType = {\n multiply(a: number, b: number): Promise<number>;\n};\n\nconst { ReactNativeToolkit } = NativeModules;\n\nexport default ReactNativeToolkit as ReactNativeToolkitType;\nexport * from './AppleLoginUtil';\nexport * from './Notification';\nexport * from './PrefData';\nexport * from './ReportUtil';\nexport * from './SentryManager';\nexport * from './SyncPrefData';\nexport * from './WeChatLoginUtil';\nexport * from './constant';\
|
|
1
|
+
{"version":3,"names":["NativeModules","ReactNativeToolkit"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules } from 'react-native';\n\ntype ReactNativeToolkitType = {\n multiply(a: number, b: number): Promise<number>;\n};\n\nconst { ReactNativeToolkit } = NativeModules;\n\nexport default ReactNativeToolkit as ReactNativeToolkitType;\nexport * from './AppleLoginUtil';\nexport * from './Notification';\nexport * from './PrefData';\nexport * from './ReportUtil';\nexport * from './SentryManager';\nexport * from './SyncPrefData';\nexport * from './WeChatLoginUtil';\nexport * from './constant';\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAM5C,MAAM;EAAEC;AAAmB,CAAC,GAAGD,aAAa;AAE5C,eAAeC,kBAAkB;AACjC,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,cAAc,iBAAiB;AAC/B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,YAAY"}
|
package/package.json
CHANGED
package/src/WeChatLoginUtil.ts
CHANGED
package/src/index.tsx
CHANGED
package/lib/commonjs/i18n.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.i18n = void 0;
|
|
7
|
-
var _reactNativeToolkit = require("@norcy/react-native-toolkit");
|
|
8
|
-
var _i18nJs = require("i18n-js");
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _enUS = _interopRequireDefault(require("../locales/en-US.json"));
|
|
11
|
-
var _zhCN = _interopRequireDefault(require("../locales/zh-CN.json"));
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
/**
|
|
14
|
-
* 多语言配置文件
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const i18n = exports.i18n = new _i18nJs.I18n();
|
|
18
|
-
i18n.enableFallback = true;
|
|
19
|
-
|
|
20
|
-
// 加载语言包
|
|
21
|
-
i18n.translations = {
|
|
22
|
-
zh: _zhCN.default,
|
|
23
|
-
en: _enUS.default
|
|
24
|
-
};
|
|
25
|
-
i18n.locale = 'zh';
|
|
26
|
-
const language = _reactNativeToolkit.SyncPrefData.getPrefString('language');
|
|
27
|
-
console.log('i18n init', language);
|
|
28
|
-
if (language == 'en') {
|
|
29
|
-
i18n.locale = 'en';
|
|
30
|
-
} else if (language == 'zh') {} else {
|
|
31
|
-
// 空的 或 auto
|
|
32
|
-
if (_reactNative.NativeModules.RNLocalize) {
|
|
33
|
-
var _locales$;
|
|
34
|
-
const RNLocalize = require('react-native-localize');
|
|
35
|
-
const locales = RNLocalize.getLocales();
|
|
36
|
-
const systemLanguage = (_locales$ = locales[0]) === null || _locales$ === void 0 ? void 0 : _locales$.languageCode;
|
|
37
|
-
if (systemLanguage == 'en') {
|
|
38
|
-
i18n.locale = 'en';
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (__DEV__) {
|
|
43
|
-
// i18n.locale = 'en';
|
|
44
|
-
// i18n.locale = 'zh';
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=i18n.js.map
|
package/lib/commonjs/i18n.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeToolkit","require","_i18nJs","_reactNative","_enUS","_interopRequireDefault","_zhCN","obj","__esModule","default","i18n","exports","I18n","enableFallback","translations","zh","en","locale","language","SyncPrefData","getPrefString","console","log","NativeModules","RNLocalize","_locales$","locales","getLocales","systemLanguage","languageCode","__DEV__"],"sources":["i18n.ts"],"sourcesContent":["/**\n * 多语言配置文件\n */\n\nimport { SyncPrefData } from '@norcy/react-native-toolkit';\nimport { I18n } from 'i18n-js';\nimport { NativeModules } from 'react-native';\nimport en from '../locales/en-US.json';\nimport zh from '../locales/zh-CN.json';\n\nexport const i18n = new I18n();\n\ni18n.enableFallback = true;\n\n// 加载语言包\ni18n.translations = {\n zh,\n en,\n};\ni18n.locale = 'zh';\n\nconst language = SyncPrefData.getPrefString('language');\nconsole.log('i18n init', language);\nif (language == 'en') {\n i18n.locale = 'en';\n} else if (language == 'zh') {\n} else {\n // 空的 或 auto\n if (NativeModules.RNLocalize) {\n const RNLocalize = require('react-native-localize');\n const locales = RNLocalize.getLocales();\n const systemLanguage = locales[0]?.languageCode;\n if (systemLanguage == 'en') {\n i18n.locale = 'en';\n }\n }\n}\n\nif (__DEV__) {\n // i18n.locale = 'en';\n // i18n.locale = 'zh';\n}\n"],"mappings":";;;;;;AAIA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAAuC,SAAAI,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AARvC;AACA;AACA;;AAQO,MAAMG,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAG,IAAIE,YAAI,CAAC,CAAC;AAE9BF,IAAI,CAACG,cAAc,GAAG,IAAI;;AAE1B;AACAH,IAAI,CAACI,YAAY,GAAG;EAClBC,EAAE,EAAFA,aAAE;EACFC,EAAE,EAAFA;AACF,CAAC;AACDN,IAAI,CAACO,MAAM,GAAG,IAAI;AAElB,MAAMC,QAAQ,GAAGC,gCAAY,CAACC,aAAa,CAAC,UAAU,CAAC;AACvDC,OAAO,CAACC,GAAG,CAAC,WAAW,EAAEJ,QAAQ,CAAC;AAClC,IAAIA,QAAQ,IAAI,IAAI,EAAE;EACpBR,IAAI,CAACO,MAAM,GAAG,IAAI;AACpB,CAAC,MAAM,IAAIC,QAAQ,IAAI,IAAI,EAAE,CAC7B,CAAC,MAAM;EACL;EACA,IAAIK,0BAAa,CAACC,UAAU,EAAE;IAAA,IAAAC,SAAA;IAC5B,MAAMD,UAAU,GAAGvB,OAAO,CAAC,uBAAuB,CAAC;IACnD,MAAMyB,OAAO,GAAGF,UAAU,CAACG,UAAU,CAAC,CAAC;IACvC,MAAMC,cAAc,IAAAH,SAAA,GAAGC,OAAO,CAAC,CAAC,CAAC,cAAAD,SAAA,uBAAVA,SAAA,CAAYI,YAAY;IAC/C,IAAID,cAAc,IAAI,IAAI,EAAE;MAC1BlB,IAAI,CAACO,MAAM,GAAG,IAAI;IACpB;EACF;AACF;AAEA,IAAIa,OAAO,EAAE;EACX;EACA;AAAA"}
|
package/lib/module/i18n.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 多语言配置文件
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { SyncPrefData } from '@norcy/react-native-toolkit';
|
|
6
|
-
import { I18n } from 'i18n-js';
|
|
7
|
-
import { NativeModules } from 'react-native';
|
|
8
|
-
import en from '../locales/en-US.json';
|
|
9
|
-
import zh from '../locales/zh-CN.json';
|
|
10
|
-
export const i18n = new I18n();
|
|
11
|
-
i18n.enableFallback = true;
|
|
12
|
-
|
|
13
|
-
// 加载语言包
|
|
14
|
-
i18n.translations = {
|
|
15
|
-
zh,
|
|
16
|
-
en
|
|
17
|
-
};
|
|
18
|
-
i18n.locale = 'zh';
|
|
19
|
-
const language = SyncPrefData.getPrefString('language');
|
|
20
|
-
console.log('i18n init', language);
|
|
21
|
-
if (language == 'en') {
|
|
22
|
-
i18n.locale = 'en';
|
|
23
|
-
} else if (language == 'zh') {} else {
|
|
24
|
-
// 空的 或 auto
|
|
25
|
-
if (NativeModules.RNLocalize) {
|
|
26
|
-
var _locales$;
|
|
27
|
-
const RNLocalize = require('react-native-localize');
|
|
28
|
-
const locales = RNLocalize.getLocales();
|
|
29
|
-
const systemLanguage = (_locales$ = locales[0]) === null || _locales$ === void 0 ? void 0 : _locales$.languageCode;
|
|
30
|
-
if (systemLanguage == 'en') {
|
|
31
|
-
i18n.locale = 'en';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (__DEV__) {
|
|
36
|
-
// i18n.locale = 'en';
|
|
37
|
-
// i18n.locale = 'zh';
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=i18n.js.map
|
package/lib/module/i18n.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["SyncPrefData","I18n","NativeModules","en","zh","i18n","enableFallback","translations","locale","language","getPrefString","console","log","RNLocalize","_locales$","require","locales","getLocales","systemLanguage","languageCode","__DEV__"],"sources":["i18n.ts"],"sourcesContent":["/**\n * 多语言配置文件\n */\n\nimport { SyncPrefData } from '@norcy/react-native-toolkit';\nimport { I18n } from 'i18n-js';\nimport { NativeModules } from 'react-native';\nimport en from '../locales/en-US.json';\nimport zh from '../locales/zh-CN.json';\n\nexport const i18n = new I18n();\n\ni18n.enableFallback = true;\n\n// 加载语言包\ni18n.translations = {\n zh,\n en,\n};\ni18n.locale = 'zh';\n\nconst language = SyncPrefData.getPrefString('language');\nconsole.log('i18n init', language);\nif (language == 'en') {\n i18n.locale = 'en';\n} else if (language == 'zh') {\n} else {\n // 空的 或 auto\n if (NativeModules.RNLocalize) {\n const RNLocalize = require('react-native-localize');\n const locales = RNLocalize.getLocales();\n const systemLanguage = locales[0]?.languageCode;\n if (systemLanguage == 'en') {\n i18n.locale = 'en';\n }\n }\n}\n\nif (__DEV__) {\n // i18n.locale = 'en';\n // i18n.locale = 'zh';\n}\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,aAAa,QAAQ,cAAc;AAC5C,OAAOC,EAAE,MAAM,uBAAuB;AACtC,OAAOC,EAAE,MAAM,uBAAuB;AAEtC,OAAO,MAAMC,IAAI,GAAG,IAAIJ,IAAI,CAAC,CAAC;AAE9BI,IAAI,CAACC,cAAc,GAAG,IAAI;;AAE1B;AACAD,IAAI,CAACE,YAAY,GAAG;EAClBH,EAAE;EACFD;AACF,CAAC;AACDE,IAAI,CAACG,MAAM,GAAG,IAAI;AAElB,MAAMC,QAAQ,GAAGT,YAAY,CAACU,aAAa,CAAC,UAAU,CAAC;AACvDC,OAAO,CAACC,GAAG,CAAC,WAAW,EAAEH,QAAQ,CAAC;AAClC,IAAIA,QAAQ,IAAI,IAAI,EAAE;EACpBJ,IAAI,CAACG,MAAM,GAAG,IAAI;AACpB,CAAC,MAAM,IAAIC,QAAQ,IAAI,IAAI,EAAE,CAC7B,CAAC,MAAM;EACL;EACA,IAAIP,aAAa,CAACW,UAAU,EAAE;IAAA,IAAAC,SAAA;IAC5B,MAAMD,UAAU,GAAGE,OAAO,CAAC,uBAAuB,CAAC;IACnD,MAAMC,OAAO,GAAGH,UAAU,CAACI,UAAU,CAAC,CAAC;IACvC,MAAMC,cAAc,IAAAJ,SAAA,GAAGE,OAAO,CAAC,CAAC,CAAC,cAAAF,SAAA,uBAAVA,SAAA,CAAYK,YAAY;IAC/C,IAAID,cAAc,IAAI,IAAI,EAAE;MAC1Bb,IAAI,CAACG,MAAM,GAAG,IAAI;IACpB;EACF;AACF;AAEA,IAAIY,OAAO,EAAE;EACX;EACA;AAAA"}
|
package/src/i18n.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 多语言配置文件
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { SyncPrefData } from '@norcy/react-native-toolkit';
|
|
6
|
-
import { I18n } from 'i18n-js';
|
|
7
|
-
import { NativeModules } from 'react-native';
|
|
8
|
-
import en from '../locales/en-US.json';
|
|
9
|
-
import zh from '../locales/zh-CN.json';
|
|
10
|
-
|
|
11
|
-
export const i18n = new I18n();
|
|
12
|
-
|
|
13
|
-
i18n.enableFallback = true;
|
|
14
|
-
|
|
15
|
-
// 加载语言包
|
|
16
|
-
i18n.translations = {
|
|
17
|
-
zh,
|
|
18
|
-
en,
|
|
19
|
-
};
|
|
20
|
-
i18n.locale = 'zh';
|
|
21
|
-
|
|
22
|
-
const language = SyncPrefData.getPrefString('language');
|
|
23
|
-
console.log('i18n init', language);
|
|
24
|
-
if (language == 'en') {
|
|
25
|
-
i18n.locale = 'en';
|
|
26
|
-
} else if (language == 'zh') {
|
|
27
|
-
} else {
|
|
28
|
-
// 空的 或 auto
|
|
29
|
-
if (NativeModules.RNLocalize) {
|
|
30
|
-
const RNLocalize = require('react-native-localize');
|
|
31
|
-
const locales = RNLocalize.getLocales();
|
|
32
|
-
const systemLanguage = locales[0]?.languageCode;
|
|
33
|
-
if (systemLanguage == 'en') {
|
|
34
|
-
i18n.locale = 'en';
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (__DEV__) {
|
|
40
|
-
// i18n.locale = 'en';
|
|
41
|
-
// i18n.locale = 'zh';
|
|
42
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|