[development] Re: [drupal:dries] /modules contact.module
Steven Wittens
steven at acko.net
Sun Jan 15 20:17:27 UTC 2006
>So the idea is to allow for changes in mark-up via .po files?
>
>
>
Not at all. The main rule is to avoid markup in translatable strings,
unless it would split up text that needs to be together for proper
translation. Unfortunately there are some cases where people disagree.
What everyone happily agrees on is links:
bad: t("You may change permissions on the %accesscontrol page.") with
%accesscontrol => l(t('access control'), 'admin/access', ...).
good: t("You may change permissions on the <a href="%url">access
control</a> page.") with %url => url('admin/access');
The link caption is part of the sentence, so it should be translated
along with it. In some languages, the page title 'access control' would
be in a nominative, while "on the access control page" would be in a
dative (or equivalent).
The same rule applies to similar short inline elements, like <strong> or
<code>.
For block level elements where the inside is a stand-alone string, there
is also no debate:
bad: t('<h2>Some title</h2>');
good: '<h2>'. t('Some title') .'</h2>';
The help texts are a different story. An important point is whether
different paragraphs of a help text belong together in one t(...) or
not. If they do, then the '<p>' tags must be part of the translatable
string (otherwise it would contain unmatched '</p><p>' inside it). If
they don't, each paragraph can have its own '<p>'. t(...) .'</p>' call.
But unless I'm mistaken, Stefan's proposal a while ago was not just
about moving the '<p>' outside the t() but also out of hook_help() and
into the theme. This is a different issue and it was rejected because of
multi-paragraph help; it would have to contain unmatched '</p><p>' as well.
Steven Wittens
More information about the development
mailing list