diff --git a/ecrire/public/compiler.php b/ecrire/public/compiler.php index 875d1e5b63e848306c1aea9679614bc53287ff55..e5ceebb03b0982b055eaf99e4bd732499328fdf9 100644 --- a/ecrire/public/compiler.php +++ b/ecrire/public/compiler.php @@ -924,15 +924,27 @@ function compile_cas($tableau, $descr, &$boucles, $id_boucle) { case 'idiome': $l = array(); - $cpl = ''; + $code = ''; foreach ($p->arg as $k => $v) { $_v = calculer_liste($v, $descr, $boucles, $id_boucle); if ($k) $l[] = _q($k) . ' => ' . $_v; - else $cpl = " . $_v"; + else $code = $_v; } - $l = !$l ? '' : (", array(".implode(",\n",$l).")"); - $code = "_T('" . $p->module . ":" . $p->nom_champ . "'$cpl$l)"; + // Si le module n'est pas fourni, l'expliciter sauf si calculé + if ($p->module) { + $m = $p->module .':'.$p->nom_champ; + } elseif ($p->nom_champ) { + $m = MODULES_IDIOMES .':'.$p->nom_champ; + } else { + $m = ''; + } + + $code = (!$code ? "'$m'" : + ($m ? "'$m' . $code" : + ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) + . (!$l ? '' : (", array(" . implode(",\n", $l) . ")")); + $code = "_T($code)"; if ($p->param) { $p->id_boucle = $id_boucle; $p->boucles = &$boucles; diff --git a/ecrire/public/decompiler.php b/ecrire/public/decompiler.php index 09af880ba43a7404ad698657011d1b3607734fec..de52ce5f1781f0df1396f217b054c73914220ac7 100644 --- a/ecrire/public/decompiler.php +++ b/ecrire/public/decompiler.php @@ -71,9 +71,6 @@ function decompiler_polyglotte($struct, $fmt='', $prof=0) function decompiler_idiome($struct, $fmt='', $prof=0) { - $module = ($struct->module == MODULES_IDIOMES)? '' - : $struct->module; - $args = array(); foreach ($struct->arg as $k => $v) { $args[$k]= public_decompiler($v, $fmt, $prof); @@ -82,7 +79,7 @@ function decompiler_idiome($struct, $fmt='', $prof=0) $filtres = decompiler_liste($struct->param, $fmt, $prof); $f = 'format_idiome_' . $fmt; - return $f($struct->nom_champ, $module, $args, $filtres, $prof); + return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof); } function decompiler_champ($struct, $fmt='', $prof=0) diff --git a/ecrire/public/phraser_html.php b/ecrire/public/phraser_html.php index 846fa2262daf71e1f4cf64bc03a1658586c49423..fd2cf81207731d2b932b524d7c810e9cbdd7f912 100644 --- a/ecrire/public/phraser_html.php +++ b/ecrire/public/phraser_html.php @@ -157,7 +157,7 @@ function phraser_idiomes($texte,$ligne,$result) { } $champ->arg = $args; $champ->nom_champ = strtolower($match[3]); - $champ->module = $match[2] ? $match[2] : MODULES_IDIOMES; + $champ->module = $match[2]; // pas d'imbrication pour les filtres sur langue phraser_args(@$match[7], ":", '', array(), $champ); $result[] = $champ;