Jump to content

Recommended Posts

Posted

I'm facing a strange behavior in my website. When switch from default language (it) to english, only the fields are displayed correctly in english, not the texts in my template files. I have severals files loaded in the translation admin, all translated, but the text remains in it. Where i'm wrong?

Posted

Could you be so kind to show us what code you are using? Are the translation files available in your language?

  • Like 1
Posted

For switch language i use this code

<?php
$user->language = $languages->get("default");
list($languageName) = explode('.', $config->httpHost); 
$languageName = $sanitizer->pageName($languageName);
switch($languageName){
    case 'en':
        $user->language = $languages->get("en"); 
        setlocale(LC_ALL,'en_EN');
    break;
    default:
        $user->language = $languages->get("default"); 
        setlocale(LC_ALL,'it_IT');
}
 


inside my template, for example home.inc i simply echo this

<?php
$l_search = $this->_("Search");
?>
<div><?=$l_search?></div>
Posted

Apeisa, it works! But why? I mean, using $this should work also...before making a massive find/replace is there a way to make it works with $this?

$this->_() does only work in modules (inside classes).

In templates (site/templates) you must use __('string');

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...