12100 capture function

This commit is contained in:
Fred Tempez 2023-01-10 09:47:21 +01:00
parent 26dce57cb6
commit a97a215e0b
2 changed files with 13 additions and 0 deletions

View File

@ -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);
}

View File

@ -0,0 +1,3 @@
{
}