Clarify how to use anchor links with ts
Created by: demeritcowboy
Anchor links are an exception to the general rule of avoiding tags within ts.
Also a note about how sometimes it's better to leave bad uses of ts as-is depending on the situation.
@mlutfy
Merge request reports
Activity
102 102 103 An exception is `<a>` links which should be within the `ts`, but its parameters should be arguments to the ts. For example: 104 105 !!! failure "Bad" 106 107 ```smarty 108 {ts}<a href="https://www.civicrm.org" target="_blank">CiviCRM Web Site</a>{/ts} 109 ``` 110 111 !!! success "Less bad" 112 113 ```smarty 114 {ts 1='href="https://www.civicrm.org" target="_blank"'}<a %1>CiviCRM Web Site</a>{/ts} 115 ``` 116 What do you think to a "multi-ts" example here?
The scenario is this:
I have a link - I need to translate the link text with
ts
. That link has title text which I also want to pass throughts
- how can this be done "properly".I'm just thinking of what examples I've needed to lookup in the past here.
102 102 103 An exception is `<a>` links which should be within the `ts`, but its parameters should be arguments to the ts. For example: 104 105 !!! failure "Bad" 106 107 ```smarty 108 {ts}<a href="https://www.civicrm.org" target="_blank">CiviCRM Web Site</a>{/ts} 109 ``` 110 111 !!! success "Less bad" 112 113 ```smarty 114 {ts 1='href="https://www.civicrm.org" target="_blank"'}<a %1>CiviCRM Web Site</a>{/ts} 115 ``` 116 Created by: demeritcowboy
I'm not sure if it's github's display or something wonky but the updated text clarifies (or tries to clarify) that there's a difference between links in larger blocks of text vs standalone links. The former rarely have title attributes because the block of text is the text.
Created by: demeritcowboy
I'm going to separate this into 3 PR's. I'll leave this one with the original
<a>
link clarification with the suggested hyperlink wording applied. Another that's just about thetitle
attributes which was initially confusing and obviously even after some revision is still a difficult topic because it's a bit of an oddball. And then the third which is about when to consider not changing things even if it's wrong.