From a97a215e0bc091b712e360c1b3dbb521b3d46da2 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 10 Jan 2023 09:47:21 +0100 Subject: [PATCH 1/2] 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 From fff26fd561c6ffb944d20eda1ea03575d04a4809 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 10 Jan 2023 15:18:07 +0100 Subject: [PATCH 2/2] 12100 dialogue translation templates --- core/class/template.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/class/template.class.php b/core/class/template.class.php index 9b575af0..65fbbd3c 100644 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -25,7 +25,10 @@ class template 'help' => '' ], $attributes); // Traduction de l'aide et de l'étiquette - $attributes['value'] = helper::translate($attributes['value']); + if (strpos($attributes['value'], '') === 0 ) { + // Le contenu n'est pas une icône + $attributes['value'] = helper::translate($attributes['value']); + } $attributes['help'] = helper::translate($attributes['help']); // Retourne le html return sprintf( @@ -752,7 +755,7 @@ class template */ public static function speech($text) { - return '
' . $text . '
' . template::ico('mimi speechMimi', ['fontSize' => '7em']) . '
'; + return '
' . helper::translate($text) . '
' . template::ico('mimi speechMimi', ['fontSize' => '7em']) . '
'; } /**