Language Files - New vs Legacy in 1.5.8+

How legacy language defines are handled for Zen Cart 1.5.8 and above

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 and includes/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:




Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified August 23, 2024 by Scott C Wilson (2c7c41e).