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

github.com/nextcloud/nextcloud.com.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-11-10 13:02:56 +0300
committerLukas Reschke <lukas@statuscode.ch>2016-11-10 13:02:56 +0300
commit1b97eccca1e8f21fa832227036c6e110c4808688 (patch)
treee28ebf9df0d6a89dddc5ce2d445a9c096538926c /l10n.php
parent5bc4b7fe213cbae004f7ffcfea2b26683399ab5e (diff)
Use translations only when 100%
Diffstat (limited to 'l10n.php')
-rw-r--r--l10n.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/l10n.php b/l10n.php
index fc325be2..db6ecb9c 100644
--- a/l10n.php
+++ b/l10n.php
@@ -70,12 +70,22 @@ class L10N {
}
$this->requestedStrings[$stringHash] = $string;
- // Read the translated string
+ // Read the translated string if 100% translated
$translationFile = __DIR__ . '/l10n/'.$this->getCurrentLanguage().'/' . $this->pageName . '.json';
if(file_exists($translationFile)) {
- $translations = json_decode(file_get_contents($translationFile), true);
- if(isset($translations[$stringHash])) {
- return $translations[$stringHash];
+ $originalFile = json_decode(file_get_contents(__DIR__ . '/l10n/base/' . $this->pageName . '.json'), true);
+ $translationFile = json_decode(file_get_contents($translationFile), true);
+
+ if(!is_array($translationFile) || !is_array($originalFile)) {
+ return $string;
+ }
+
+ if (array_keys($translationFile) !== array_keys($originalFile)) {
+ return $string;
+ }
+
+ if(isset($translationFile[$stringHash])) {
+ return $translationFile[$stringHash];
}
}