[development] Re: [drupal:dries] /modules contact.module

Karthik narakasura at gmail.com
Mon Jan 16 09:50:23 UTC 2006


Steven,

  This is very useful :) I see what you mean about inline tags - so
for e.g. (probably a poor one at that):

Nominative:
  t('I am of the <em>opinion</em> that..');

Dative:
  t('<em>Methinks</em> that ..');

So, using tags outside the t() here would break the translation or
make it kludgy. Is that right?

And the use of the <p> tags are a lot more subjective, with some
passages better off with the <p> tags embedded, thereby providing a
little flexibility to the translator?

Please confirm when you can. And thanks for taking the time to write this up :)
Cheers,
-K

> 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