diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php
index 7d07f7ead94..789e85d167d 100644
--- a/htdocs/admin/translation.php
+++ b/htdocs/admin/translation.php
@@ -75,7 +75,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
-if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
+if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{
$transkey='';
$transvalue='';
@@ -116,7 +116,11 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
}
else
{
- dol_print_error($db);
+ if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
+ {
+ setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings');
+ }
+ else dol_print_error($db);
$action='';
}
}
@@ -422,9 +426,17 @@ if ($mode == 'searchkey')
print '
| '.$langcode.' | '.$key.' | ';
print dol_escape_htmltag($val);
print ' | ';
- if ($val != $newlangfileonly->tab_translate[$key])
+ if (! empty($newlangfileonly->tab_translate[$key]))
{
- $htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
+ if ($val != $newlangfileonly->tab_translate[$key])
+ {
+ $htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
+ print $form->textwithpicto('', $htmltext, 1, 'info');
+ }
+ }
+ else
+ {
+ $htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);
print $form->textwithpicto('', $htmltext, 1, 'warning');
}
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index be60fc5db7c..504470b203d 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1075,6 +1075,7 @@ CurrentTranslationString=Current translation string
WarningAtLeastKeyOrTranslationRequired=A search criteria is required at least for key or translation string
NewTranslationStringToShow=New translation string to show
OriginalValueWas=The original translation is overwritten. Original value was:
%s
+TransKeyWithoutOriginalValue=You forced a new translation for the translation key '%s' that does not exists in any language files
TotalNumberOfActivatedModules=Total number of activated feature modules: %s / %s
YouMustEnableOneModule=You must at least enable 1 module
ClassNotFoundIntoPathWarning=Class %s not found into PHP path
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index af18693f9d4..72912ca2b1f 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -205,3 +205,4 @@ WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice
WarningTooManyDataPleaseUseMoreFilters=Too many data (more than %s lines). Please use more filters or set the constant %s to a higher limit.
WarningSomeLinesWithNullHourlyRate=Some times were recorded by some users while their hourly rate was not defined. A value of 0 %s per hour was used but this may result in wrong valuation of time spent.
WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security purpose you will have to login with your new login before next action.
+WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language
\ No newline at end of file
|