Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-03-17 18:15:37 +0300
committerMorris Jobke <hey@morrisjobke.de>2016-03-17 18:15:37 +0300
commit23c0f4ff5f3b0023b4a2413536504d7065975a76 (patch)
treecc8f9eae813e7fcebea3974866a387c74434d637 /lib/private/l10n
parent828cb08d49ae9fe6e01da53fb7373eb386743cd4 (diff)
Read available l10n files also from theme folder
The old behaviour was that only languages could be used for an app that are already present in the apps/$app/l10n folder. If there is a themed l10n that is not present in the apps default l10n folder the language could not be used and the texts are not translated. With this change this is possible and also the l10n files are loaded even if the default l10n doesn't contain the l10n file.
Diffstat (limited to 'lib/private/l10n')
-rw-r--r--lib/private/l10n/factory.php31
1 files changed, 24 insertions, 7 deletions
diff --git a/lib/private/l10n/factory.php b/lib/private/l10n/factory.php
index 1440e9510c5..198c5605413 100644
--- a/lib/private/l10n/factory.php
+++ b/lib/private/l10n/factory.php
@@ -186,6 +186,23 @@ class Factory implements IFactory {
}
}
+ // merge with translations from theme
+ $theme = $this->config->getSystemValue('theme');
+ if (!empty($theme)) {
+ $themeDir = \OC::$SERVERROOT . '/themes/' . $theme . substr($dir, strlen(\OC::$SERVERROOT));
+
+ if (is_dir($themeDir)) {
+ $files = scandir($themeDir);
+ if ($files !== false) {
+ foreach ($files as $file) {
+ if (substr($file, -5) === '.json' && substr($file, 0, 4) !== 'l10n') {
+ $available[] = substr($file, 0, -5);
+ }
+ }
+ }
+ }
+ }
+
$this->availableLanguages[$key] = $available;
return $available;
}
@@ -271,14 +288,14 @@ class Factory implements IFactory {
&& file_exists($transFile)) {
// load the translations file
$languageFiles[] = $transFile;
+ }
- // merge with translations from theme
- $theme = $this->config->getSystemValue('theme');
- if (!empty($theme)) {
- $transFile = \OC::$SERVERROOT . '/themes/' . $theme . substr($transFile, strlen(\OC::$SERVERROOT));
- if (file_exists($transFile)) {
- $languageFiles[] = $transFile;
- }
+ // merge with translations from theme
+ $theme = $this->config->getSystemValue('theme');
+ if (!empty($theme)) {
+ $transFile = \OC::$SERVERROOT . '/themes/' . $theme . substr($transFile, strlen(\OC::$SERVERROOT));
+ if (file_exists($transFile)) {
+ $languageFiles[] = $transFile;
}
}