ソースを参照

Update Core\Lang

Show more information in an exception.
Visman 4 年 前
コミット
9f72acea32
1 ファイル変更10 行追加4 行削除
  1. 10 4
      app/Core/Lang.php

+ 10 - 4
app/Core/Lang.php

@@ -45,6 +45,11 @@ class Lang
      */
     protected $langOrder = [];
 
+    /**
+     * @var string
+     */
+    protected $cur;
+
     /**
      * Список операторов для вычисления Plural Forms
      * @var array
@@ -134,8 +139,9 @@ class Lang
         $path = $path ?: $this->c->DIR_LANG;
 
         do {
-            $flag     = true;
-            $fullPath = "{$path}/{$lang}/{$name}.po";
+            $flag      = true;
+            $this->cur = "{$lang}/{$name}.po";
+            $fullPath  = "{$path}/{$this->cur}";
 
             if (\is_file($fullPath)) {
                 $time  = \filemtime($fullPath);
@@ -204,7 +210,7 @@ class Lang
 
                 // ошибка формата
                 if (! isset($cur['msgid'])) {
-                    throw new RuntimeException('File format error');
+                    throw new RuntimeException("File ({$this->cur}) format error");
                 }
 
                 // заголовки
@@ -315,7 +321,7 @@ class Lang
                     break;
 
                 default:
-                    throw new RuntimeException('File format error');
+                    throw new RuntimeException("File ({$this->cur}) format error");
             }
         }