Completed
Push — master ( 059713...0e1444 )
by Thierry
02:39
created
src/Utils/Translation/Translator.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
         }
122 122
         if(!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage]))
123 123
         {
124
-           return $sText;
124
+            return $sText;
125 125
         }
126 126
         $message = $this->aTranslations[$sLanguage][$sText];
127 127
         foreach($aPlaceHolders as $name => $value)
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
      */
56 56
     private function _loadTranslations($sLanguage, $sPrefix, array $aTranslations)
57 57
     {
58
-        foreach($aTranslations as $sName => $xTranslation)
58
+        foreach ($aTranslations as $sName => $xTranslation)
59 59
         {
60 60
             $sName = trim($sName);
61 61
             $sName = ($sPrefix) ? $sPrefix . '.' . $sName : $sName;
62
-            if(!is_array($xTranslation))
62
+            if (!is_array($xTranslation))
63 63
             {
64 64
                 // Save this translation
65 65
                 $this->aTranslations[$sLanguage][$sName] = $xTranslation;
@@ -82,17 +82,17 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function loadTranslations($sFilePath, $sLanguage)
84 84
     {
85
-        if(!file_exists($sFilePath))
85
+        if (!file_exists($sFilePath))
86 86
         {
87 87
             return;
88 88
         }
89 89
         $aTranslations = require($sFilePath);
90
-        if(!is_array($aTranslations))
90
+        if (!is_array($aTranslations))
91 91
         {
92 92
             return;
93 93
         }
94 94
         // Load the translations
95
-        if(!array_key_exists($sLanguage, $this->aTranslations))
95
+        if (!array_key_exists($sLanguage, $this->aTranslations))
96 96
         {
97 97
             $this->aTranslations[$sLanguage] = [];
98 98
         }
@@ -111,20 +111,20 @@  discard block
 block discarded – undo
111 111
     public function trans($sText, array $aPlaceHolders = array(), $sLanguage = null)
112 112
     {
113 113
         $sText = trim((string)$sText);
114
-        if(!$sLanguage)
114
+        if (!$sLanguage)
115 115
         {
116 116
             $sLanguage = $this->xConfig->getOption('language');
117 117
         }
118
-        if(!$sLanguage)
118
+        if (!$sLanguage)
119 119
         {
120 120
             $sLanguage = $this->sDefaultLocale;
121 121
         }
122
-        if(!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage]))
122
+        if (!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage]))
123 123
         {
124 124
            return $sText;
125 125
         }
126 126
         $message = $this->aTranslations[$sLanguage][$sText];
127
-        foreach($aPlaceHolders as $name => $value)
127
+        foreach ($aPlaceHolders as $name => $value)
128 128
         {
129 129
             $message = str_replace(':' . $name, $value, $message);
130 130
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@
 block discarded – undo
63 63
             {
64 64
                 // Save this translation
65 65
                 $this->aTranslations[$sLanguage][$sName] = $xTranslation;
66
-            }
67
-            else
66
+            } else
68 67
             {
69 68
                 // Recursively read the translations in the array
70 69
                 $this->_loadTranslations($sLanguage, $sName, $xTranslation);
Please login to merge, or discard this patch.