Wedge

Public area => Bug reports => The Pub => Archived fixes => Topic started by: Pandos on April 8th, 2014, 02:32 PM

Title: [Installer] Sub language folders are not recognized
Post by: Pandos 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.
Title: Re: [Installer] Sub language folders are not recognized
Post by: Nao 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
Title: Re: [Installer] Sub language folders are not recognized
Post by: Pandos on April 8th, 2014, 08:57 PM
Yes, that's the worst :lol:
Title: Re: [Installer] Sub language folders are not recognized
Post by: Nao 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();
Title: Re: [Installer] Sub language folders are not recognized
Post by: Pandos 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 ;)
Title: Re: [Installer] Sub language folders are not recognized
Post by: Pandos on April 9th, 2014, 09:43 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
Title: Re: [Installer] Sub language folders are not recognized
Post by: Pandos 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();
Title: Re: [Installer] Sub language folders are not recognized
Post by: Nao on April 17th, 2014, 03:21 PM
Split the rest into its own topic. This particular topic -- fixed!