mirror of
https://github.com/Mibew/i18n.git
synced 2025-01-22 21:40:28 +03:00
Add the ability to add locale strings in plugins
This commit is contained in:
parent
803f2ba075
commit
58fd82ca36
@ -130,6 +130,7 @@ function get_locale_links($href)
|
||||
function load_messages($locale) {
|
||||
global $messages, $output_encoding;
|
||||
|
||||
// Load core localization
|
||||
$locale_file = dirname(__FILE__) . "/../../locales/{$locale}/properties";
|
||||
$locale_data = read_locale_file($locale_file);
|
||||
|
||||
@ -138,6 +139,23 @@ function load_messages($locale) {
|
||||
}
|
||||
|
||||
$messages[$locale] = $locale_data['messages'];
|
||||
|
||||
// Load active plugins localization
|
||||
$plugins_list = array_keys(PluginManager::getAllPlugins());
|
||||
|
||||
foreach($plugins_list as $plugin_name) {
|
||||
$locale_file = dirname(__FILE__) .
|
||||
"/../../plugins/{$plugin_name}/locales/{$locale}/properties";
|
||||
if (is_readable($locale_file)) {
|
||||
$locale_data = read_locale_file($locale_file);
|
||||
// array_merge used to provide an ability for plugins to override
|
||||
// localized strings
|
||||
$messages[$locale] = array_merge(
|
||||
$messages[$locale],
|
||||
$locale_data['messages']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user