diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-06-01 11:17:47 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-06-01 11:17:47 +0200 |
commit | c1257761f12d6483fad5d3633879f86b9c74d416 (patch) | |
tree | 8acc6ffc523ed492f7994058bca8f0ba0ec24417 | |
parent | ed3d97032259dba0971891ef0c083a6d299700f5 (diff) | |
parent | f24f3b1bb94bf4fdc6307f2b70add26c81c50230 (diff) | |
download | nextcloud-server-c1257761f12d6483fad5d3633879f86b9c74d416.tar.gz nextcloud-server-c1257761f12d6483fad5d3633879f86b9c74d416.zip |
Merge pull request #23571 from owncloud/stable8.2-backport-23362
[stable8.2] Read available l10n files also from theme folder
-rw-r--r-- | lib/private/l10n.php | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/lib/private/l10n.php b/lib/private/l10n.php index c2a55119c1d..99e8d8b1bcc 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -190,15 +190,15 @@ class OC_L10N implements \OCP\IL10N { ) && file_exists($transFile)) { // load the translations file - if($this->load($transFile)) { - //merge with translations from theme - $theme = \OC::$server->getConfig()->getSystemValue('theme'); - if (!empty($theme)) { - $transFile = OC::$SERVERROOT.'/themes/'.$theme.substr($transFile, strlen(OC::$SERVERROOT)); - if (file_exists($transFile)) { - $this->load($transFile, true); - } - } + $this->load($transFile); + } + + //merge with translations from theme + $theme = \OC::$server->getConfig()->getSystemValue('theme'); + if (!empty($theme)) { + $transFile = OC::$SERVERROOT.'/themes/'.$theme.substr($transFile, strlen(OC::$SERVERROOT)); + if (file_exists($transFile)) { + $this->load($transFile, true); } } @@ -480,6 +480,22 @@ class OC_L10N implements \OCP\IL10N { } } + $config = \OC::$server->getConfig(); + // merge with translations from theme + $theme = $config->getSystemValue('theme'); + if(!empty($theme)) { + $themeDir = \OC::$SERVERROOT . '/themes/' . $theme . substr($dir, strlen(\OC::$SERVERROOT)); + if(is_dir($themeDir)) { + $files=scandir($dir); + foreach($files as $file) { + if(substr($file, -5, 5) === '.json' && substr($file, 0, 4) !== 'l10n') { + $i = substr($file, 0, -5); + $available[] = $i; + } + } + } + } + self::$availableLanguages[$app] = $available; return $available; } |