Zum Inhalt springen
    Zurück zum Blog
    Shopsoftware
    Tools & Funktionen

    Improved Language Handling from OXID eShop 4.5.1

    24.07.2011
    2 min Lesezeit
    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 thebasicandazurethemes. 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 theazuretheme 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 bothbasicandazurethemes, like the examples below:/out/azure/en/lang.phpPAGE_CHECKOUT_ORDER_EMAILEMAIL_SUGGEST_HTML_EMAILEMAIL_SUGGEST_HTML_EMAIL2FORM_PRICEALARM_EMAIL/out/basic/en/lang.phpACCOUNT_USER_EMAILCONTACT_EMAILCONTACT_EMAIL2Our new generic language file will have only one constant for email:/out/en/lang.phpEMAIL => ‚email‘The mapping array will take care of defining thebasicandazuretheme constants‘ relationships with the generic language file:/out/en/map.phpPAGE_CHECKOUT_ORDER_EMAIL => EMAILEMAIL_SUGGEST_HTML_EMAIL => EMAILEMAIL_SUGGEST_HTML_EMAIL2 => EMAILFORM_PRICEALARM_EMAIL => EMAILACCOUNT_USER_EMAIL => EMAILCONTACT_EMAIL => EMAILCONTACT_EMAIL2 => EMAILIf 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.phpFORM_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 fileThese 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.