mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-10-30 22:33:11 +08:00
add i18n
This commit is contained in:
@@ -30,7 +30,7 @@ function mapInfoResource (apkInfo, resourceMap) {
|
||||
iteratorObj(apkInfo)
|
||||
return apkInfo
|
||||
function iteratorObj (obj) {
|
||||
for (var i in obj) {
|
||||
for (const i in obj) {
|
||||
if (isArray(obj[i])) {
|
||||
iteratorArray(obj[i])
|
||||
} else if (isObject(obj[i])) {
|
||||
|
||||
28
src/utils/i18n.ts
Normal file
28
src/utils/i18n.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import i18next from 'i18next';
|
||||
import en from '../locales/en';
|
||||
import zh from '../locales/zh';
|
||||
import { IS_CRESC } from './constants';
|
||||
i18next.init({
|
||||
lng: IS_CRESC ? 'en' : 'zh',
|
||||
// debug: process.env.NODE_ENV !== 'production',
|
||||
resources: {
|
||||
en,
|
||||
zh,
|
||||
},
|
||||
});
|
||||
|
||||
declare module 'i18next' {
|
||||
// Extend CustomTypeOptions
|
||||
interface CustomTypeOptions {
|
||||
// custom namespace type, if you changed it
|
||||
defaultNS: 'en';
|
||||
// custom resources type
|
||||
resources: {
|
||||
en: typeof en;
|
||||
zh: typeof zh;
|
||||
};
|
||||
// other
|
||||
}
|
||||
}
|
||||
|
||||
export const t = i18next.t;
|
||||
@@ -11,6 +11,7 @@ import { checkPlugins } from './check-plugin';
|
||||
import { read } from 'read';
|
||||
import { tempDir } from './constants';
|
||||
import { depVersions } from './dep-versions';
|
||||
import { getCommitInfo } from './git';
|
||||
|
||||
export async function question(query: string, password?: boolean) {
|
||||
if (NO_INTERACTIVE) {
|
||||
@@ -168,6 +169,8 @@ async function getLatestVersion(pkgNames: string[]) {
|
||||
}
|
||||
|
||||
export async function printVersionCommand() {
|
||||
const result = await getCommitInfo();
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
let [latestPushyCliVersion, latestPushyVersion] = await getLatestVersion([
|
||||
'react-native-update-cli',
|
||||
'react-native-update',
|
||||
|
||||
Reference in New Issue
Block a user