Jump to content

translations not displayed


Frank Vèssia
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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>
Link to comment
Share on other sites

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');

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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