Ecshop the loading principle of the language pack lang

Source: Internet
Author: User
Tags vars

Version of Ecshop currently in use: 2.7.3,ecshop 2.7. The location of the language pack for the 3 version of the online store system is under the Ecshop file languages/xxx/where the XXX represents the various language folders that contain the contents of the specified language. The default language pack for Ecshop is the Chinese Simplified zh_cn directory.

The loading process for language packs is through the Require (Root_path) in the init.php of Ecshop. ' Languages/'. $_cfg[' Lang '. '/common.php ') handles and controls the code to load.
The value of this $_cfg[' lang ' is stored in the data table Shop_config. Searches for the Code=lang record, and the corresponding value is the language pack name. The default is ZH_CN.
The array name in all language packs is $_lang.
We can see the initialization of the $smarty->assign (' Lang ', $_lang) in init.php by Smarty;
When the Ecshop language pack is initialized, we can access each name in the language pack through {$lang. Edit} in the template.
Ecshop backstage, also have fastidious. Language Pack loading. His control file is inside the admin/includes/init.php.

[PHP]View PlainCopy
  1. Require (Root_path. ' languages/'. $_cfg[' Lang '.  '/admin/common.php ');
  2. Require (Root_path. ' languages/'. $_cfg[' Lang '.  '/admin/log_action.php ');
  3. if (file_exists (Root_path. ' languages/'. $_cfg[' Lang '. '/admin/'.  basename (php_self)))
  4. {
  5. Include (Root_path. ' languages/'. $_cfg[' Lang '. '/admin/'.  basename (php_self));
  6. }

Suppose a file in the background is named admin/user.php.
Then the language pack file used for this page is the loaded languages\zh_cn\admin\user.php
This has to be especially important.
This means that if you want to create a new page in the background. Then also in the language pack to create a new language package file can be.

Ecshop the loading principle of the language pack lang

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.