Dynamically Load I18n Language Packs
Overview
FlyEnv version 4.9.1 and above supports dynamic loading of local I18n language packs. This guide provides detailed instructions on how to create and use custom language packs.
Prerequisites
- Ensure FlyEnv is upgraded to version 4.9.1 or higher
- Basic JSON file editing skills are required
Step-by-Step Instructions
1. Access Language Settings
- Navigate to
Settings
→Setting
- The language settings area contains two buttons:
Load Local Language Pack
: Refreshes and loads language packsOpen Language Pack Folder
: Accesses the language pack directory
2. Create a Language Pack
- Click
Open Language Pack Folder
- View the example language pack structure
- Duplicate the example folder (recommended to rename using target language code, e.g.,
jp
for Japanese)
- Modify the
index.json
file:json{ "lang": "jp", "label": "日本語" }
3. Translate Language Files
Edit JSON translation files, such as base.json
:
json
{
"add": "追加",
"open": "開く",
"enable": "有効",
"disable": "無効",
// Other translation items...
}
4. Load and Use Language Packs
- Return to FlyEnv and click
Load Local Language Pack
- Select the newly added language from the dropdown menu
- The interface will immediately switch to the selected language
5. Debugging and Updates
- After modifying translation files, click
Load Local Language Pack
again to refresh - View changes in real-time
Best Practices
- Backup: Always backup original files before making changes
- Incremental Translation: Start with frequently used terms and expand gradually
- Version Control: Use Git to manage translation files
Share Your Translations
We welcome contributions to:
Important Notes
- Recommended language pack folder naming: standard language codes (e.g., en, jp, zh)
- Ensure JSON format remains correct when editing files
- Only modify values, do not change key names