passing strings through drupal t() function from php snippet

Events happening in the community are now at Drupal community events on www.drupal.org.
texas-bronius's picture

I am trying to use the Drupal t() function to translate some strings provided in the view's header as php like this:

  <h3 class="title"><?php print t('Choose a Country'); ?></h3>
  ...

And yet, when I switch languages, this string is always in English. Any ideas why and whether there's a more proper way to implement this?

-Bronius

Comments

Language sections

truyenle's picture

Have you try with this module Bronius http://drupal.org/project/language_sections

Truyen

Just closing the gap here

texas-bronius's picture

Truyen reports good success with the linked module. Also, fwiw, the t() does do all-or-nothing on the string passed in.

it's not entirely true that t() is all or nothing

Silicon.Valet's picture

There's all manner of hackery available to you. http://drupalcontrib.org/api/function/t/6

There must exist a translation somewhere for that string recipe however. It doesn't do a google translate if that's what you meant. It tries to translate via lookup, and fails over to original text.