Bad:
if (!module_exists('advanced_help')) {
$vars['help'] .= '<br/>' . t('Note: Installing the !adv_help module will let you access more and better help.', array('!adv_help' => l('Advanced help', 'http://drupal.org/project/advanced_help')));
}
Good:
if (!module_exists('advanced_help')) {
$vars['help'] .= '<br/>' . t('Note: Installing the <a href="!adv_help">Advanced help</a> module will let you access more and better help.', array('!adv_help' => 'http://drupal.org/project/advanced_help'));
}
Please never use the bad way... see the API docs about t().
Comments
Comment #1
hass commentedIntroduced with http://drupal.org/cvs?commit=141444
Comment #2
hass commentedPatch attached.
Comment #3
yched commentedNot in this case, since the text inside the
<a>tag is the module name ('Advanced help'), which should *not* be translated.This is how view.module does this, BTW.
Comment #4
hass commentedThis is not only for a translation of the module name, nevertheless it could be. It's also to help translators to understand the context of the missing word in the sentence. Translators are not in the module code - they are using translation server and they need to know what the word is that comes in the A tag next. In German I need to know if it's "der/die/das"... as this would show you if the word in A tag is male/female/it... other languages have other context sensitive translation issues, too. This is why we are changing all this context less strings into context sensitive ones. So, please commit :-).
Also please read http://api.drupal.org/api/function/t/6 -> jump to "Here is an example of incorrect usage of t():"
PS: Views module awaits a very big translation patch... that will also fix this bug. See #279073: Context sensitive translation issues.
Comment #5
yched commentedOK, makes sense. Committed.
Thanks !
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.