Skip to content

Commit

Permalink
Merge pull request #32319 from Treenity/patch-1
Browse files Browse the repository at this point in the history
NEW: Enhance i18n regex patterns to support underscores in keys
  • Loading branch information
eldy authored Dec 13, 2024
2 parents 416d86b + 14a341f commit a90d16b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions htdocs/core/class/translate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,17 +629,17 @@ private function getTradFromKey($key)

$newstr = $key;
$reg = array();
if (preg_match('/^Civility([0-9A-Z]+)$/i', $key, $reg)) {
if (preg_match('/^Civility([0-9A-Z_]+)$/i', $key, $reg)) {
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_civility', 'code', 'label');
} elseif (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i', $key, $reg)) {
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_currencies', 'code_iso', 'label');
} elseif (preg_match('/^SendingMethod([0-9A-Z]+)$/i', $key, $reg)) {
} elseif (preg_match('/^SendingMethod([0-9A-Z_]+)$/i', $key, $reg)) {
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_shipment_mode', 'code', 'libelle');
} elseif (preg_match('/^PaymentType(?:Short)?([0-9A-Z]+)$/i', $key, $reg)) {
} elseif (preg_match('/^PaymentType(?:Short)?([0-9A-Z_]+)$/i', $key, $reg)) {
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_paiement', 'code', 'libelle', '', 1);
} elseif (preg_match('/^OppStatus([0-9A-Z]+)$/i', $key, $reg)) {
} elseif (preg_match('/^OppStatus([0-9A-Z_]+)$/i', $key, $reg)) {
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_lead_status', 'code', 'label');
} elseif (preg_match('/^OrderSource([0-9A-Z]+)$/i', $key, $reg)) {
} elseif (preg_match('/^OrderSource([0-9A-Z_]+)$/i', $key, $reg)) {
// TODO OrderSourceX must be replaced with content of table llx_c_input_reason or llx_c_input_method
//$newstr=$this->getLabelFromKey($db,$reg[1],'llx_c_input_reason','code','label');
}
Expand Down

0 comments on commit a90d16b

Please sign in to comment.