Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve formatting for recurring contributions in user dashboard #25058

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions templates/CRM/Contribute/Page/UserDashboard.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<div><label>{ts}Recurring Contribution(s){/ts}</label></div>
<table class="selector">
<tr class="columnheader">
<th>{ts}Terms:{/ts}</th>
<th>{ts}Terms{/ts}</th>
<th>{ts}Status{/ts}</th>
<th>{ts}Installments{/ts}</th>
<th>{ts}Created{/ts}</th>
Expand All @@ -129,13 +129,18 @@
{foreach from=$recurRows item=row key=id}
<tr class="{cycle values="odd-row,even-row"}">
<td><label>{$recurRows.$id.amount|crmMoney}</label>
every {$recurRows.$id.frequency_interval} {$recurRows.$id.frequency_unit}
for {$recurRows.$id.installments} installments
{ts 1=$recurRows.$id.frequency_interval 2=$recurRows.$id.frequency_unit} every %1 %2{/ts}
{if !empty($recurRows.$id.installments)}
{ts 1=$recurRows.$id.installments} for %1 installments{/ts}
{/if}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice on the rebase.

Just noticing the {ts} - there's been a trend to replace these with something more translation-friendly even though it means more code. When broken up like this and without much context and where part of it is a translatable option value with plurals (e.g. every %1 %2) it's harder to translate. Here's an example:

{if $installments}
{if $frequency_interval > 1}
<p>
<strong>{ts 1=$frequency_interval 2=$frequency_unit 3=$installments}I want to contribute this amount every %1 %2s for %3 installments.{/ts}</strong>
</p>
{else}
<p>
<strong>{ts 1=$frequency_unit 2=$installments}I want to contribute this amount every %1 for %2 installments.{/ts}</strong>
</p>
{/if}
{else}
{if $frequency_interval > 1}
{if $frequency_unit eq 'day'}
<p><strong>{ts 1=$frequency_interval}I want to contribute this amount every %1 days.{/ts}</strong></p>
{elseif $frequency_unit eq 'week'}
<p><strong>{ts 1=$frequency_interval}I want to contribute this amount every %1 weeks.{/ts}</strong></p>
{elseif $frequency_unit eq 'month'}
<p><strong>{ts 1=$frequency_interval}I want to contribute this amount every %1 months.{/ts}</strong></p>
{elseif $frequency_unit eq 'year'}
<p><strong>{ts 1=$frequency_interval}I want to contribute this amount every %1 years.{/ts}</strong></p>
{/if}
{else}
{if $frequency_unit eq 'day'}
<p><strong>{ts}I want to contribute this amount every day.{/ts}</strong></p>
{elseif $frequency_unit eq 'week'}
<p><strong>{ts}I want to contribute this amount every week.{/ts}</strong></p>
{elseif $frequency_unit eq 'month'}
<p><strong>{ts}I want to contribute this amount every month.{/ts}</strong></p>
{elseif $frequency_unit eq 'year'}
<p><strong>{ts}I want to contribute this amount every year.{/ts}</strong></p>
{/if}
{/if}

</td>
<td>{$recurRows.$id.recur_status}</td>
<td>{if $recurRows.$id.completed}<a href="{$recurRows.$id.link}">{$recurRows.$id.completed}
/{$recurRows.$id.installments}</a>
{else}0/{$recurRows.$id.installments} {/if}</td>
{if !empty($recurRows.$id.installments)}/{$recurRows.$id.installments}{/if}</a>
{else}0
{if !empty($recurRows.$id.installments)}/{$recurRows.$id.installments}{/if}
{/if}
</td>
<td>{$recurRows.$id.create_date|crmDate}</td>
<td>{$recurRows.$id.action|replace:'xx':$recurRows.id}</td>
</tr>
Expand Down