40 lines
912 B
Plaintext
40 lines
912 B
Plaintext
# Task 06: Configure @lobehub/i18n-cli
|
|
|
|
## Completed Actions
|
|
|
|
1. **Installed @lobehub/i18n-cli@^1.26.1** as dev dependency
|
|
2. **Added npm script**: `"i18n": "lobe-i18n"` to package.json
|
|
3. **Verified CLI works**: `npm run i18n -- --help` returns usage info
|
|
|
|
## Existing Configuration (.i18nrc.js)
|
|
|
|
```javascript
|
|
module.exports = {
|
|
entry: ['src/renderer/src/locales/default/*.json'],
|
|
output: 'src/renderer/src/locales',
|
|
entryLocale: 'zh-CN',
|
|
outputLocales: ['en-US', 'ja-JP'],
|
|
apiKey: process.env.OPENAI_API_KEY || '',
|
|
apiModel: 'gpt-4o-mini',
|
|
};
|
|
```
|
|
|
|
## CLI Usage
|
|
|
|
```bash
|
|
# Run translation
|
|
npm run i18n
|
|
|
|
# With markdown translation
|
|
npm run i18n -- --with-md
|
|
|
|
# Lint translations
|
|
npm run i18n -- --lint
|
|
```
|
|
|
|
## Notes
|
|
|
|
- Source locale: zh-CN (in `locales/default/`)
|
|
- Output locales: en-US, ja-JP
|
|
- API key must be set via `OPENAI_API_KEY` environment variable
|
|
- Uses gpt-4o-mini model for translation |