Skip to content

Commit 3c81184

Browse files
committed
FLS-1423 - Using translation module for cleaner switch to Welsh on save button text
1 parent 667b67c commit 3c81184

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

runner/locales/cy.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"signOut": "Allgofnodi",
33
"markAsComplete": "A ydych chi eisiau marcio bod yr adran hon wedi'i chwblhau?",
44
"removeText": "Dileu",
5+
"saveText": "Cadw",
6+
"saveAndAddAnotherText": "Cadw ac ychwanegu un arall",
57
"validation": {
68
"required": "{#label} yn ofynnol",
79
"max": "{#label} rhaid iddo fod yn {#limit} nod neu lai",

runner/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"signOut": "Sign out",
33
"markAsComplete": "Have you completed this section?",
44
"removeText": "Remove",
5+
"saveText": "Save",
6+
"saveAndAddAnotherText": "Save and add another",
57
"validation": {
68
"required": "{#label} is required",
79
"max": "{#label} must be {#limit} characters or less",

runner/src/server/plugins/engine/page-controllers/RepeatingFieldPageController.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,11 @@ export class RepeatingFieldPageController extends PageController {
9797
this.tableEmptyMessageTitle = this.options.customText && this.options.customText.samePageTableItemName ? `You have not added any ${this.options.customText.samePageTableItemName}s yet` : "You have not added any costs yet";
9898
//@ts-ignore
9999
this.tableEmptyMessageHint = this.options.customText && this.options.customText.samePageTableItemName ? `Each ${this.options.customText.samePageTableItemName} you add will be shown here` : "Each cost you add will be shown here";
100-
this.saveText = "Save and add another";
101100
if (model?.def?.metadata?.isWelsh) {
102101
//@ts-ignore
103102
this.tableEmptyMessageTitle = this.options.customText && this.options.customText.samePageTableItemName ? `Nid ydych chi wedi ychwanegu unrhyw ${this.options.customText.samePageTableItemName} eto` : "Nid ydych chi wedi ychwanegu unrhyw gostau eto";
104103
//@ts-ignore
105104
this.tableEmptyMessageHint = this.options.customText && this.options.customText.samePageTableItemName ? `Bydd pob ${this.options.customText.samePageTableItemName} yr ychwanegwch yn cael ei dangos yma` : "Bydd pob cost yr ychwanegwch yn cael ei dangos yma";
106-
this.saveText = "Cadw ac ychwanegu un arall";
107105
}
108106
}
109107

@@ -246,7 +244,9 @@ export class RepeatingFieldPageController extends PageController {
246244
const currentRowCount = rows ? rows.length : 0;
247245

248246
if (maxRows && (currentRowCount >= maxRows - 1)) {
249-
this.saveText = this.model?.def?.metadata?.isWelsh ? "Cadw" : "Save";
247+
this.saveText = request.i18n.__("saveText");
248+
} else {
249+
this.saveText = request.i18n.__("saveAndAddAnotherText");
250250
}
251251
}
252252
}

0 commit comments

Comments
 (0)