Localization (i18n)
InnoShop has built-in multi-language support across system, plugin, and theme layers.
Supported Languages
| Language | Code |
|---|---|
| Arabic | ar |
| German | de |
| English | en |
| Spanish | es |
| French | fr |
| Indonesian | id |
| Italian | it |
| Japanese | ja |
| Korean | ko |
| Portuguese | pt |
| Russian | ru |
| Thai | th |
| Turkish | tr |
| Vietnamese | vi |
| 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.phpSystem Language Packs
lang/
├── en/
│ ├── common.php
│ ├── front.php
│ └── panel.php
└── zh-cn/
├── common.php
├── front.php
└── panel.phpUsage:
php
trans('common/button_submit'); // System common
trans('panel/menu_dashboard'); // Panel
trans('front/cart_empty'); // FrontendPlugin Language Packs
plugins/YourPlugin/Lang/
├── en/
│ ├── common.php
│ └── panel.php
└── zh-cn/
├── common.php
└── panel.phpUsage:
php
trans('PluginName::common/title'); // Plugin translation
trans('PluginName::panel/menu_title'); // Plugin panel translationTheme Language Packs
themes/your-theme/Lang/
├── en/
│ ├── common.php
│ └── front.php
└── zh-cn/
├── common.php
└── front.phpUsage:
php
theme_trans('common.theme_name'); // Theme translation
theme_trans('front.nav_home'); // Theme frontend translationMixed Usage in Views
blade
{{ trans('common/button_submit') }} {{-- System --}}
{{ trans('PluginName::common/title') }} {{-- Plugin --}}
{{ theme_trans('front/nav_home') }} {{-- Theme --}}Best Practices
- Use flat arrays for easy auto-translation
- Key naming: underscore format —
field_title,button_submit - Prefix by function:
menu_,button_,field_,message_ - System packs use slash (
common/button_submit), plugin packs use double-colon (PluginName::common/title) - Reuse existing system translations first
- Use
label_keyin fields.php instead of hardcodedlabel