1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-11-08 10:15:47 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

init i18n

This commit is contained in:
sunnylqm
2025-02-15 00:38:55 +08:00
parent 814a9d10fb
commit 0f44de772f
8 changed files with 33 additions and 5 deletions

View File

@@ -121,7 +121,7 @@ export async function uploadFile(fn: string, key?: string) {
timeout: 1000,
});
// console.log({pingResult});
if (isNaN(pingResult.avg) || pingResult.avg > 150) {
if (Number.isNaN(pingResult.avg) || pingResult.avg > 150) {
realUrl = backupUrl;
}
}

View File

@@ -2,8 +2,24 @@
import { loadSession } from './api';
import updateNotifier from 'update-notifier';
import { printVersionCommand } from './utils/index.js';
import { printVersionCommand } from './utils';
import pkg from '../package.json';
import path from 'node:path';
import i18next from 'i18next';
const scriptName: 'cresc' | 'pushy' = path.basename(process.argv[1]) as
| 'cresc'
| 'pushy';
global.IS_CRESC = scriptName === 'cresc';
i18next.init({
lng: global.IS_CRESC ? 'en' : 'zh',
debug: process.env.NODE_ENV !== 'production',
resources: {
en: require('./locales/en.json'),
zh: require('./locales/zh.json'),
},
});
updateNotifier({ pkg }).notify({
isGlobal: true,

1
src/locale/en.json Normal file
View File

@@ -0,0 +1 @@
{}

1
src/locale/zh.json Normal file
View File

@@ -0,0 +1 @@
{}

View File

@@ -1,6 +1,7 @@
declare global {
var NO_INTERACTIVE: boolean;
var USE_ACC_OSS: boolean;
var IS_CRESC: boolean;
}
export interface Session {

View File

@@ -55,7 +55,7 @@ export function getRNVersion() {
};
}
export async function getApkInfo(fn) {
export async function getApkInfo(fn: string) {
const appInfoParser = new AppInfoParser(fn);
const bundleFile = await appInfoParser.parser.getEntry(
/assets\/index.android.bundle/,