From d286ba60661762efba6ccfe1b64b71edb4a7a996 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 12 Feb 2022 20:09:22 +0100 Subject: [PATCH] improve lang export --- Admin/Install/db.json | 5 +++++ Interfaces/OMS/Exporter.php | 7 ++++++- Interfaces/OMS/Lang/en.lang.php | 1 + Models/InterfaceManagerMapper.php | 3 ++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 570c56b..892ab41 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -14,6 +14,11 @@ "type": "VARCHAR(255)", "null": false }, + "exchange_info": { + "name": "exchange_info", + "type": "VARCHAR(255)", + "null": false + }, "exchange_path": { "name": "exchange_path", "type": "VARCHAR(255)", diff --git a/Interfaces/OMS/Exporter.php b/Interfaces/OMS/Exporter.php index 42294d8..19213c0 100755 --- a/Interfaces/OMS/Exporter.php +++ b/Interfaces/OMS/Exporter.php @@ -80,6 +80,11 @@ final class Exporter extends ExporterAbstract $this->account = $request->header->account; + $lang = []; + $lang['Exchange'] = include __DIR__ . '/Lang/' . $request->getLanguage() . '.lang.php'; + + $this->l11n->loadLanguage($request->header->l11n->getLanguage(), 'Exchange', $lang); + $result = []; if ($request->getData('type') === 'language') { @@ -210,7 +215,7 @@ final class Exporter extends ExporterAbstract continue; // @codeCoverageIgnore } - \preg_match_all('/(\$this\->getHtml\(\')([0-9a-zA-Z:]+)(\'\))/', $template, $keys, \PREG_PATTERN_ORDER); + \preg_match_all('/(\$this\->getHtml\(\')([0-9a-zA-Z:\-]+)(\'\))/', $template, $keys, \PREG_PATTERN_ORDER); foreach ($keys[2] ?? [] as $key) { if (!isset($languageArray[''][$module][$theme][$key])) { diff --git a/Interfaces/OMS/Lang/en.lang.php b/Interfaces/OMS/Lang/en.lang.php index 8a6302f..5ae06a3 100755 --- a/Interfaces/OMS/Lang/en.lang.php +++ b/Interfaces/OMS/Lang/en.lang.php @@ -14,4 +14,5 @@ declare(strict_types=1); */ return [ 'Language' => 'Language', + 'LangFileExported' => 'Language file got expoerted', ]; diff --git a/Models/InterfaceManagerMapper.php b/Models/InterfaceManagerMapper.php index 5f6aae0..76ee799 100755 --- a/Models/InterfaceManagerMapper.php +++ b/Models/InterfaceManagerMapper.php @@ -35,7 +35,8 @@ final class InterfaceManagerMapper extends DataMapperFactory public const COLUMNS = [ 'exchange_id' => ['name' => 'exchange_id', 'type' => 'int', 'internal' => 'id'], 'exchange_title' => ['name' => 'exchange_title', 'type' => 'string', 'internal' => 'info/name'], - 'exchange_path' => ['name' => 'exchange_path', 'type' => 'string', 'internal' => 'path'], + 'exchange_info' => ['name' => 'exchange_info', 'type' => 'string', 'internal' => 'path'], + 'exchange_path' => ['name' => 'exchange_path', 'type' => 'string', 'internal' => 'info/path'], 'exchange_version' => ['name' => 'exchange_version', 'type' => 'string', 'internal' => 'info/version'], 'exchange_export' => ['name' => 'exchange_export', 'type' => 'bool', 'internal' => 'info/export'], 'exchange_import' => ['name' => 'exchange_import', 'type' => 'bool', 'internal' => 'info/import'],