Language Files - New vs Legacy in 1.5.8+
If you are not familiar with language files in 1.5.8, please see Developer information on Array based Language files.
For backwards compatibility with plugins, Zen Cart 1.5.8+ still processes older define based language files, if they are the only ones available. This allows older plugins to work in 1.5.8. But the new format is preferred to the old format, as explained below.
Storefront:
- The main language file is
includes/languages/lang.english.php
. - This file may be overridden as
includes/languages/YOURTEMPLATE/lang.english.php
. - Each page has its own language file,
includes/languages/english/lang.PAGENAME.php
. - This file may be overridden as
includes/languages/english/YOURTEMPLATE/lang.PAGENAME.php
. - If the above page specific files do not exist, the system checks for an older define based file,
includes/languages/english/YOURTEMPLATE/PAGENAME.php
andincludes/languages/english/PAGENAME.php
.
If both older and newer style files exist, the older files are ignored, including their overrides.
Example:
Given the following files are present, only the “newer-style” files will be processed, and the “older-style” files ignored.
./includes/languages/english/YOURTEMPLATE/lang.order_status.php (newer-style override file)
./includes/languages/english/lang.order_status.php (main newer-style file)
// (if either of the above exist, the following are ignored)
./includes/languages/english/YOURTEMPLATE/order_status.php (older-style override file)
./includes/languages/english/order_status.php (older-style main file)
Admin:
- The main language file is
admin/includes/languages/lang.english.php
. - Each page has its own language file,
admin/includes/languages/english/lang.PAGENAME.php
. - If the page specific file does not exist, the system checks for an older define based file,
admin/includes/languages/english/PAGENAME.php
.
Again, if both older and newer style files exist, the older files are ignored.
Substring Matching
Language files which are substring matches of the main language file being loaded are also loaded. For example, if you browse to
index.php?main_page=video
The language file includes/languages/english/lang.video.php
is loaded (assuming it exists), and also any file matching includes/languages/english/lang.video*.php
.
If only a legacy language file exists, then the language file includes/languages/english/video.php
is loaded, and also any file matching includes/languages/english/video*.php
.
Substring matching is normally desired, but for legacy files it can cause duplicate defines, which is flagged by newer versions of PHP. For this reason, provision for bypassing it is made in the site specific overrides file in 1.5.8a and above. If you are running Zen Cart 1.5.8 but not 1.5.8a, see PR 5397.
Language File Help:
- Creating a Language Pack for Zen Cart 1.5.8 and above
- Language Files - New vs Legacy in 1.5.8
- Language Files - Developer information on Array based Language files
- Language Files - User information on Array based Language files
- Release Specific Upgrade Considerations
- Upgrading plugins to work with 1.5.8/PHP 8.0+
- Basic 158+ Language Customizations
- Updated Language Packs for 1.5.8+
- Missing Language Constants