Hello,
In an option page, I’ve set a select field to let the user choose the language by default between ‘en’ and ‘fr’.
I get this value in my config file to set the default language.
This is the code in the config.php file but I’ve got a blank page on the front.
$language = 'en';
$languages = array();
$language = site()->generalOptionslanguage()->value();
//$language = 'fr';
switch ( $language ) {
case 'en':
$languages = array(
array(
'code' => 'en',
'name' => 'English',
'default' => true,
'locale' => 'en_EN',
'url' => '/',
),
array(
'code' => 'fr',
'name' => 'French',
'default' => false,
'locale' => 'fr_FR',
'url' => '/fr',
),
);
break;
case 'fr':
$languages = array(
array(
'code' => 'en',
'name' => 'English',
'default' => false,
'locale' => 'en_EN',
'url' => '/en',
),
array(
'code' => 'fr',
'name' => 'French',
'default' => true,
'locale' => 'fr_FR',
'url' => '/',
),
);
break;
}
c::set( 'languages' , $languages );
If I comment the line:
$language = site()->generalOptionslanguage()->value();
… and replace it by:
$language = 'fr';
It works fine.
I’ve var_dump the line “site()->generalOptionslanguage()->value();” and it return ‘fr’ or ‘en’ as expected.
Is it a bug?