Skip to content

Commit 1fb308a

Browse files
committed
Refactor i18n locales from JSON to TypeScript modules
1 parent f10d4d3 commit 1fb308a

File tree

6 files changed

+8
-5
lines changed

6 files changed

+8
-5
lines changed

src/bundle.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ async function runReactNativeBundleCommand({
225225

226226
if (disableHermes) {
227227
hermesEnabled = false;
228+
console.log('Hermes disabled');
228229
} else if (platform === 'android') {
229230
const gradlePropeties = await new Promise<{
230231
hermesEnabled?: boolean;

src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { printVersionCommand } from './utils';
66
import pkg from '../package.json';
77
import path from 'node:path';
88
import i18next from 'i18next';
9+
import en from './locales/en';
10+
import zh from './locales/zh';
911

1012
const scriptName: 'cresc' | 'pushy' = path.basename(process.argv[1]) as
1113
| 'cresc'
@@ -14,10 +16,10 @@ global.IS_CRESC = scriptName === 'cresc';
1416

1517
i18next.init({
1618
lng: global.IS_CRESC ? 'en' : 'zh',
17-
debug: process.env.NODE_ENV !== 'production',
19+
// debug: process.env.NODE_ENV !== 'production',
1820
resources: {
19-
en: require('./locales/en.json'),
20-
zh: require('./locales/zh.json'),
21+
en,
22+
zh,
2123
},
2224
});
2325

src/locale/en.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/locale/zh.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {};

src/locales/zh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {};

0 commit comments

Comments
 (0)