forked from ZwiiCMS-Team/ZwiiCMS
Merge branch '12100---collecte-dialogues-modules' into 12100
This commit is contained in:
commit
710f2cc2f0
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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'], '<span>') === 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 '<div class="speech"><div class="speechBubble">' . $text . '</div>' . template::ico('mimi speechMimi', ['fontSize' => '7em']) . '</div>';
|
||||
return '<div class="speech"><div class="speechBubble">' . helper::translate($text) . '</div>' . template::ico('mimi speechMimi', ['fontSize' => '7em']) . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
3
module/blog/i18n/fr_FR.json
Normal file
3
module/blog/i18n/fr_FR.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user