Move translation strings in their own array for confirm templates

This commit is contained in:
Hypolite Petovan 2021-10-02 11:26:14 -04:00
parent e6aef548fb
commit 9918fa3ec0
6 changed files with 44 additions and 38 deletions

View file

@ -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'),
]);
}

View file

@ -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

View file

@ -2,10 +2,10 @@
<center>
<form action="{{$confirm_url}}" id="confirm-form" method="{{$method}}">
<h3 id="confirm-message">{{$message}}</h3>
<h3 id="confirm-message">{{$l10n.message}}</h3>
<button class="confirm-button" id="confirm-submit-button" type="submit" name="{{$confirm_name}}" value="{{$confirm_value}}">{{$confirm}}</button>
<button class="confirm-button" id="confirm-cancel-button" type="submit" name="canceled" value="{{$cancel}}">{{$cancel}}</button>
<button class="confirm-button" id="confirm-submit-button" type="submit" name="{{$confirm_name}}" value="{{$confirm_value}}">{{$l10n.confirm}}</button>
<button class="confirm-button" id="confirm-cancel-button" type="submit" name="canceled" value="{{$l10n.cancel}}">{{$l10n.cancel}}</button>
</form>
</center>

View file

@ -1,4 +1,4 @@
<h1>{{$header}}</h1>
<h1>{{$l10n.header}}</h1>
{{include file="contact_template.tpl" no_contacts_checkbox=True}}

View file

@ -1,9 +1,9 @@
<form action="{{$confirm_url}}" id="confirm-form" method="{{$method}}" class="generic-page-wrapper">
<div id="confirm-message">{{$message}}</div>
<div id="confirm-message">{{$l10n.message}}</div>
<div class="form-group pull-right settings-submit-wrapper">
<button type="submit" name="{{$confirm_name}}" id="confirm-submit-button" class="btn btn-primary confirm-button" value="{{$confirm_value}}">{{$confirm}}</button>
<button type="submit" name="canceled" value="{{$cancel}} id="confirm-cancel-button" class="btn confirm-button" data-dismiss="modal">{{$cancel}}</button>
<button type="submit" name="{{$confirm_name}}" id="confirm-submit-button" class="btn btn-primary confirm-button" value="{{$confirm_value}}">{{$l10n.confirm}}</button>
<button type="submit" name="canceled" value="{{$l10n.cancel}}" id="confirm-cancel-button" class="btn confirm-button" data-dismiss="modal">{{$l10n.cancel}}</button>
</div>
</form>

View file

@ -1,5 +1,5 @@
<div id="contact-drop-confirm">
<h2 class="heading">{{$header}}</h2>
<h2 class="heading">{{$l10n.header}}</h2>
{{include file="contact_template.tpl" no_contacts_checkbox=True}}