generate_lang_file.php : Fix some string detection problems

This commit is contained in:
Benjamin Renard 2019-10-17 20:57:23 +02:00
parent defc395022
commit 6a0d2f1767
2 changed files with 43 additions and 37 deletions

View file

@ -155,6 +155,10 @@ $GLOBALS['LSlang'] = array (
"Name must contain alphanumeric values only." => "Name must contain alphanumeric values only." =>
"Le nom doit contenir uniquement des valeurs alpha-numériques.", "Le nom doit contenir uniquement des valeurs alpha-numériques.",
# templates/default/viewSearch.tpl:120
"Nb / page :" =>
"Nb / page :",
# LSobjects.LSpeople.attrs.uidNumber.label # LSobjects.LSpeople.attrs.uidNumber.label
"Numeric identifier" => "Numeric identifier" =>
"Identifiant numérique", "Identifiant numérique",

View file

@ -307,36 +307,37 @@ if (!in_array('config', $withouts) && (!$only || $only == 'config')) {
case 'jsonCompositeAttribute': case 'jsonCompositeAttribute':
$components = LSconfig :: keys("LSobjects.$obj.attrs.$attr.html_options.components"); $components = LSconfig :: keys("LSobjects.$obj.attrs.$attr.html_options.components");
foreach($components as $c) { foreach($components as $c) {
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.$c.label"); addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.components.$c.label");
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.$c.help_info"); addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.components.$c.help_info");
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.$c.check_data.*.msg"); addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.components.$c.check_data.*.msg");
if ( if (
LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.$c.type") == 'select_list' && LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.components.$c.type") == 'select_list' &&
LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.$c.options.translate_labels", "True", "bool") && LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.components.$c.options.translate_labels", "True", "bool") &&
!in_array('select-list', $withouts) !in_array('select-list', $withouts)
) )
{ {
foreach(LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.$c.options.possible_values", array()) as $pkey => $plabel) { foreach(LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.components.$c.options.possible_values", array()) as $pkey => $plabel) {
if ($pkey == 'OTHER_OBJECT') if (is_string($pkey)) {
continue; if ($pkey == 'OTHER_OBJECT')
elseif ($pkey == 'OTHER_ATTRIBUTE') {
if (is_string($plabel))
continue; continue;
elseif (is_array($plabel)) { elseif ($pkey == 'OTHER_ATTRIBUTE') {
if (isset($plabel['json_component_key'])) if (is_string($plabel))
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.$c.options.possible_values.OTHER_ATTRIBUTE.json_component_label"); continue;
else elseif (is_array($plabel)) {
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.$c.options.possible_values.OTHER_ATTRIBUTE.*"); if (isset($plabel['json_component_key']))
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.components.$c.options.possible_values.OTHER_ATTRIBUTE.json_component_label");
else
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.components.$c.options.possible_values.OTHER_ATTRIBUTE.*");
}
} }
else
add($plabel, "LSobjects.$obj.attrs.$attr.html_options.components.$c.options.possible_values.$pkey");
} }
elseif(is_string($plabel)) { elseif (is_int($pkey) && is_array($plabel)) {
add($plabel, "LSobjects.$obj.attrs.$attr.html_options.$c.options.possible_values.$pkey");
}
elseif (is_array($plabel)) {
// Sub possible values // Sub possible values
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.$c.options.possible_values.$pkey.label"); addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.components.$c.options.possible_values.$pkey.label");
foreach(LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.$c.options.possible_values.$pkey.possible_values", array()) as $ppkey => $pplabel) { foreach(LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.components.$c.options.possible_values.$pkey.possible_values", array()) as $ppkey => $pplabel) {
if ($ppkey == 'OTHER_OBJECT') if ($ppkey == 'OTHER_OBJECT')
continue; continue;
elseif ($ppkey == 'OTHER_ATTRIBUTE') { elseif ($ppkey == 'OTHER_ATTRIBUTE') {
@ -344,13 +345,13 @@ if (!in_array('config', $withouts) && (!$only || $only == 'config')) {
continue; continue;
elseif (is_array($pplabel)) { elseif (is_array($pplabel)) {
if (isset($pplabel['json_component_key'])) if (isset($pplabel['json_component_key']))
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.$c.options.possible_values.OTHER_ATTRIBUTE.json_component_label"); addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.components.$c.options.possible_values.OTHER_ATTRIBUTE.json_component_label");
else else
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.$c.options.possible_values.OTHER_ATTRIBUTE.*"); addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.components.$c.options.possible_values.OTHER_ATTRIBUTE.*");
} }
} }
elseif(is_string($pplabel)) { elseif(is_string($pplabel)) {
add($pplabel, "LSobjects.$obj.attrs.$attr.html_options.$c.options.possible_values.$pkey.possible_values.$ppkey"); add($pplabel, "LSobjects.$obj.attrs.$attr.html_options.components.$c.options.possible_values.$pkey.possible_values.$ppkey");
} }
} }
} }
@ -369,22 +370,23 @@ if (!in_array('config', $withouts) && (!$only || $only == 'config')) {
case 'select_box': case 'select_box':
if (LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.translate_labels", "True", "bool") && !in_array('select-list', $withouts)) { if (LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.translate_labels", "True", "bool") && !in_array('select-list', $withouts)) {
foreach(LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.possible_values", array()) as $pkey => $plabel) { foreach(LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.possible_values", array()) as $pkey => $plabel) {
if ($pkey == 'OTHER_OBJECT') if (is_string($pkey)) {
continue; if ($pkey == 'OTHER_OBJECT')
elseif ($pkey == 'OTHER_ATTRIBUTE') {
if (is_string($plabel))
continue; continue;
elseif (is_array($plabel)) { elseif ($pkey == 'OTHER_ATTRIBUTE') {
if (isset($plabel['json_component_key'])) if (is_string($plabel))
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.possible_values.OTHER_ATTRIBUTE.json_component_label"); continue;
else elseif (is_array($plabel)) {
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.possible_values.OTHER_ATTRIBUTE.*"); if (isset($plabel['json_component_key']))
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.possible_values.OTHER_ATTRIBUTE.json_component_label");
else
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.possible_values.OTHER_ATTRIBUTE.*");
}
} }
else
add($plabel, "LSobjects.$obj.attrs.$attr.html_options.possible_values.$pkey");
} }
elseif(is_string($plabel)) { elseif (is_int($pkey) && is_array($plabel)) {
add($plabel, "LSobjects.$obj.attrs.$attr.html_options.possible_values.$pkey");
}
elseif (is_array($plabel)) {
// Sub possible values // Sub possible values
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.possible_values.$pkey.label"); addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.possible_values.$pkey.label");
foreach(LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.possible_values.$pkey.possible_values", array()) as $ppkey => $pplabel) { foreach(LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.possible_values.$pkey.possible_values", array()) as $ppkey => $pplabel) {