Installation process internationalization

Found something that doesn't work as expected? Encountered PHP errors? Submit your bug reports here!
Posts: 1
Joined: Mon May 02, 2016 9:14 pm

Installation process internationalization

Postby OMH » Mon May 02, 2016 10:18 pm

Because I saw that the messages displayed thru the installation process are in an include file I decided to translate it in french. Then I searched a way to automate the include file selection. The easiest way is to keep the 'HTTP_ACCEPT_LANGUAGE' server variable, to verify if the actual browser language is ever translated and to set a local variable with this value or with the default one 'en', then to include a './install_lang_??.php' where ?? is the country code.
Here is the modified part of the Nucleus 'install.php' file:

Code: Select all

// Source :
// Original author : Hugo Hamon
$lng_list = array('en','fr','es','it','de');

function autoSelectLanguage($aLanguages, $sDefault = 'en') {
  if(!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
    $aBrowserLanguages = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
    foreach($aBrowserLanguages as $sBrowserLanguage) {
      $sLang = strtolower(substr($sBrowserLanguage,0,2));
      if(in_array($sLang, $aLanguages)) {
        return $sLang;
  return $sDefault;
$lang = autoSelectLanguage($lng_list, 'fr');


The 'es', 'it' & 'de' elements in the array are only here as samples, I only did the french translation.
This modification requires that the actual 'install_lang_english.php' has to be renamed 'install_lang_en.php' and that the translations to come up have to follow the same pattern.
Here are two attached files, the modified 'install.php' and the 'install_lang_fr.php' translation.
I also added some 'chmod()' lines into 'install.php' to set writable, as required, some files and directories. These are set as comments in the attached file.
Modified 'install.php'+'install_lang_fr.php'
(16.28 KiB) Downloaded 153 times
User avatar
Posts: 122
Joined: Tue Dec 05, 2006 2:23 pm

Installation process internationalization

Postby yama » Sun May 08, 2016 12:32 pm

Return to “Bug Reports & Feature Requests”