Fix plugins localization

This commit is contained in:
Dmitriy Simushev 2014-02-27 09:20:38 +00:00
parent e7261672cc
commit 96447cedc1

View File

@ -197,8 +197,15 @@ function load_messages($locale)
$plugins_list = array_keys(PluginManager::getAllPlugins()); $plugins_list = array_keys(PluginManager::getAllPlugins());
foreach ($plugins_list as $plugin_name) { foreach ($plugins_list as $plugin_name) {
$locale_file = MIBEW_FS_ROOT . // Build plugin path
"/plugins/{$plugin_name}/locales/{$locale}/properties"; list($vendor_name, $plugin_short_name) = explode(':', $plugin_name, 2);
$plugin_name_parts = explode('_', $plugin_short_name);
$locale_file = MIBEW_FS_ROOT
. "/plugins/" . ucfirst($vendor_name) . "/Mibew/Plugin/"
. implode('', array_map('ucfirst', $plugin_name_parts))
. "/locales/{$locale}/properties";
// Get localized strings
if (is_readable($locale_file)) { if (is_readable($locale_file)) {
$locale_data = read_locale_file($locale_file); $locale_data = read_locale_file($locale_file);
// array_merge used to provide an ability for plugins to override // array_merge used to provide an ability for plugins to override