Bug with languages or what

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
Min2liz
Posts: 2
Joined: Thu Jul 12, 2007 11:34 am

Bug with languages or what

Post by Min2liz »

Hi, we install new phpMyFAQ version and trying something with languages. So we are from Lithuania and our coutry code is lt. In this case there is no language_lt.php file. So I think in this index.php maybe where are bug or something:

Code: Select all

//
// get language (default: english)
//
$pmf = new PMF_Init();
$LANGCODE = $pmf->setLanguage($faqconfig->get('main.languageDetection'), $faqconfig->get('main.language'));
// Preload English strings
require_once ('lang/language_en.php');

if (isset($LANGCODE) && PMF_Init::isASupportedLanguage($LANGCODE) && !isset($_GET['gen'])) {
    // Overwrite English strings with the ones we have in the current language,
    // but don't include UTF-8 encoded files, these will break the captcha images
    require_once('lang/language_'.$LANGCODE.'.php');
} else {
    $LANGCODE = 'en';
}
Then we change all language to Lithuania and trying to connect to web page we get blank page with error:

Warning: main(lang/language_lt.php): failed to open stream: No such file or directory in /home/www/****/faq/index.php on line 69

Fatal error: main(): Failed opening required 'lang/language_lt.php' (include_path='.:/usr/local/lib/php') in /home/www/***/faq/index.php on line 69
Maybe need to check is there really file exist for example:

Code: Select all

//
// get language (default: english)
//
$pmf = new PMF_Init();
$LANGCODE = $pmf->setLanguage($faqconfig->get('main.languageDetection'), $faqconfig->get('main.language'));
// Preload English strings
require_once ('lang/language_en.php');

if (isset($LANGCODE) && PMF_Init::isASupportedLanguage($LANGCODE) && !isset($_GET['gen'])) {
    // Overwrite English strings with the ones we have in the current language,
    // but don't include UTF-8 encoded files, these will break the captcha images
    if (file_exists('lang/language_'.$LANGCODE.'.php')) { 
        require_once('lang/language_'.$LANGCODE.'.php');
    }
    else {
       require_once('lang/language_en.php');
   }
} else {
    $LANGCODE = 'en';
}
Regards from CodeRS
Thorsten
Posts: 15834
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

did you added a language_lt.php file?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Min2liz
Posts: 2
Joined: Thu Jul 12, 2007 11:34 am

Post by Min2liz »

Now? Yes.
Before - No.

Now working fine, but before was terible. :) Error and blank page. So if user download phpMyFAQ and there is no language in his own country, he will get error. :( I think so...
Thorsten
Posts: 15834
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

no, he'll get everything in English.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply