0.0.1-beta-2024-01-05-17-16-336 • Published 3 months ago
@blocklet/auto-i18n v0.0.1-beta-2024-01-05-17-16-336
auto-i18n
Use OpenAI to automatically translate localizations, supporting {}
placeholders and HTML tags within strings. Only new additions are translated each time. Compatible with both ESM and CJS, and supports most mainstream languages:
- en: English
- es: Spanish
- zh: Chinese (Simplified)
- zh-TW: Chinese (Traditional)
- ja: Japanese
- ko: Korean
- de: German
- hi: Hindi
- fr: French
- ar: Arabic
- ru: Russian
- pt: Portuguese
- id: Indonesian
- vi: Vietnamese
- th: Thai
Base
npx auto-i18n --help
# Custom parameters
npx auto-i18n --file en.js --thread 10 --languages zh,ja,ko --ignore **/dist,**/temp --type js
Getting Started
1. Add your OPENAI key to .env.development at the project root
OPENAI_CLIENT="xxxxxxxxxxxxxxxxxxxx"
2. Add new text to en.js
Any en.js file across the project is applicable, example:
export default {
verify: {
title: "Ownership Credential Required: {user_name}",
scan: "Connect your DID Wallet to provide ownership credentials",
confirm: "Review this operation on your DID Wallet",
success: "Your account is connected to this server",
},
};
3. Start the magic
npx auto-i18n
Option: 5. Adjust inappropriate translations
If some translations are unreliable, you can manually adjust them by directly modifying the value in other language files (such as zh.js).
Option: 6. Modify text
If a piece of text needs to be adjusted, we need to modify the content of a certain key in en.js, and all other languages will be updated automatically accordingly.
Tips
- Ensure the en.js file is a pure JS file; it should not import any libraries and should only export a standard JS object.
- If en.js is an ESM module, the generated language files in the same directory will be ESM; otherwise, they will be CJS.
- Sometimes GPT may malfunction, returning content that does not meet our format. If the translation process stops, simply re-execute the command.
0.0.1-beta-2024-02-05-16-56-064
3 months ago
0.0.1-beta-2024-02-05-16-54-274
3 months ago
0.0.1-beta-2024-01-08-15-35-964
4 months ago
0.0.1-beta-2024-01-08-09-54-505
4 months ago
0.0.1-beta-2024-01-08-15-34-039
4 months ago
0.0.1-beta-2024-01-08-10-21-718
4 months ago
0.0.1-beta-2024-01-05-19-42-293
4 months ago
0.0.1-beta-2024-01-05-19-31-928
4 months ago
0.0.1-beta-2024-01-05-19-28-946
4 months ago
0.0.1-beta-2024-01-05-19-28-076
4 months ago
0.0.1-beta-2024-01-05-17-57-506
4 months ago
0.0.1-beta-2024-01-05-17-16-336
4 months ago