Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Problem with STRING translations in other languages - please help me!


Go to End


1191 Views

Avatar
Digital Punk

Community Member, 51 Posts

6 November 2008 at 10:03pm

I'm confused :(

I try to make strings translatable but it doesn't work for me.. Translations in CMS works, translation in template with CurrentLang works but when I put the string, from lang array comes translation only for 1 language and other labguages shows default text from string.

In config I have this:

i18n::enable(); 
i18n::set_locale('lt_LT'); 
i18n::set_default_lang('lt'); 
HTTP::set_cache_age(0);

In page:

function CurrentLang() { 
return Translatable::current_lang(); 
}

Currently in template I have this:

<% if CurrentLang = lt %>tralialia<% end_if %>

But I want to have this:

<% _t('STRING' , 'tralialia') %>

I created catalog 'lang' in 'mysite' and created files for lang array in different languages.

Where can be my mistake?