From a97a215e0bc091b712e360c1b3dbb521b3d46da2 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 10 Jan 2023 09:47:21 +0100 Subject: [PATCH] 12100 capture function --- core/class/helper.class.php | 10 ++++++++++ module/blog/i18n/fr_FR.json | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 module/blog/i18n/fr_FR.json diff --git a/core/class/helper.class.php b/core/class/helper.class.php index ce56c5c0..dc8c92fe 100644 --- a/core/class/helper.class.php +++ b/core/class/helper.class.php @@ -26,6 +26,16 @@ class helper public static function translate($text) { + $target = 'blog'; + /** Collecte des dialogues des modules */ + $url = $_SERVER['QUERY_STRING']; + $module = explode('/', $url); + if ($module === $target) + { + $dialogues = json_decode(file_get_contents('module/' . $target . '/i18n/fr_FR.json' ), true); + $data = array_merge($dialogues,[$text => '']); + file_put_contents ('module/' . $target . '/i18n/fr_FR.json', json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), LOCK_EX); + } return (array_key_exists($text, core::$dialog) && !empty(core::$dialog[$text]) ? core::$dialog[$text] : $text); } diff --git a/module/blog/i18n/fr_FR.json b/module/blog/i18n/fr_FR.json new file mode 100644 index 00000000..cb92a2ed --- /dev/null +++ b/module/blog/i18n/fr_FR.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file