Language Files - What are they and how are they used?

Zen Cart uses language files or a "languages system"  to define the text content used by the various display pages of your cart.

An obvious benefit of the "languages system" is the ability to run Zen Cart in another language or several languages at the same time. Using these files allows you to edit/change the text/content that appears on every page of your shop without needing to understand databases or programming languages.

The information in these files can be placed into four categories as follows:

Global information which contains text that is used across the entire site. This information is contained in includes/languages/english.php.

Page Specific information contains text used by individual pages in your cart. This information is contained in includes/languages/ENGLISH/???.php,

Your Own Definitions can contain text you might find necessary in your particular shop. This information is contained in include/languages/ENGLISH/extra_definitions/???.php

Complete pages are default pages used by Zen Cart and can be edited as necessary. You can also add your own pages if you find that necessary. These files are located in includes/languages/ENGLISH/html_includes/define_???.php.

The information in these files is constructed using "define statements" which consist of a CONSTANT and the information contained in that CONSTANT as shown in the example below.
define('MY_CONSTANT', 'This is my information');

The advantage of these "define statements" is that text information can be included in your template
files using a CONSTANT (i.e. <?php echo HEADING_TITLE; ?>) and not "hard coding" (i.e. <?php echo 'My Page Heading'; ?>)
the text.

Examples and Usage

Global Definitions
The definitions in english.php include the footer text, the sidebox headings, text used by the forms in Zen Cart&reg; and
various error messages.
  • From english.php
define('FOOTER_TEXT_BODY', 'Copyright &copy; 2003-2006 <a href="http://www.zen-cart.com" target="_blank">Zen Cart</a>. Powered by <a href="http://www.zen-cart.com" target="_blank">Zen Cart</a>');define('BOX_HEADING_CATEGORIES', 'Categories');
define('ENTRY_FIRST_NAME', 'First Name:');
define('ENTRY_STREET_ADDRESS_ERROR', 'Your Street Address must contain a minimum of ' . ENTRY_STREET_ADDRESS_MIN_LENGTH . ' characters.');

Page Specific Definitions
These definitions are exactly what the title says; They define text information for specific display pages in your cart.
The basic information in these files includes the text for the page heading and the text for the navbar. Depending on
the page, you will also find information for e-mail messages and for the tasks carried out by a particular
display page.
  • From conditions.php
define('NAVBAR_TITLE', 'Conditions of Use');
define('HEADING_TITLE', 'Conditions of Use');
  • From header.php
define('HEADER_ALT_TEXT', 'Powered by Zen Cart :: The Art of E-Commerce');
define('HEADER_SALES_TEXT', 'TagLine Here');
define('HEADER_LOGO_WIDTH', '192px');
define('HEADER_LOGO_HEIGHT', '64px');
define('HEADER_LOGO_IMAGE', 'logo.gif');
  • From contact_us.php
define('ENTRY_NAME', 'Full Name:');
define('ENTRY_EMAIL', 'Email Address:');
define('ENTRY_ENQUIRY', 'Message:');

Your Own Definitions
As you customize your cart, you may find that you need to include additional definitions. You can do this by
creating a definition file - yourdefinitionfile.php and saving it to includes/languages/ENGLISH/extra_definitions
Constructing your own defines would follow the pattern shown above.

  • From product_free_shipping.php
define('TEXT_PRODUCT_FREE_SHIPPING_ICON', zen_image(DIR_WS_TEMPLATE_IMAGES . 'always-free-shipping.gif', 'Always Free Shipping')); // for an image or comment out to use another

Defined Pages
These pages include your privacy statement, your conditions of use and shipping and handling information.
These files can be edited in a text editor and uploaded to your server or you can edit them in your
admin control panel; admin/tools/define pages editor

  • Pages from this folder
define_privacy.php
define_conditions.php
define_shippinginfo.php
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How can I find out what version of Zen Cart or PHP or MySQL I'm using?

To find out what version of Zen Cart or PHP or MySQL you are currently using, you can simply go...

Getting a BLANK PAGE? Here's the answer ...

If you're getting a blank page when trying to browse to a certain page on your store, or after...

What's New in the Upcoming v2.0 release?

Database Abstraction Layer and Sql CacheThe abstraction layer has been re-factored to include a...

Image Preparation - How-to

I've seen several posts where people obviously aren't quite sure about the best way to set up...

Some tips to modify stylesheet

1. Download Web Developer extension for FireFox here2. Install & restart FireFox. You should...