Skip to content

Commit

Permalink
Add renewal feedback texts
Browse files Browse the repository at this point in the history
It is a mess what belongs where with all the text props.
This is an attempt to make sure that all the renewal response texts are
being available for the corresponding apps.
  • Loading branch information
spaceo committed Oct 11, 2023
1 parent d0e099f commit 01a250f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function build(): array {
'accept-modal-cancel-button-text' => $this->t("Cancel renewal", [], ['context' => 'Dashboard']),
'accept-modal-aria-description-text' => $this->t("accept modal aria description text", [], ['context' => 'Dashboard (Aria)']),
'accept-modal-aria-label-text' => $this->t("accept modal aria label text", [], ['context' => 'Dashboard (Aria)']),
] + DplReactAppsController::externalApiBaseUrls();
] + dpl_react_apps_texts_renewal() + DplReactAppsController::externalApiBaseUrls();

return [
'#theme' => 'dpl_react_app',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function build() {
'accept-modal-cancel-button-text' => $this->t("Cancel renewal", [], ['context' => 'Loan list']),
'accept-modal-aria-description-text' => $this->t("accept modal aria description text", [], ['context' => 'Loan list (Aria)']),
'accept-modal-aria-label-text' => $this->t("accept modal aria label text", [], ['context' => 'Loan list (Aria)']),
] + DplReactAppsController::externalApiBaseUrls() + DplReactAppsController::getBlockedSettings();
] + dpl_react_apps_texts_renewal() + DplReactAppsController::externalApiBaseUrls() + DplReactAppsController::getBlockedSettings();

return [
'#theme' => 'dpl_react_app',
Expand Down
30 changes: 30 additions & 0 deletions web/modules/custom/dpl_react_apps/dpl_react_apps.module
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,33 @@ function dpl_react_apps_preprocess_dpl_react_app(array &$variables): void {
'data-alert-error-message-text' => t('An error occurred', [], ['context' => 'React apps (Global error handling)']),
];
}

/**
* Renew texts for multiple apps.
*
* @return mixed[]
* Texts props.
*/
function dpl_react_apps_texts_renewal(): array {
// These texts are shared between multiple apps.
// Instead of defing them in each app we define them here.
return [
'renew-button-text' => t('Renew', [], ['context' => 'Renew loan']),
'renew-cannot-be-renewed-text' => t('Cannot be renewed', [], ['context' => 'Renew loan']),
'renew-group-modal-loans-button-text' => t('Ok', [], ['context' => 'Renew loan (group modal)']),
'renew-group-modal-loans-error-status-text' => t('Something went wrong renewing your loans. Please try again.', [], ['context' => 'Renew loan (group modal)']),
'renew-group-modal-loans-error-title-text' => t('Renewing your loans failed', [], ['context' => 'Renew loan (group modal)']),
'renew-group-modal-loans-no-renewals-possible-error-status-text' => t('For some reason, no one of your loans could be renewed.', [], ['context' => 'Renew loan (group modal)']),
'renew-group-modal-loans-no-renewals-possible-error-title-text' => t('No loans could be renewed', [], ['context' => 'Renew loan (group modal)']),
'renew-group-modal-loans-success-status-text' => t('{"type":"plural","text":["1 loan has been renewed.","@count loans have been renewed."]}', [], ['context' => 'Renew loan (group modal)']),
'renew-group-modal-loans-success-title-text' => t('You have renewed your loans', [], ['context' => 'Renew loan (group modal)']),
'renew-material-loan-button-text' => t('Ok', [], ['context' => 'Renew loan (material)']),
'renew-material-loan-error-status-text' => t('omething went wrong renewing your loan. Please try again.', [], ['context' => 'Renew loan (material)']),
'renew-material-loan-error-title-text' => t('Renewal of your loan failed', [], ['context' => 'Renew loan (material)']),
'renew-material-loan-no-renewals-possible-error-status-text' => t('For some reason, your loan could not be renewed.', [], ['context' => 'Renew loan (material)']),
'renew-material-loan-no-renewals-possible-error-title-text' => t('The loan could not be renewed', [], ['context' => 'Renew loan (material)']),
'renew-material-loan-success-status-text' => t('1 loan was renewed.', [], ['context' => 'Renew loan (material)']),
'renew-material-loan-success-title-text' => t('You have renewed your loan', [], ['context' => 'Renew loan (material)']),
'renew-processing-text' => t('Processing...', [], ['context' => 'Renew loan']),
];
}

0 comments on commit 01a250f

Please sign in to comment.