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.

Archive /

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

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

need basic multilangual content help

Go to End

4 Posts   2333 Views


Community Member, 4 Posts

27 February 2008 at 6:43am

Hi all,

This a basic question on multilangual content with SS. I have a used car website to manage. There is a list of car model with picture, description and some other infos. The translation work fine in the cms. But what if i want to translate some static field title without the cms admin. For example: The value of a Kilometer field is handle buy the cms, but i want to translate the title "Kilometer" without the cms. Sorry for my bad english and hope i made myself clear.


Community Member, 86 Posts

1 March 2008 at 2:06am

Edited: 01/03/2008 2:08am

This is what I do:

	 * Returns the current language
	 * Should either be the string 'en' or 'es'
	function CurrentLang() {
		return Translatable::current_lang();

That will return the current two-letter language code (en, es, fr, jp, de etc).

You can also just call current_lang in the templates, but that's a little slower.

So you would use it like this in the templates: <% if CurrentLang = en %>something<% end_if %>

Also, if you want it to be in multiple languages, this might be better:

<% _t(STRING, Some string here) %>

Then you can define "STRING" in the $lang arrays inside the lang/ directory of your project, just like the _t() calls all throughout the rest of sapphire. Take a look at some of the templates in sapphire/templates to see how that's done.

Hope that helps!

Digital Punk

Community Member, 51 Posts

30 October 2008 at 8:23am

Edited: 30/10/2008 8:24am

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:


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?


Forum Moderator, 801 Posts

10 November 2008 at 3:53am

So, the <% _t() %> call is not resolved by the template parser? Or does it show the default language string instead of the translation?
Did you use the textcollector to create your /lang files? Not 100% necessary, but can help to avoid mistakes. See