i18n-guide
🌐 Complete i18n Guide
Master internationalization with LocEngine's powerful tools
What is i18n and Why Does It Matter?
Internationalization (i18n) is the process of preparing your software for multiple languages...
🔍 Step 1: Scanning Your Project
LocEngine supports over 190 file formats including:
How Scanning Works:
- Select your project folder
- Choose scan mode (Full/GUI/Fallback)
- LocEngine analyzes all supported files
- Strings are extracted with context
🔑 Step 2: Generating i18n Keys
LocEngine automatically creates meaningful keys from your strings:
Original Code:
print("Welcome to our application")
Generated Keys:
welcome_to_our_application welcome_message app_welcome
📤 Step 3: Exporting Keys
Export your keys to various formats:
JSON
{
"welcome_message": "Welcome"
}
PO/POT
msgid "welcome_message"
msgstr "Welcome"
CSV
key,value
welcome_message,Welcome
YAML
welcome_message: Welcome
💉 Step 4: Safe Injection into Your Code
🔤 i18n Function Format: tr('key_name')
LocEngine currently injects i18n keys using the tr() function format. This is a lightweight, framework-agnostic function that will be defined in your project.
Example Transformation:
Before Injection (Original Code):
def show_welcome():
print("Welcome to our application!")
print("Please select an option:")
def show_goodbye():
print("Thank you for using our app")
After Injection (with tr()):
def show_welcome():
print(tr('welcome_to_application'))
print(tr('please_select_option'))
def show_goodbye():
print(tr('thank_you_message'))
✅ Safe Key-by-Key Injection Process:
- Start Small: Select 1-2 keys for testing (e.g.,
welcome_to_application) - Preview Changes: Review how the code will be modified with
tr()wrapper - Inject Test Keys: Apply to a small subset of files
- Build & Test: Compile your project and verify functionality
- Define tr() function: Add the i18n helper to your project
- Repeat: If successful, proceed with batch injection
tr() function is simple to implement. Here's a basic example:
# Simple i18n helper for your project
translations = {
'welcome_to_application': 'Welcome to our application!',
'please_select_option': 'Please select an option:',
'thank_you_message': 'Thank you for using our app'
}
def tr(key):
return translations.get(key, key) # Returns key name if translation missing
🔄 Automatic Backup System
LocEngine automatically creates backups before any injection:
- 📁 Backup folder:
.locengine-backup/in your project root - ⏰ Timestamped backups for each injection session
- 🛡️ One-click restore if anything goes wrong
⚠️ Important: Check Each Injection
Before mass injection, always:
- ✅ Review a few transformed files manually
- ✅ Ensure string literals are correctly wrapped with
tr() - ✅ Verify that dynamic content (variables, placeholders) are preserved
- ✅ Test the application after each batch of 10-20 files
🧪 Language Support Status
✅ Fully Supported with tr() Injection
🧪 Beta Testing (Coming Soon)
📱 Mobile Platforms (Planned)
🔧 Planned for Future
tr() injection is being actively expanded to more languages.
Want to see your language prioritized? Contact us to express interest!
🎯 Complete Example: Python Project
Scan Python Project
Open LocEngine, select your Python project, and run Full Scan
Review Extracted Strings
LocEngine finds all hardcoded strings in .py files
Generate Keys
Auto-generate i18n keys from the strings
Export to JSON
Create a translation file: locales/en.json
Test Injection
Inject 5 keys and verify the application still works
Full Injection
After successful testing, inject all keys
❓ Frequently Asked Questions
Does LocEngine work with frameworks like Django, Flask, or React?
Yes! LocEngine is framework-agnostic. It scans source files directly, so it works with Django templates, Flask routes, React components, and any other framework.
Can I customize how keys are generated?
Absolutely! You can set naming conventions in Settings (camelCase, snake_case, etc.) and even create custom patterns for your project.
What happens to existing i18n implementations?
LocEngine detects existing i18n calls and can either preserve them or migrate to your preferred i18n library.
🌐 i18n Guide
Master internationalization with LocEngine
What is i18n?
Internationalization (i18n) prepares your software for multiple languages. LocEngine automates this process.
🔍 Step 1: Scanning
LocEngine supports 190+ formats including:
🔑 Step 2: Key Generation
Automatically creates meaningful keys from strings:
print("Welcome")
↓
welcome_message
📤 Step 3: Export
Export to multiple formats:
💉 Step 4: Safe Injection
Using tr('key_name') format
print("Welcome!")
print("Select option:")
print(tr('welcome'))
print(tr('select_option'))
🧪 Language Status
All languages support scanning & extraction
🎯 Python Example
❓ Quick FAQ
Works with Django/React?
Yes! Framework-agnostic, scans source files directly.
Custom key generation?
Yes, customize naming conventions in Settings.
Existing i18n code?
Detects and preserves or migrates as needed.