Closed (fixed)
Project:
Visual Website Optimizer
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Oct 2011 at 02:25 UTC
Updated:
9 Oct 2011 at 21:30 UTC
t() should only contain text, no markup, to keep translations clear and useful. I'm going to post a couple examples here of better ways to handle markup with t(). These don't cover every instance of t() and markup in the module, so please check them all.
'description' => $t('VWO module is configured to be Disabled. To Enable visit <a href="@url">the settings page</a>.',
array('@url' => url('admin/settings/visual_website_optimizer'))),Rather than include the URL, this should include the full link, i.e.:
'description' => $t('VWO module is configured to be Disabled. To Enable visit !settings.',
array('!settings' => l(t('the settings page'), 'admin/settings/visual_website_optimizer'))),Another:
t('<p>In order to use the plugin, you need a !url account. A Free 30 day trial account is available.</p>'
Should be:
'<p>' . t('In order to use the plugin, you need a !url account. A Free 30 day trial account is available.') . '</p>'
Comments
Comment #1
elc commentedI based my @ style URLs off the t() API function page, and it is almost verbatim of the Here is an example of t() used correctly section. ie.
If I used the ! method, I get Coder warnings but if I follow the manual page, it's all happy.
It seems I have both methods in there, and I'll swap them over if necessary, but it really does seem kind of strange to be coding away from the standard set on the manual page.
I have fixed all the instances of t() to not include the <p> in the text, but otherwise match the manual page for URLs. If this is the wrong way to go about it, I'll swap them all to the ! method.
Comment #2
sreynen commentedHuh, looks like I've been doing it wrong. Thanks for pointing that out.
Comment #3
elc commentedI've run into that a few times when doing code reviews :P Looking at everyone else's projects gave me lots of pointers on what I needed to fix in mine.
Thanks for taking the time to look at my project!