diff --git a/src/I18n.php b/src/I18n.php index c16e72f..56aa37d 100644 --- a/src/I18n.php +++ b/src/I18n.php @@ -285,10 +285,11 @@ class I18n { * * @param string $locale The locale of the input PO file * @param string $path The path of the input PO file + * @param bool $core Set to True if it's a run for core translations * * @return string JSON encoded file content */ - public static function po2json($locale, $path) { + public static function po2json($locale, $path, $core=false) { $fileHandler = new \Sepia\PoParser\SourceHandler\FileSystem($path); $poparser = new \Sepia\PoParser\Parser($fileHandler); $catalog = $poparser->parse(); @@ -305,7 +306,7 @@ class I18n { return json_encode(array( 'messages' => $messages, 'locale' => $locale, - 'domain' => self :: TEXT_DOMAIN, + 'domain' => $core?self :: CORE_TEXT_DOMAIN:self :: TEXT_DOMAIN, 'plural_expr' => '(n > 1)', )); } @@ -675,7 +676,7 @@ class I18n { } // Compile messages from PO file to JS catalog file - $js_catalog = self :: po2json($lang, $po_file); + $js_catalog = self :: po2json($lang, $po_file, $core_mode); $js_file = "$root_path/$lang.js"; if(!$fd = fopen($js_file, 'w')) { Log :: error(self::_("Fail to open %s JS catalog file in write mode (%s)."),