From 6a5f5ce1579ed27649c8537bfdeb67e97f531289 Mon Sep 17 00:00:00 2001 From: AndreasErgenzinger Date: Wed, 17 Apr 2013 10:29:32 +0200 Subject: [PATCH 1/3] merge translations with those from theme --- lib/l10n.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/l10n.php b/lib/l10n.php index 315e326b292..7aef653ef79 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -125,6 +125,15 @@ class OC_L10N{ include strip_tags($i18ndir).strip_tags($lang).'.php'; if(isset($TRANSLATIONS) && is_array($TRANSLATIONS)) { $this->translations = $TRANSLATIONS; + //merge with translations from theme + $theme = OC_Config::getValue( "theme" ); + if (!is_null($theme)) { + $transFile = OC::$SERVERROOT.'/themes/'.$theme.substr($transFile, strlen(OC::$SERVERROOT)); + if (file_exists($transFile)) { + include $transFile; + $this->translations = array_merge($this->translations, $TRANSLATIONS); + } + } } } From 7611d218dfd4a8c1e8a36e9032c68a586c55b5df Mon Sep 17 00:00:00 2001 From: AndreasErgenzinger Date: Wed, 17 Apr 2013 10:34:29 +0200 Subject: [PATCH 2/3] merge translations with those from theme --- lib/l10n.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/l10n.php b/lib/l10n.php index 7aef653ef79..7b81d51b5e2 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -122,18 +122,19 @@ class OC_L10N{ ) && file_exists($i18ndir.$lang.'.php')) { // Include the file, save the data from $CONFIG - include strip_tags($i18ndir).strip_tags($lang).'.php'; + $transFile = strip_tags($i18ndir).strip_tags($lang).'.php'; + include $transFile; if(isset($TRANSLATIONS) && is_array($TRANSLATIONS)) { $this->translations = $TRANSLATIONS; //merge with translations from theme - $theme = OC_Config::getValue( "theme" ); - if (!is_null($theme)) { - $transFile = OC::$SERVERROOT.'/themes/'.$theme.substr($transFile, strlen(OC::$SERVERROOT)); - if (file_exists($transFile)) { - include $transFile; - $this->translations = array_merge($this->translations, $TRANSLATIONS); - } - } + $theme = OC_Config::getValue( "theme" ); + if (!is_null($theme)) { + $transFile = OC::$SERVERROOT.'/themes/'.$theme.substr($transFile, strlen(OC::$SERVERROOT)); + if (file_exists($transFile)) { + include $transFile; + $this->translations = array_merge($this->translations, $TRANSLATIONS); + } + } } } From eef1cf529ed03754798a2329fd29824be44cecda Mon Sep 17 00:00:00 2001 From: AndreasErgenzinger Date: Wed, 17 Apr 2013 10:41:07 +0200 Subject: [PATCH 3/3] additional safety checks --- lib/l10n.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/l10n.php b/lib/l10n.php index 7b81d51b5e2..d35ce5fed14 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -132,7 +132,9 @@ class OC_L10N{ $transFile = OC::$SERVERROOT.'/themes/'.$theme.substr($transFile, strlen(OC::$SERVERROOT)); if (file_exists($transFile)) { include $transFile; - $this->translations = array_merge($this->translations, $TRANSLATIONS); + if (isset($TRANSLATIONS) && is_array($TRANSLATIONS)) { + $this->translations = array_merge($this->translations, $TRANSLATIONS); + } } } }