From ec2b84a12f0495fc061b0e464a4df6661675c0fa Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 8 Apr 2015 17:29:53 -0400 Subject: [PATCH] CRM-16260 - Fix use of ts() within templates --- templates/CRM/Admin/Page/Tag.tpl | 2 +- .../Event/Form/ManageEvent/Registration.tpl | 5 ++-- templates/CRM/Member/Form/Membership.tpl | 25 +++++++++++-------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/templates/CRM/Admin/Page/Tag.tpl b/templates/CRM/Admin/Page/Tag.tpl index d4f3834bb5..8d5dc9b1f8 100644 --- a/templates/CRM/Admin/Page/Tag.tpl +++ b/templates/CRM/Admin/Page/Tag.tpl @@ -144,7 +144,7 @@ CRM.$(function($) { .on('crmConfirm:yes', function() { var toId = $("input[name=select_merge_tag]", this).val(); if (!toId) { - $("input[name=select_merge_tag]", this).crmError(ts('Select a tag')); + $("input[name=select_merge_tag]", this).crmError('{/literal}{ts escape='js'}Select a tag{/ts}{literal}'); return false; } var postUrl = {/literal}"{crmURL p='civicrm/ajax/mergeTags' h=0 }"{literal}; diff --git a/templates/CRM/Event/Form/ManageEvent/Registration.tpl b/templates/CRM/Event/Form/ManageEvent/Registration.tpl index 01a1e92a99..3e94946cff 100644 --- a/templates/CRM/Event/Form/ManageEvent/Registration.tpl +++ b/templates/CRM/Event/Form/ManageEvent/Registration.tpl @@ -451,8 +451,9 @@ invert = 0 $(e.target).closest('tbody').find('tr:visible:last .profile_bottom_link_main,tr:visible:last .profile_bottom_add_link, tr:visible:last .profile_bottom_link, tr:visible:last .profile_bottom_add_link_main').show(); } - var strSameAs = ' - '+ts('same as for main contact')+' - '; - var strSelect = ' - '+ts('select')+' - '; + var + strSameAs = '{/literal}{ts escape='js'}- same as for main contact -{/ts}{literal}', + strSelect = '{/literal}{ts escape='js'}- select -{/ts}{literal}'; $('#crm-container').on('crmLoad', function() { var $container = $("[id^='additional_profile_'],.additional_profile").not('.processed').addClass('processed'); diff --git a/templates/CRM/Member/Form/Membership.tpl b/templates/CRM/Member/Form/Membership.tpl index db37b4786b..37df7b3056 100644 --- a/templates/CRM/Member/Form/Membership.tpl +++ b/templates/CRM/Member/Form/Membership.tpl @@ -568,18 +568,19 @@ endDate = memberorgs[selectedorg].membership_end_date, org = $('option:selected', "select[name='membership_type_id[0]']").text(); if (endDate) { - andEndDate = ' ' + ts("and end date of %1", {1:endDate}); + andEndDate = '{/literal}{ts escape='js' 1='%1'}and end date of %1{/ts}{literal}'; + andEndDate = ' ' + ts(andEndDate, {1:endDate}); } alert = CRM.alert( // Mixing client-side variables with a translated string in smarty is awkward! ts({/literal}'{ts escape='js' 1='%1' 2='%2' 3='%3' 4='%4'}This contact has an existing %1 membership at %2 with %3 status%4.{/ts}'{literal}, {1:memberorgs[selectedorg].membership_type, 2: org, 3: memberorgs[selectedorg].membership_status, 4: andEndDate}) + '', - ts('Duplicate Membership?'), 'alert'); + '{/literal}{ts escape='js'}Duplicate Membership?{/ts}{literal}', 'alert'); } } checkExistingMemOrg(); @@ -756,16 +757,18 @@ if (cid) { CRM.api('relationship', 'getcount', {contact_id: cid, membership_type_id: memType}, { success: function(result) { - var relatable = ' ' + result.result + ts(' contacts are '); - if(result.result === 0) { - relatable = ts(' No contacts are '); + var relatable; + if (result.result === 0) { + relatable = '{/literal}{ts escape='js'}No contacts are currently eligible to inherit this relationship.{/ts}{literal}'; } - if(result.result === 1) { - relatable = ts(' One contact is '); + else if (result.result === 1) { + relatable = '{/literal}{ts escape='js'}One contact is currently eligible to inherit this relationship.{/ts}{literal}'; } - - var others = relatable + ts('currently eligible to inherit this relationship.'); - cj('#max_related').siblings('.description').append(others); + else { + relatable = '{/literal}{ts escape='js' 1='%1'}%1 contacts are currently eligible to inherit this relationship.{/ts}{literal}'; + relatable = ts(relatable, {1: result}); + } + cj('#max_related').siblings('.description').append(' ' + relatable); } }); } -- 2.25.1