From 919bbda416c2add0463b2ae2fcf5b802f4efd59a Mon Sep 17 00:00:00 2001 From: filip Date: Tue, 28 Jun 2016 18:33:45 +0200 Subject: start with the common footer on some pages + separate function for it + separate css for it + expanding i18n function for that purpose (to accept more than one gettext file) --- langs.inc.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'langs.inc.php') diff --git a/langs.inc.php b/langs.inc.php index 3a67aa463..c578dd2ee 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -438,21 +438,29 @@ function _lang_load($locale, $domain) { return i18n::_lang_load($locale, $domain * Do not exit the process. * * @param string $locale from which we want to create dictionary - * @param string $name_of_translation gettext filename + * @param mixed $name_of_translation string for one gettext filename or array for more * * @return array */ function read_translation_file($locale, $name_of_translation) { - if($name_of_translation == '../_nav/langs/en') { - $path_filename = '/_nav/langs/' . $locale . '.po'; + if(is_array($name_of_translation)) { + $dictionary = array(); + foreach($name_of_translation as $single_filename) { + $dictionary = array_merge($dictionary, read_translation_file($locale, $single_filename)); + } + return $dictionary; } else { - $path_filename = '/langs/' . $locale . '/' . $name_of_translation . '.po'; - } - if($locale == 'en') { - $path_filename .= 't'; + if ($name_of_translation == '../_nav/langs/en') { + $path_filename = '/_nav/langs/' . $locale . '.po'; + } else { + $path_filename = '/langs/' . $locale . '/' . $name_of_translation . '.po'; + } + if ($locale == 'en') { + $path_filename .= 't'; + } + return phpmo_parse_po_file(G_APP_ROOT . $path_filename); } - return phpmo_parse_po_file(G_APP_ROOT . $path_filename); } /** -- cgit v1.2.1