This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

When using Internalization addon in combination with a build package some text-items can't/won't be translated. This happens when you are using packages/package_name/tools/filename.php file in the frontend of your website / package.

It doesn't work because the addon checks the language of the page. But the tools-file isn't a page, so there is no language (only the default one). Although the language is set in the session variables.

The solution to this issue is to get/set the default locale again within the tools-file. I created is the following code:

if (Package::getByHandle('multilingual')) {
 $ms = MultilingualSection::getByLocale($_SESSION['LOCALE']);      
 if (is_object($ms)) {
  $_SESSION['DEFAULT_LOCALE'] = $ms->getLocale();
  Loader::helper('default_language', 'multilingual')->setupSiteInterfaceLocalization();

Place this code at the top of your tools-file. And it should work!

Loading Conversation