From 9918fa3ec02f5e062ee85b95044c981ad7043632 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 2 Oct 2021 11:26:14 -0400 Subject: [PATCH] Move translation strings in their own array for confirm templates --- mod/photos.php | 28 +++++++++++-------- src/Module/Contact.php | 10 ++++--- view/templates/confirm.tpl | 6 ++-- view/templates/contact_drop_confirm.tpl | 14 +++++----- view/theme/frio/templates/confirm.tpl | 6 ++-- .../frio/templates/contact_drop_confirm.tpl | 18 ++++++------ 6 files changed, 44 insertions(+), 38 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index 209b9fb7be..107171f673 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1020,13 +1020,15 @@ function photos_content(App $a) $drop_url = DI::args()->getQueryString(); return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [ - '$method' => 'post', - '$message' => DI::l10n()->t('Do you really want to delete this photo album and all its photos?'), - '$confirm' => DI::l10n()->t('Delete Album'), - '$confirm_url' => $drop_url, - '$confirm_name' => 'dropalbum', + '$l10n' => [ + 'message' => DI::l10n()->t('Do you really want to delete this photo album and all its photos?'), + 'confirm' => DI::l10n()->t('Delete Album'), + 'cancel' => DI::l10n()->t('Cancel'), + ], + '$method' => 'post', + '$confirm_url' => $drop_url, + '$confirm_name' => 'dropalbum', '$confirm_value' => 'dropalbum', - '$cancel' => DI::l10n()->t('Cancel'), ]); } @@ -1127,13 +1129,15 @@ function photos_content(App $a) $drop_url = DI::args()->getQueryString(); return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [ - '$method' => 'post', - '$message' => DI::l10n()->t('Do you really want to delete this photo?'), - '$confirm' => DI::l10n()->t('Delete Photo'), - '$confirm_url' => $drop_url, - '$confirm_name' => 'delete', + '$l10n' => [ + 'message' => DI::l10n()->t('Do you really want to delete this photo?'), + 'confirm' => DI::l10n()->t('Delete Photo'), + 'cancel' => DI::l10n()->t('Cancel'), + ], + '$method' => 'post', + '$confirm_url' => $drop_url, + '$confirm_name' => 'delete', '$confirm_value' => 'delete', - '$cancel' => DI::l10n()->t('Cancel'), ]); } diff --git a/src/Module/Contact.php b/src/Module/Contact.php index bf0e3bfaf2..b671de5e19 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -432,15 +432,17 @@ class Contact extends BaseModule DI::page()['aside'] = ''; return Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_drop_confirm.tpl'), [ - '$header' => DI::l10n()->t('Drop contact'), + '$l10n' => [ + 'header' => DI::l10n()->t('Drop contact'), + 'message' => DI::l10n()->t('Do you really want to delete this contact?'), + 'confirm' => DI::l10n()->t('Yes'), + 'cancel' => DI::l10n()->t('Cancel'), + ], '$contact' => self::getContactTemplateVars($orig_record), '$method' => 'get', - '$message' => DI::l10n()->t('Do you really want to delete this contact?'), - '$confirm' => DI::l10n()->t('Yes'), '$confirm_url' => DI::args()->getCommand(), '$confirm_name' => 't', '$confirm_value' => BaseModule::getFormSecurityToken('contact_action'), - '$cancel' => DI::l10n()->t('Cancel'), ]); } // Now check how the user responded to the confirmation query diff --git a/view/templates/confirm.tpl b/view/templates/confirm.tpl index 47f231a5f9..b64cd4bd98 100644 --- a/view/templates/confirm.tpl +++ b/view/templates/confirm.tpl @@ -2,10 +2,10 @@
-

{{$message}}

+

{{$l10n.message}}

- - + +
diff --git a/view/templates/contact_drop_confirm.tpl b/view/templates/contact_drop_confirm.tpl index 48b61832d4..bb4d3a10cb 100644 --- a/view/templates/contact_drop_confirm.tpl +++ b/view/templates/contact_drop_confirm.tpl @@ -1,8 +1,8 @@ -

{{$header}}

- -{{include file="contact_template.tpl" no_contacts_checkbox=True}} - -{{include file="confirm.tpl"}} - - +

{{$l10n.header}}

+ +{{include file="contact_template.tpl" no_contacts_checkbox=True}} + +{{include file="confirm.tpl"}} + +
\ No newline at end of file diff --git a/view/theme/frio/templates/confirm.tpl b/view/theme/frio/templates/confirm.tpl index 5e173d68cd..b1fc8eb9ee 100644 --- a/view/theme/frio/templates/confirm.tpl +++ b/view/theme/frio/templates/confirm.tpl @@ -1,9 +1,9 @@
-
{{$message}}
+
{{$l10n.message}}
- - + +
diff --git a/view/theme/frio/templates/contact_drop_confirm.tpl b/view/theme/frio/templates/contact_drop_confirm.tpl index d665fefed0..a0ac15cf6d 100644 --- a/view/theme/frio/templates/contact_drop_confirm.tpl +++ b/view/theme/frio/templates/contact_drop_confirm.tpl @@ -1,9 +1,9 @@ -
-

{{$header}}

- - {{include file="contact_template.tpl" no_contacts_checkbox=True}} - - {{include file="confirm.tpl"}} - -
-
+
+

{{$l10n.header}}

+ + {{include file="contact_template.tpl" no_contacts_checkbox=True}} + + {{include file="confirm.tpl"}} + +
+