Skip to content

Commit 83ceb6a

Browse files
authored
translate messages from use-unique-name-validation (#865)
1 parent 3397790 commit 83ceb6a

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

src/hooks/use-unique-name-validation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ export function useUniqueNameValidation({
5858
if (alreadyExist) {
5959
setError(name, {
6060
type: 'validate',
61-
message: 'nameAlreadyUsed',
61+
message: 'use-unique-name-validation/nameAlreadyUsed',
6262
});
6363
}
6464
})
6565
.catch(() => {
6666
setError(name, {
6767
type: 'validate',
68-
message: 'nameValidityCheckErrorMsg',
68+
message: 'use-unique-name-validation/nameValidityCheckErrorMsg',
6969
});
7070
})
7171
.finally(() => {
@@ -104,14 +104,14 @@ export function useUniqueNameValidation({
104104
clearErrors(name);
105105
setError('root.isValidating', {
106106
type: 'validate',
107-
message: 'cantSubmitWhileValidating',
107+
message: 'use-unique-name-validation/cantSubmitWhileValidating',
108108
});
109109
debouncedHandleCheckName(trimmedValue);
110110
} else {
111111
clearErrors('root.isValidating');
112112
setError(name, {
113113
type: 'validate',
114-
message: 'nameEmpty',
114+
message: 'use-unique-name-validation/nameEmpty',
115115
});
116116
}
117117
}, [

src/translations/en/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ export * from './external/exportParamsEn';
2828
export * from './external/importParamsEn';
2929
export * from './componentsEn';
3030
export * from './parameters';
31+
export * from './use-unique-name-validation-en';
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
8+
export const useUniqueNameValidationEn = {
9+
'use-unique-name-validation/nameAlreadyUsed': 'This name is already used',
10+
'use-unique-name-validation/nameValidityCheckErrorMsg': 'Error while checking name validity',
11+
'use-unique-name-validation/cantSubmitWhileValidating': 'Impossible to submit the form while validating a field',
12+
'use-unique-name-validation/nameEmpty': 'The name is empty',
13+
};

src/translations/fr/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ export * from './external/exportParamsFr';
2828
export * from './external/importParamsFr';
2929
export * from './componentsFr';
3030
export * from './parameters';
31+
export * from './use-unique-name-validation-fr';
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
8+
export const useUniqueNameValidationFr = {
9+
'use-unique-name-validation/nameAlreadyUsed': 'Ce nom est déjà utilisé',
10+
'use-unique-name-validation/nameValidityCheckErrorMsg': 'Erreur lors de la vérification de la validité du nom',
11+
'use-unique-name-validation/cantSubmitWhileValidating':
12+
"Impossible de soumettre le formulaire durant la validation d'un champ",
13+
'use-unique-name-validation/nameEmpty': 'Le nom est vide',
14+
};

0 commit comments

Comments
 (0)