Eine Gruppe Personen sitzt sich gegenüber. Zwei Männer reichen sich die Hand.

Improved Language Handling from OXID eShop 4.5.1

Improved Language Handling from OXID eShop 4.5.1

With the introduction of theme handling in OXID eShop 4.5.0, there were different language strings for each theme and we were using two different theme-dependent language files for the basic and azure themes. To make this system more flexible and to avoid redundancy and repetition in language constants, we will shortly be moving to a generic language file which will be valid for all themes (even self-made themes) from version 4.5.1. Once this is in place, it will be possible to use different language strings per theme. Of course, our well-known override functionality will still be available for all of these files, so your system will remain easily updatable so long as you make use of the cust_lang.php file.

We will also be implementing a mapping file to enable mapping between the new generic language constants and the theme-specific constants. This is to ensure maximum flexibility when updating the system. In most cases, the language constants from the azure theme will be simplified and used as the basis for generic constant names.

Sounds complicated? Well, it isn’t: let me enlighten you with an example.

You will notice that we have many different definitions for email in both basic and azure themes, like the examples below:

/out/azure/en/lang.php
PAGE_CHECKOUT_ORDER_EMAIL
EMAIL_SUGGEST_HTML_EMAIL
EMAIL_SUGGEST_HTML_EMAIL2
FORM_PRICEALARM_EMAIL

/out/basic/en/lang.php
ACCOUNT_USER_EMAIL
CONTACT_EMAIL
CONTACT_EMAIL2

Our new generic language file will have only one constant for email:

/out/en/lang.php
EMAIL => ‚email‘

The mapping array will take care of defining the basic and azure theme constants‘ relationships with the generic language file:

/out/en/map.php
PAGE_CHECKOUT_ORDER_EMAIL => EMAIL
EMAIL_SUGGEST_HTML_EMAIL => EMAIL
EMAIL_SUGGEST_HTML_EMAIL2 => EMAIL
FORM_PRICEALARM_EMAIL => EMAIL
ACCOUNT_USER_EMAIL => EMAIL
CONTACT_EMAIL => EMAIL
CONTACT_EMAIL2 => EMAIL

If a theme needs to change specific constants, it can do this by redefining the constants inside the theme-specific language file:

/out/azure/en/lang.php
FORM_PRICEALARM_EMAIL => ‚email address‘

For your own customizations, you can of course continue to use custom language files per theme (remember that these will be excluded from update packages). And if you’re a user of OXID eShop Enterprise Edition, there is also another override level for your subshops.

Thus, to summarize, the priority for language handling will be like this:

custom language file -> theme language file -> subshop language file -> general language file

These changes should make theme creation and management simpler and more efficient, and help evolve OXID eShop’s new theme handling to meet the requirements of merchants and developers.

Tel. +49 761 36889 0
Mail. [email protected]