From 565fe09cb50b224a9f7bae4dd7cd218a27b0ebc4 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 23 Jan 2024 23:25:15 +0100 Subject: [PATCH] Qual: Fix translation keys. # Qual: Fix translation keys Modify some translation keys so that they correspond to each other, use an existing key or fix the contents as it's not translated yet. --- htdocs/admin/security.php | 5 +- htdocs/contrat/class/contrat.class.php | 4 +- htdocs/core/class/commonobject.class.php | 79 ++++++++++++------------ htdocs/core/class/link.class.php | 7 ++- htdocs/core/tpl/advtarget.tpl.php | 4 +- htdocs/expedition/card.php | 5 +- htdocs/holiday/card_group.php | 9 +-- htdocs/takepos/invoice.php | 19 +++--- 8 files changed, 71 insertions(+), 61 deletions(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 1fe0d90511e..4c6a5610067 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2022 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2013-2015 Juanjo Menent + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -484,11 +485,11 @@ print ''; print '
'; -if (GETPOST('info', 'int') > 0) { +if (GETPOSTINT('info') > 0) { if (function_exists('password_hash')) { print $langs->trans("Note: The function password_hash exists on your PHP")."
\n"; } else { - print $langs->trans("Note: The function password_hash does not exists on your PHP")."
\n"; + print $langs->trans("Note: The function password_hash does not exist on your PHP")."
\n"; } print 'MAIN_SECURITY_HASH_ALGO = '.getDolGlobalString('MAIN_SECURITY_HASH_ALGO')."
\n"; print 'MAIN_SECURITY_SALT = '.getDolGlobalString('MAIN_SECURITY_SALT')."
\n"; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9d465b0fbce..e5a54c9b119 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2015-2018 Ferran Marcet * Copyright (C) 2024 William Mead + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1157,7 +1158,8 @@ class Contrat extends CommonObject return -2; } } else { - $this->error = $langs->trans("UnknownError: ".$this->db->error()." -", LOG_DEBUG); + $this->error = $langs->trans("UnknownError").": ".$this->db->error(); + dol_syslog(get_class($this)."::create - 10 - ".$this->error, LOG_ERR); $this->db->rollback(); return -1; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fd72878e36e..18ac4649eb6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -17,6 +17,7 @@ * Copyright (C) 2023 Gauthier VERDOL * Copyright (C) 2021 Grégory Blémand * Copyright (C) 2023 Lenin Rivas + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -6459,12 +6460,12 @@ abstract class CommonObject //dol_syslog("double value"." on ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG); $new_array_options[$key] = $value; break; - /*case 'select': // Not required, we chose value='0' for undefined values - if ($value=='-1') - { - $this->array_options[$key] = null; - } - break;*/ + /*case 'select': // Not required, we chose value='0' for undefined values + if ($value=='-1') + { + $this->array_options[$key] = null; + } + break;*/ case 'password': $algo = ''; if ($this->array_options[$key] != '' && is_array($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])) { @@ -6877,14 +6878,14 @@ abstract class CommonObject $this->array_options["options_".$key] = $new_array_options["options_".$key]; break; - /*case 'select': // Not required, we chose value='0' for undefined values - if ($value=='-1') - { - $new_array_options["options_".$key] = $value; + /*case 'select': // Not required, we chose value='0' for undefined values + if ($value=='-1') + { + $new_array_options["options_".$key] = $value; - $this->array_options["options_".$key] = $new_array_options["options_".$key]; - } - break;*/ + $this->array_options["options_".$key] = $new_array_options["options_".$key]; + } + break;*/ case 'password': $algo = ''; if ($this->array_options["options_".$key] != '' && is_array($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])) { @@ -6969,35 +6970,35 @@ abstract class CommonObject $this->array_options["options_".$key] = $new_array_options["options_".$key]; } break; - /* - case 'link': - $param_list = array_keys($attributeParam['options']); - // 0 : ObjectName - // 1 : classPath - $InfoFieldList = explode(":", $param_list[0]); - dol_include_once($InfoFieldList[1]); - if ($InfoFieldList[0] && class_exists($InfoFieldList[0])) - { - if ($value == '-1') // -1 is key for no defined in combo list of objects + /* + case 'link': + $param_list = array_keys($attributeParam['options']); + // 0 : ObjectName + // 1 : classPath + $InfoFieldList = explode(":", $param_list[0]); + dol_include_once($InfoFieldList[1]); + if ($InfoFieldList[0] && class_exists($InfoFieldList[0])) { - $new_array_options[$key] = ''; - } elseif ($value) { - $object = new $InfoFieldList[0]($this->db); - if (is_numeric($value)) $res = $object->fetch($value); // Common case - else $res = $object->fetch('', $value); // For compatibility + if ($value == '-1') // -1 is key for no defined in combo list of objects + { + $new_array_options[$key] = ''; + } elseif ($value) { + $object = new $InfoFieldList[0]($this->db); + if (is_numeric($value)) $res = $object->fetch($value); // Common case + else $res = $object->fetch('', $value); // For compatibility - if ($res > 0) $new_array_options[$key] = $object->id; - else { - $this->error = "Id/Ref '".$value."' for object '".$object->element."' not found"; - $this->db->rollback(); - return -1; + if ($res > 0) $new_array_options[$key] = $object->id; + else { + $this->error = "Id/Ref '".$value."' for object '".$object->element."' not found"; + $this->db->rollback(); + return -1; + } } + } else { + dol_syslog('Error bad setup of extrafield', LOG_WARNING); } - } else { - dol_syslog('Error bad setup of extrafield', LOG_WARNING); - } - break; - */ + break; + */ case 'checkbox': case 'chkbxlst': $new_array_options = array(); @@ -8250,7 +8251,7 @@ abstract class CommonObject { global $langs; if (empty($msg)) { - $msg = $langs->trans("UnknowError"); + $msg = $langs->trans("UnknownError"); } $this->error = $this->validateFieldsErrors[$fieldKey] = $msg; diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index bd265349c3f..b8a54ec53c7 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,7 +92,7 @@ class Link extends CommonObject // Check parameters if (empty($this->url)) { - $this->error = $langs->trans("NoUrl"); + $this->error = $langs->trans("NoURL"); return -1; } @@ -207,11 +208,11 @@ class Link extends CommonObject } } else { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - // Doublon + // Duplicate $this->error = $langs->trans("ErrorDuplicateField"); $result = -1; } else { - $this->error = $langs->trans("Error sql = ".$sql); + $this->error = $langs->trans("Error sql")."= $sql"; $result = -2; } $this->db->rollback(); diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index 78db690f00b..8d9b566794e 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -1,4 +1,6 @@ + */ /* * * This program is free software; you can redistribute it and/or modify @@ -165,7 +167,7 @@ print ''."\n"; print ''."\n"; // Mother Company -print ''.$langs->trans("Maison mère"); +print ''.$langs->trans("ParentCompany"); if (!empty($array_query['cust_mothercompany'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index afe1b7b0836..053424b9e25 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -14,6 +14,7 @@ * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2020 Lenin Rivas * Copyright (C) 2022 Josep Lluís Amador + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -537,7 +538,7 @@ if (empty($reshook)) { || $action == 'settrueDepth' || $action == 'setshipping_method_id') && $user->hasRight('expedition', 'creer') - ) { + ) { // Action update $error = 0; @@ -2462,7 +2463,7 @@ if ($action == 'create') { print ''; } else { print ''; - print ''.$langs->trans("NotEnoughStock").''; + print ''.$langs->trans("ErrorStockIsNotEnough").''; } } else { print ''; diff --git a/htdocs/holiday/card_group.php b/htdocs/holiday/card_group.php index e7ce2fd79d2..cbe1aaaf1b5 100644 --- a/htdocs/holiday/card_group.php +++ b/htdocs/holiday/card_group.php @@ -8,6 +8,7 @@ * Copyright (C) 2018 Frédéric France * Copyright (C) 2020-2021 Udo Tamm * Copyright (C) 2022 Anthony Berton + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -700,7 +701,7 @@ function sendMail($id, $cancreate, $now, $autoValidation) dol_syslog("Expected validator has no email, so we redirect directly to finished page without sending email"); $objStd->error++; - $objStd->msg = $langs->trans('ErroremailTo'); + $objStd->msg = $langs->trans('ErrorMailRecipientIsEmpty'); $objStd->status = 'error'; $objStd->style="warnings"; return $objStd; @@ -782,17 +783,17 @@ function sendMail($id, $cancreate, $now, $autoValidation) if (!$result) { $objStd->error++; - $objStd->msg = $langs->trans('ErroreSendmail'); + $objStd->msg = $langs->trans('ErrorMailNotSend'); $objStd->style="warnings"; $objStd->status = 'error'; } else { - $objStd->msg = $langs->trans('mailSended'); + $objStd->msg = $langs->trans('MailSent'); } return $objStd; } else { $objStd->error++; - $objStd->msg = $langs->trans('ErroreVerif'); + $objStd->msg = $langs->trans('ErrorVerif'); $objStd->status = 'error'; $objStd->style="errors"; return $objStd; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 220fe3bf3b3..924a5779ec4 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -3,6 +3,7 @@ * Copyright (C) 2018 Andreu Bisquerra * Copyright (C) 2021 Nicolas ZABOURI * Copyright (C) 2022-2023 Christophe Battarel + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -618,7 +619,7 @@ if (empty($reshook)) { } // If this line is sended to printer create new line // check if qty in stock if (getDolGlobalString('TAKEPOS_QTY_IN_STOCK') && (($line->qty + $qty) > $prod->stock_reel)) { - $invoice->error = $langs->trans('NotEnoughInStock'); + $invoice->error = $langs->trans("ErrorStockIsNotEnough"); dol_htmloutput_errors($invoice->error, $invoice->errors, 1); $err++; break; @@ -676,7 +677,7 @@ if (empty($reshook)) { // check if qty in stock if (getDolGlobalString('TAKEPOS_QTY_IN_STOCK') && $qty > $prod->stock_reel) { - $invoice->error = $langs->trans('NotEnoughInStock'); + $invoice->error = $langs->trans("ErrorStockIsNotEnough"); dol_htmloutput_errors($invoice->error, $invoice->errors, 1); $err++; } @@ -1463,17 +1464,17 @@ $( document ).ready(function() {