This topic was marked solved by Nao, on April 17th, 2014, 03:21 PM
« [Installer] Blank screen and errors
[Installer] Sub language folders are not recognized

Pandos

  • Living on the edge of Wedge
  • Posts: 635
[Installer] Sub language folders are not recognized
« on April 8th, 2014, 02:32 PM »
If you run the installer with all language files in the language folder it works like expected.
If language files are in subfolders, they are not recognized.
# dpkg-reconfigure brain
error: brain is not installed or configured

Nao

  • Dadman with a boy
  • Posts: 16,082
[Installer] Re: Sub language folders are not recognized
« Reply #1, on April 8th, 2014, 08:55 PM »
Hmm, I thought I'd fixed that last week... :-/

OTOH, worst it can do is install the thing in English, right...? :P

Pandos

  • Living on the edge of Wedge
  • Posts: 635

Nao

  • Dadman with a boy
  • Posts: 16,082
[Installer] Re: Sub language folders are not recognized
« Reply #3, on April 8th, 2014, 09:33 PM »
Done totally in the dark... No time to test. Something along these lines..? Please test!
Around line 206 in install.php, of course.

Code: [Select]
while ($entry = $dir->read())
{
if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php')
{
$txt = array();
require_once($folder . '/index.' . substr($entry, 8));
if (!empty($txt['lang_name']))
$incontext['detected_languages'][$entry] = '<img src="core/languages/Flag.' . substr($entry, 8, strlen($entry) - 12) . '.png"> ' . $txt['lang_name'];
}
elseif (is_dir($folder . '/' . $entry) && file_exists($folder . '/' . $entry . '/Install.' . $entry . '.php'))
{
$txt = array();
require_once($folder . '/' . $entry . '/index.' . $entry . '.php');
if (!empty($txt['lang_name']))
$incontext['detected_languages'][$entry] = '<img src="core/languages/' . $entry . '/Flag.' . $entry . '.png"> ' . $txt['lang_name'];
}
}
$dir->close();

Pandos

  • Living on the edge of Wedge
  • Posts: 635
[Installer] Re: Sub language folders are not recognized
« Reply #4, on April 9th, 2014, 09:09 AM »
It's working with some exceptions:
1. Flags aren't displayed
2. Error 500 if you switch between languages.

So not bad for some lines out of the dark ;)
[Installer] Re: Sub language folders are not recognized
« Reply #5, on April 9th, 2014, 09:43 AM »Last edited on April 9th, 2014, 10:23 AM
If you switch to EN:
index.php?lang_file=Install.english.php

Switch back to another language:
index.php?lang_file=german

Yeah, Wedge misses the part with Install & .php :)
Only if the other language is in a sub language folder
[Installer] Re: Sub language folders are not recognized
« Reply #6, on April 9th, 2014, 10:08 AM »
OK, here's the working code for recognizing language flags :)
Code: [Select]
while ($entry = $dir->read())
{
if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php')
{
$txt = array();
require_once($folder . '/index.' . substr($entry, 8));
if (!empty($txt['lang_name']))
$incontext['detected_languages'][$entry] = '<img src="core/languages/Flag.' . substr($entry, 8, strlen($entry) - 12) . '.png"> ' . $txt['lang_name'];
}
elseif (is_dir($folder . '/' . $entry) && file_exists($folder . '/' . $entry . '/Install.' . $entry . '.php'))
{
$txt = array();
require_once($folder . '/' . $entry . '/index.' . $entry . '.php');
if (!empty($txt['lang_name']))
$incontext['detected_languages'][$entry] = '<img src="core/languages/' . $entry . '/Flag.' . $entry . '.png"> ' . $txt['lang_name'];
}
}
$dir->close();

Nao

  • Dadman with a boy
  • Posts: 16,082