artvdputte asked a question still unanswered after 7 months, probably because he posted it in the wrong forum, so would you allow me to post it here:

I have a string inside the t() function inside my page.tpl.php template:

print t('test string');

The string is displayed perfectly when I visit a page.
Now I'ld like to translate this string now using the "translate interface" page, but the string is not showing up there?

What am I doing wrong?
I'm using drupal 7.12 and following "multilingual" modules are enabled:

Content translation
Locale
ALL modules from multilingual-internationalization except contact translation and multilingual forum.

Thanks for your help.

I have the same problem with Drupal 7.17 and the contributed Internationalization 7.x-1.7 module. Is it even possible to use t() in template files? If yes, how?

Comments

Jaypan’s picture

Not only is it possible, you are supposed to use text when outputting it in template files. So you are doing it right. That leads to the question as to why you are not seeing the strings in the translate interface. One possibility is that the string in question has not been outputted yet. Until a string is outputted (meaning it's been run through the t() function), it will not appear in the translate interface page. Have you visited the page (template) in question and viewed the text in English before visiting the translate interface page?

Fiable.biz’s picture

Thank you very much. It works. In fact, I had forgotten to write "print".
It didn't work immediately. I cleared the caches.
I had never thought it would have been so easy.

http://Fiable.biz Web site creation.

lucascaro’s picture

Note that you need to visit the page *when in a non-default language*. See http://drupal.org/node/1496740

shantanu1’s picture

Hi All,
First: Change your language from the language switcher block (In user-end).
Second: After that you check yoursite.com/admin/config/regional/translate/translate

Thanks

Shantanu Karmakar
Mail: shantanu2683@gmail.com

arnoldbird’s picture

Before the language switcher block will appear, you have to enable some detection methods. So...

1) Enable one or more detection methods at admin/config/regional/language/configure
2) Add the language switcher block to one of your pages and change your default language.
3) You should now see your strings at admin/config/regional/translate/translate

arnoldbird’s picture

Actually, you do not need to add the language switcher block. This also works...

  1. Enable one or more detection methods at admin/config/regional/language/configure
  2. Add a second language at admin/config/regional/language
  3. Visit a page that has a UI string you want to translate. Add the language code string to the URL to visit the translated version of that page. For example, if your page is at /my-page, then the spanish version would be at /es/my-page
  4. You should now see your UI string(s) at admin/config/regional/translate/translate
sandro2567’s picture

well, it is not solved, I discovered that sometimes it happen that the variable will not appear on translation interface.

to solver this you have to chnage the language on your frontend page and after that it will appear on "translation interface"