mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
[ticket/17191] Inject variables from composer.json when loading language files
PHPBB3-17191
This commit is contained in:
@@ -28,22 +28,15 @@ class language_file_helper
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* @var config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $phpbb_root_path Path to phpBB's root
|
||||
* @param config $config The config
|
||||
*
|
||||
*/
|
||||
public function __construct(string $phpbb_root_path, config $config)
|
||||
public function __construct(string $phpbb_root_path)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,26 +69,6 @@ class language_file_helper
|
||||
return $available_languages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return by given lang key its composer.json value
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function get_lang_key_value($lang_key, $user_lang_db) : string
|
||||
{
|
||||
$available_languages = $this->get_available_languages();
|
||||
|
||||
foreach ($available_languages as $key => $value)
|
||||
{
|
||||
$available_languages[$value['iso']] = $value;
|
||||
unset($available_languages[$key]);
|
||||
}
|
||||
$board_default_lang = $this->config['default_lang'];
|
||||
$user_lang_db = $user_lang_db ?? $board_default_lang;
|
||||
return $available_languages[$user_lang_db][$lang_key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect some data from the composer.json file
|
||||
*
|
||||
|
Reference in New Issue
Block a user