Internationalization (i18n) Guide¶
This guide explains how to add new language support to the SSH Tunnel Manager web panel.
How to Add a New Language¶
Step 1: Create Language Resource File¶
-
Navigate to the
web/static/locales/directory -
Create a new JSON file named with the language code (e.g.,
fr.jsonfor French,de.jsonfor German) -
Copy the structure from
en.jsonand translate all the values
Step 2: Language File Structure¶
The language file should follow this structure:
{
"app": {
"title": "Your translation here",
"name": "Your translation here",
"help_title": "Your translation here"
},
"navigation": {
"help": "Your translation here",
"docker_hub": "Docker Hub",
"github": "GitHub",
"back": "Your translation here"
}
// ... continue with all sections
}
Step 3: Update Language Support¶
-
Open
web/static/i18n.js -
Find the
getSupportedLanguages()method -
Add your language to the array:
getSupportedLanguages() {
return [
{ code: 'en', name: 'English' },
{ code: 'zh', name: '中文' },
{ code: 'fr', name: 'Français' }, // Add your language here
// ... other languages
];
}
- Update the language validation in the
switchLanguage()method:
if (!["en", "zh", "fr"].includes(lang)) {
// Add your language code here
console.error(`Unsupported language: ${lang}`);
return false;
}
Step 4: Test Your Translation¶
-
Start the application
-
Use the language toggle button to switch to your new language
-
Verify that all text is properly translated
-
Check both the main page and help page
Translation Guidelines¶
Consistency¶
Use consistent terminology throughout the translation. Create a glossary of key terms if needed.
Context¶
Consider the context in which text appears:
- Buttons: Keep text short and action-oriented
- Labels: Be descriptive but concise
- Messages: Provide clear feedback to users
- Help text: Be thorough and helpful
Length¶
Keep translations reasonably similar in length to avoid UI layout issues. If a translation is significantly longer, consider:
- Using abbreviations
- Rephrasing for brevity
- Testing the UI to ensure it still looks good
Technical Terms¶
Some technical terms should remain in English:
- SSH
- Docker
- YAML
- API
- CLI
- Hash
Placeholders¶
Preserve placeholder formats in your translations:
The {{name}} placeholder must remain unchanged.
Common Translation Keys¶
| Key Pattern | Description |
|---|---|
app.* |
Application titles and names |
navigation.* |
Navigation elements and links |
table.* |
Table headers, placeholders, and content |
buttons.* |
Button labels and tooltips |
messages.* |
User feedback messages |
validation.* |
Form validation error messages |
help.* |
Help documentation content |
Currently Supported Languages¶
| Language | Code | Status |
|---|---|---|
| English | en | Complete |
| 简体中文 (Simplified Chinese) | zh | Complete |
| 繁體中文 (Traditional Chinese) | zh-hant | Complete |
| 日本語 (Japanese) | ja | Complete |
| 한국어 (Korean) | ko | Complete |
| Español (Spanish) | es | Complete |
| Français (French) | fr | Complete |
| Русский (Russian) | ru | Complete |
| العربية (Arabic) | ar | Complete |
Submitting Your Translation¶
-
Fork the repository
-
Create a new branch for your translation:
-
Add your language file to
web/static/locales/ -
Update
web/static/i18n.jsto include your language -
Test your translation thoroughly
-
Submit a pull request with:
- Clear description of the language added
- Confirmation that all strings are translated
- Any notes about translation choices
Testing Translations¶
Manual Testing Checklist¶
- [ ] All text on main page is translated
- [ ] All text on help page is translated
- [ ] Button tooltips are translated
- [ ] Error messages are translated
- [ ] Success messages are translated
- [ ] Placeholder text is translated
- [ ] Language persists after page refresh
- [ ] No layout issues with translated text
Browser Testing¶
Test in multiple browsers:
- Chrome
- Firefox
- Safari
- Edge
Mobile Testing¶
Verify translations display correctly on mobile devices.
Updating Existing Translations¶
If you find errors or want to improve existing translations:
-
Edit the appropriate language file in
web/static/locales/ -
Test your changes
-
Submit a pull request with a description of what was changed and why
Questions¶
If you have questions about translations:
- Open an issue on GitHub
- Contact the maintainers
Thank you for helping make SSH Tunnel Manager accessible to more users worldwide!