0

I am extremely tired right now and don't have time to read through verbose drupal 7 documentation. Can someone just show me a quick Hello World example that will do the following in drupal 7?

I have a template file /sites/all/themes/mytheme/page.tpl.php and in it I have

<?php echo "Hello World"; ?>

When a person comes to the page in English, it should show "Hello world". When the person comes to the page in French, it should show "Bonjour tout le monde". How do I augment the command echo "Hello World" to do such a thing? If language files are needed, show me how to structure them.

Thanks

4

Instead of "Hello World", use t("Hello World").

Using the Localization client module, you can add the translation of that string in any language you want.

This module helps you fix translations on your site as you see the issues. Just by navigating around your pages, you'll be able to fix translations and fill in missing ones using the on-page translation editor. At the same time, if configured properly, the module also submits your translations back to the community, to localize.drupal.org or any other localization server.

  • You don't need a third party module to change localised string. Drupal core has this built-in: you can either change a few strings in settings.php or enable the core translate-interface module. – berkes Aug 31 '11 at 8:48
  • I see that I already have the t() function available..but where do i find the data file that houses all my translations? LIke some kind of xml dictionary look up for each language equivalent word or something? – John Sep 8 '11 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.