News

Custom gui-labels

01.07.2013

Language-File customization the easy way

Whenever you want to change some labels or other entries of the Kajona GUI, the recommended way is to copy the original language-file into the project folder and to change the contents right there.

Example: You want to change the name of the "News" module to "Articles":

  • copy the file /core/module_news/lang/module_news/lang_news_en.php to /project/lang/module_news/lang_news_en.php
  • open the file with a text-editor and change the entry 
    $lang["modul_titel"]                     = "News";
    to
    ​$lang["modul_titel"]                     = "Articles";

That's it, your done. But: Since the whole file was copied, new entries (e.g. in case of updates) won't be added to your customized language-file - the synchronization is to be done manually.

To avoid this problems, there's another technique to add / overwrite custom entries of a single file using includes. If we keep to the example above, all you have to do is to create a file located at /project/lang/module_news/lang_news_en.php with the following contents:

<?php
include(_corepath_."/module_news/lang/module_news/lang_news_en.php");

You may then add your new / redefined language-entries:

<?php
include(_corepath_."/module_news/lang/module_news/lang_news_en.php");
$lang["modul_titel"] = "Articles";

tl;dr: By including the original lang-file instead of copying it, all official entries remain at the original place. In case of updates, merging or synchronization need to be done. The include-technique allows to redefine only the relevant entries while all other entries remain untouched.

Zurück

Fork me on GitHub