Commit 2ce5e652 by SergeiKutanov

code style fixed

parent 08cf7e7b
......@@ -175,7 +175,6 @@ class MessageController extends Controller
$translated = file_get_contents($fileName);
preg_match_all('/(?<=msgid ").*(?="\nmsgstr)/', $translated, $keys);
preg_match_all('/(?<=msgstr ").*(?="\n\n)/', $translated, $values);
$translated = array_combine($keys[0], $values[0]);
} else {
$translated = require($fileName);
......@@ -189,7 +188,7 @@ class MessageController extends Controller
$merged = [];
$untranslated = [];
foreach ($messages as $message) {
$message = preg_replace('/\\"/', '\"', $message);
$message = preg_replace('/\\"/', '\"', $message);
if (array_key_exists($message, $translated) && strlen($translated[$message]) > 0) {
$merged[$message] = $translated[$message];
} else {
......@@ -203,17 +202,17 @@ class MessageController extends Controller
$todo[$message] = '';
}
ksort($translated);
if($format === 'php'){
foreach ($translated as $message => $translation) {
if (!isset($merged[$message]) && !isset($todo[$message]) && !$removeUnused) {
if (substr($translation, 0, 2) === '@@' && substr($translation, -2) === '@@') {
$todo[$message] = $translation;
} else {
$todo[$message] = '@@' . $translation . '@@';
}
}
}
}
if($format === 'php'){
foreach ($translated as $message => $translation) {
if (!isset($merged[$message]) && !isset($todo[$message]) && !$removeUnused) {
if (substr($translation, 0, 2) === '@@' && substr($translation, -2) === '@@') {
$todo[$message] = $translation;
} else {
$todo[$message] = '@@' . $translation . '@@';
}
}
}
}
$merged = array_merge($todo, $merged);
if ($sort) {
ksort($merged);
......@@ -224,8 +223,8 @@ class MessageController extends Controller
if($format === 'po'){
$out_str = '';
foreach($merged as $k=>$v){
$k = preg_replace('/(\")|(\\\")/', "\\\"", $k);
$v = preg_replace('/(\")|(\\\")/', "\\\"", $v);
$k = preg_replace('/(\")|(\\\")/', "\\\"", $k);
$v = preg_replace('/(\")|(\\\")/', "\\\"", $v);
$out_str .= "msgid \"$k\"\n";
$out_str .= "msgstr \"$v\"\n";
$out_str .= "\n";
......@@ -238,7 +237,7 @@ class MessageController extends Controller
$merged = '';
sort($messages);
foreach($messages as $message) {
$message = preg_replace('/(\")|(\\\")/', '\\\"', $message);
$message = preg_replace('/(\")|(\\\")/', '\\\"', $message);
$merged .= "msgid \"$message\"\n";
$merged .= "msgstr \"\"\n";
$merged .= "\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment