Language Definitions

All text shown on the Installation Routine, Catalog Front-End, and Administration Tool pages are defined separately from the core framework in plain-text files to easily support all languages in the world. Maintenance of language variations, e.g. Spanish (es_ES, es_CL) and German (de_DE, de_AT), is eased with a feature called Language Injection where one language can inject the definitions of another language at run-time and avoid duplicate language definitions.

  • Language Definitions
    • Installation Routine
    • Catalog Front-End
    • Administration Tool
  • Creating Language Packs

 

Language Definitions

Two different formats are used to store language definitions in with the Installation Routine and Administration Tool using an ini style format and the Catalog Front-End using an XML format. Both Installation Routine and Administration Tool load their language definitions at run-time whereas the Catalog Front-End saves its language definitions in the database and caches the definitions in groups to load at the different sections of the site.

The language definitions for the Catalog Front-End are stored in the database to easily allow the administrator to edit the definitions via the Administration Tool. The definitions for the Installation Routine and Administration Tool are left in files as the administrator does not usually need to edit the definitions of these sections during the operation of their online store.

Each language definition is defined in plain-text with no PHP code or programming logic used. If a language definition should contain the value of a PHP variable (e.g. the customers name), the output of the language definition should be parsed by PHPs sprintf() function where %s are placed in the language definition and used as placeholders for the variable values.

An example of a language definition being parsed by sprintf is as follows:

Language Definition

customer_greeting = Hello %s!

PHP sprintf() Example

get('customer_greeting'), $lC_Customer->getName());
?>

The directories containing the language definition files are named after the locale for that language, e.g. en_US for American English, de_DE for German, and es_ES for Spanish.

Installation Routine

The language definition files for the Installation Routine exist in the loadedcommerce/install/includes/languages/ directory and are saved in an ini style format.

The main language file, e.g. loadedcommerce/install/includes/languages/en_US.php, is loaded for all pages in addition to the language definitions in the language directory, e.g. loadedcommerce/install/includes/languages/en_US, for the page being shown.

Catalog Front-End

The language definition files for the Catalog Front-End exist in the loadedcommerce/includes/languages/ directory and are saved in an XML style format.

The main language file, e.g. loadedcommerce/includes/languages/en_US.xml, contains data regarding the language, e.g. the language name, code, locale, and date format strings, and the language definitions used throughout the core framework with assigned groups.

An example main language file is as follows:



  
    <![CDATA[English]]>
    
    
    
    
    
    
    
    
    
    
    
  
  
    
      my_account
      
      general
    
    
      cart_contents
      
      general
    
  

The information found within the data section of the XML file is used when importing new languages via the Administration Tool. This sets the information required for the new language as well as assigning it a default currency if it exists (default_currency) and a parent language to inject from if this is required (parent_language_code).

When a language is imported via the Administration Tool, all language definition files within the language directory, e.g. loadedcommerce/includes/languages/en_US, are also stored in the database and cached into groups. These extra definition files are used for the modules that are installed on the shop installation, e.g. payment modules and shipping modules, and are automatically removed from the database when the module itself is removed, and automatically installed when the module is re-installed.

Image buttons exist in the loadedcommerce/includes/languages//images/buttons directory that must also be created to display language specific image buttons on the pages throughout the Catalog Front-End.

Administration Tool

The language definition files for the Administration Tool exist in the loadedcommerce/admin/includes/languages/ directory and are saved in an ini style format.

The main language file, e.g. loadedcommerce/admin/includes/languages/en_US.php, is loaded for all pages in addition to the language definitions in the language directory, e.g. loadedcommerce/admin/includes/languages/en_US, for the page being shown.

Creating Language Packs

Language packs must contain the following file and directory structure:

loadedcommerce/admin/includes/languages/xx_XX
loadedcommerce/admin/includes/languages/xx_XX.php
loadedcommerce/includes/languages/xx_XX
loadedcommerce/includes/languages/xx_XX.xml
loadedcommerce/install/includes/languages/xx_XX
loadedcommerce/install/includes/languages/xx_XX.php

 

Icon info.png The language definitions for the Installation Routine are only required for new installations if the language wanted during the installation procedure does not exist by default.

The language definitions used in the core framework can be exported via the Administration Tool -> Configuration -> Languages section which can create a main language XML file (loadedcommerce/includes/languages/xx_XX.xml) containing its relevant data.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close