Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.1 KB

i18n.md

File metadata and controls

48 lines (36 loc) · 1.1 KB

Internationalization (i18n)

Multi-language support via translation files.

Translation File

{
  "locale": "id",
  "translations": {
    "Sales Order": "Pesanan Penjualan",
    "Customer": "Pelanggan",
    "Confirm": "Konfirmasi",
    "Draft": "Draf"
  }
}

Place in modules/your_module/i18n/id.json.

How It Works

  1. Engine loads all i18n/*.json files from each module
  2. Translations are keyed by locale (e.g., id, en, ja)
  3. Fallback chain: requested locale → default locale → return key as-is

Translator API

translator.Translate("id", "Sales Order")  // → "Pesanan Penjualan"
translator.Translate("id", "Unknown Key")  // → "Unknown Key" (fallback)
translator.Translate("fr", "Sales Order")  // → "Sales Order" (fallback to default)

Adding a Language

  1. Create i18n/{locale}.json in your module
  2. Add translations as key-value pairs
  3. The engine loads them automatically on module install

Supported Locales

Any locale string works. Common examples:

  • en — English
  • id — Indonesian
  • ja — Japanese
  • zh — Chinese
  • ar — Arabic