Skip to content

Localization (i18n)

InnoShop has built-in multi-language support across system, plugin, and theme layers.

Supported Languages

LanguageCode
Arabicar
Germande
Englishen
Spanishes
Frenchfr
Indonesianid
Italianit
Japaneseja
Koreanko
Portuguesept
Russianru
Thaith
Turkishtr
Vietnamesevi
Chinese (Simplified)zh-cn
Chinese (Hong Kong)zh-hk

Locale Format

Language codes in config.json and Lang/ directories use hyphen format (e.g. zh-cn), not underscore.

# Correct
"name": { "zh-cn": "Alipay", "en": "Alipay" }
Lang/zh-cn/common.php

# Wrong
"name": { "zh_cn": "Alipay" }
Lang/zh_cn/common.php

System Language Packs

lang/
├── en/
│   ├── common.php
│   ├── front.php
│   └── panel.php
└── zh-cn/
    ├── common.php
    ├── front.php
    └── panel.php

Usage:

php
trans('common/button_submit');       // System common
trans('panel/menu_dashboard');       // Panel
trans('front/cart_empty');           // Frontend

Plugin Language Packs

plugins/YourPlugin/Lang/
├── en/
│   ├── common.php
│   └── panel.php
└── zh-cn/
    ├── common.php
    └── panel.php

Usage:

php
trans('PluginName::common/title');       // Plugin translation
trans('PluginName::panel/menu_title');   // Plugin panel translation

Theme Language Packs

themes/your-theme/Lang/
├── en/
│   ├── common.php
│   └── front.php
└── zh-cn/
    ├── common.php
    └── front.php

Usage:

php
theme_trans('common.theme_name');     // Theme translation
theme_trans('front.nav_home');        // Theme frontend translation

Mixed Usage in Views

blade
{{ trans('common/button_submit') }}          {{-- System --}}
{{ trans('PluginName::common/title') }}      {{-- Plugin --}}
{{ theme_trans('front/nav_home') }}           {{-- Theme --}}

Best Practices

  1. Use flat arrays for easy auto-translation
  2. Key naming: underscore format — field_title, button_submit
  3. Prefix by function: menu_, button_, field_, message_
  4. System packs use slash (common/button_submit), plugin packs use double-colon (PluginName::common/title)
  5. Reuse existing system translations first
  6. Use label_key in fields.php instead of hardcoded label