Open DEV-byoos opened 3 years ago
Hi, I didn't understand, what was the problem and why you want to do this change? 🤔
Hello,
the following function returns NULL // Set loaded language $this->language = \Config\Services::language()->get();
in the Config\Services /**
@return Language */ public static function language(string $locale = null, bool $getShared = true): Language { if ($getShared) { return static::getSharedInstance('language', $locale) ->setLocale($locale); }
$locale = ! empty($locale) ? $locale : static::request()
->getLocale();
echo ' Config Services ';var_dump( new Language($locale), $locale);//BYOOS_tag return new Language($locale);
return NULL
I try to solve the problem without success, your expertise would be welcome, thank you in advance
Check your database table languages
, if it's empty, you can add a record like a bellow:
array(
'language_id'=>1,
'language_name'=>'english',
'language_title'=>'English',
'code'=>'en',
'public'=>1,
'rtl'=>0,
'sort_order'=>1,
'created_date'=>time(),
'default'=>1,
'image'=>'upload_file/lang/en.png'
)
Then make sure that the filter urlLocale
or identityVerification
is for your path active. (These classes will supply the Language class).
Filter config can be find in
nodcms-core/Config/Filters.php
Explanation On NodCMS the Language class (nodcms-core/Libraries/Language.php) are handling the connection between the language on the database and the translations files.
Whenever you create a new object with this class you need to supply it with a record of the database as an array(like the example on the top).
Supply the class with using
set()
function like bellow:$myLanguage = new Language(); $myLanguage ->set($language);
Let me know if it helps.
Hello, I took again the tests on the version nodcms 3.2, same problem as 3.0 and 3.1, in the services / Language have return an object where DBlanguage is NULL
object(NodCMS\Core\Libraries\Language)#75 (5) { ["DBlanguage": "NodCMS\Core\Libraries\Language":private]=> NULL ["language":protected]=> array(0) { } ["locale":protected]=> string(2) "en" ["intlSupport":protected]=> bool(true) ["loadedFiles":protected]=> array(0) { }
so no language is loaded when FRONTEND is launched $this->language = \Config\Services::language()->get(); cordialement Gabriel PS, does the installer modify an OK installation FLAGS yes or no?
support@byoosdigital.com / gbobard@gmail.com
correctif language 1)IN root/nodcms-core/controllers/Frontend.php
2)IN root/nodcms-core/libraries/Languages.php public function get(): array { return $this->DBlanguage==null ? array() : $this->DBlanguage; }
Thanks for the work done by the NodCMS 3.0 team led by Khodakhah THAT's WORK !!! / C'est du travail ! !!