🌐 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:

Python (.py) C# (.cs) Java (.java) JavaScript (.js) TypeScript (.ts) PHP (.php) Ruby (.rb) Go (.go) Rust (.rs) Swift (.swift) Kotlin (.kt) ... and 180+ more

How Scanning Works:

  1. Select your project folder
  2. Choose scan mode (Full/GUI/Fallback)
  3. LocEngine analyzes all supported files
  4. 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
💡 Pro Tip: Review generated keys before injection. You can rename them to follow your project's naming convention.

📤 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:

  1. Start Small: Select 1-2 keys for testing (e.g., welcome_to_application)
  2. Preview Changes: Review how the code will be modified with tr() wrapper
  3. Inject Test Keys: Apply to a small subset of files
  4. Build & Test: Compile your project and verify functionality
  5. Define tr() function: Add the i18n helper to your project
  6. Repeat: If successful, proceed with batch injection
💡 Pro Tip: The 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

🐍 Python Production Ready

🧪 Beta Testing (Coming Soon)

Java Beta Testing
#️⃣ C# Beta Testing
🟨 JavaScript Beta Testing
🔷 TypeScript Beta Testing

📱 Mobile Platforms (Planned)

🍎 Swift (iOS) Q4 2026
🤖 Kotlin (Android) Q1 2027
🎯 Flutter (Dart) Q2 2027
⚛️ React Native Q3 2027

🔧 Planned for Future

🐘 PHP 2027
💎 Ruby 2027
🦀 Rust 2028
Go 2028
💡 Note: All languages above support scanning and string extraction regardless of injection status. You can use LocEngine today to extract strings and generate i18n keys for any language, then export to JSON/PO/CSV format. The tr() injection is being actively expanded to more languages.

Want to see your language prioritized? Contact us to express interest!

🎯 Complete Example: Python Project

1

Scan Python Project

Open LocEngine, select your Python project, and run Full Scan

2

Review Extracted Strings

LocEngine finds all hardcoded strings in .py files

3

Generate Keys

Auto-generate i18n keys from the strings

4

Export to JSON

Create a translation file: locales/en.json

5

Test Injection

Inject 5 keys and verify the application still works

6

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:

Python C# Java JavaScript TypeScript PHP Ruby Go Rust Swift Kotlin 180+ more

🔑 Step 2: Key Generation

Automatically creates meaningful keys from strings:

print("Welcome") welcome_message

📤 Step 3: Export

Export to multiple formats:

JSON
PO/POT
CSV
YAML

💉 Step 4: Safe Injection

Using tr('key_name') format

print("Welcome!")
print("Select option:")
print(tr('welcome'))
print(tr('select_option'))
1 Start with 1-2 keys
2 Preview changes
3 Test thoroughly
4 Batch inject

🧪 Language Status

🐍 Python ✅ Ready
Java 🧪 Beta
#️⃣ C# 🧪 Beta
🟨 JavaScript 🧪 Beta
🔷 TypeScript 🧪 Beta
🍎 Swift 📱 Q4 2026
🤖 Kotlin 📱 Q1 2027
🐘 PHP 🔧 2027

All languages support scanning & extraction

🎯 Python Example

1 Scan Python project
2 Extract strings
3 Generate keys
4 Export to JSON
5 Test injection
6 Full injection

❓ 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.