The current version of ecshop: 2.7.3, the location of the language pack of the ecshop 2.7.3 version of the online shop system is languages/xxx/ under the ecshop file, where xxx represents the folders of various languages, which store the content of the specified language . The default language pack of ecshop is Chinese Simplified, that is, the zh_cn directory.
The loading process of language packs is loaded through the processing and control code of require(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/common.php') in ecshop's init.php.
The value of this $_CFG['lang'] is stored in the data table shop_config. Search for records with code=lang, and the corresponding value is the name of the language package. The default is zh_cn.
The array name in all language packs is $_LANG.
We can see that in init.php, $smarty->assign('lang', $_LANG) is initialized by smarty;
when the ecshop language pack is initialized, we can The names of the language packs can be accessed through {$lang.edit} in the template.
The background of ecshop is also exquisite. Language pack loading. His control file is in admin/includes/init.php.
- require(ROOT_PATH . 'languages/' .$_CFG['lang']. '/admin/common.php');
- require(ROOT_PATH . 'languages/' .$_CFG['lang']. '/admin/log_action.php');
- if (file_exists(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/' . basename(PHP_SELF)))
- {
- include(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/' . basename(PHP_SELF));
- }
Suppose a file in the background is named admin/user.php.
Then the language pack file used on this page is the loaded languages\zh_cn\admin\user.php
, which needs special attention.
That is, if you want to create a new page in the background. Then you need to create a new language pack file in the language pack.