Hi,
I did an Italian language website, I need now to provide it a multi language system, the only issue is that I need to change something in the main page.tpl.php for both languages.
I see there're many translation modules but I need something able to change my page.tpl.php from the regular one to the english one (eg: page-it.tpl.php and page-en.tpl.php) as well other than regular text.
Something like "localizing a template"
Do you have any tips about it?
Drupal version is 5.x
thanks
Hi Francesco,
I did an Italian language website, I need now to provide it a multi language system, the only issue is that I need to change something in the main page.tpl.php for both languages.
The keywords you want are "locale" or "localization" (abbreviated sometimes to "l10n"). This is the process of making a website's content "local" for a particular site visitor.
First turn on the Locale module. Then, if your text is hardcoded, wrap it in the t() PHP function as follows:
<p>My text</p> ... becomes ... <p><?php print t('My text') ?></p>
Then, visit the page (so that t() calls locale() and registers that there is some text to translate). You should see no difference right now.
If you now go to admin/settings/locale you should see that you can define different languages, including a default one which in your case will be Italian. Any string that passes through the t() function is then able to be translated into other non-default languages.
Further docs:
Locale module and localization: http://drupal.org/node/290 (note all the links at the bottom) t() function (technical): http://api.drupal.org/api/function/t/5 Locale module (technical): http://api.drupal.org/api/file/modules/locale/locale.module/5
Cheers, J-P
First turn on the Locale module. Then, if your text is hardcoded, wrap it in the t() PHP function as follows
Another important thing Francesco - make sure you write the strings with the t() around them in English and then translate them as described by JP into Italian. It doesn't work the other way around - source strings have to be in English.
Not sure if you still will need to have different template files once you know how to do this. But if you are in need of further customisation, it's probably better to just stick with one template file but use the functions available to check the current page language and then do an if/then statement. I think page.tpl.php is automatically given a variable called $language which tells you the current language being used.
Regards John Salt Websites internationalised web development http://www.saltwebsites.com/