Regarding how the official plugins load language files
amarillonmc opened this issue · 0 comments
amarillonmc commented
In all of the officially provided plugins loader.php
, there are this snippet that decides which language to load:
(Example Taken from Change Class Plugin)
// language phrases
if(file_exists(__PATH_CHANGECLASS_ROOT__ . 'languages/'.config('language_default', true).'/language.php')) {
// attempt to load same language as website
if(!@include_once(__PATH_CHANGECLASS_ROOT__ . 'languages/'.config('language_default', true).'/language.php')) throw new Exception('Error loading language file (changeclass).');
} else {
// load default language file (en)
if(!@include_once(__PATH_CHANGECLASS_ROOT__ . 'languages/en/language.php')) throw new Exception('Error loading language file (changeclass).');
}
However, it only checks for the language_default
value in the configs, and not $_SESSION['language_display']
, which means even if a translation is provided by populating the language.php
file, and the user switched to said language, the plugin language will still be in the language_default
value, defeating the purpose of multi-language.
Please advise, thanks.