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.

Data Model Questions /

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

$lang variable?


Go to End


6 Posts   2734 Views

Avatar
Tempesta

Community Member, 8 Posts

26 February 2009 at 12:58am

Hey everybody, this is my first post here! I'm building a site with three languages, and I'm having a flash presentation in there too. But since this one is getting the data from a .xml file, it doesnt know what language the site is in. Is there a variable I can send to it to let it know, like a $lang variable or something?

Thanks :)

Avatar
Ingo

Forum Moderator, 801 Posts

26 February 2009 at 7:32pm

How is your XML generated, and with which data? You could attach a ?lang GET parameter and evaluate that whereever the XML is generated in your controller?

Avatar
Tempesta

Community Member, 8 Posts

27 February 2009 at 1:32am

Thanks Ingo, for your reply! :)

I'm sorry, I wasnt clear, this XML is made outside of silverstripe manually, so never mind that part.
What I do is I send some information from silverstripe to flash via Javascript.

I can send $MenuTitle forexample, but I don't know how to get the language, I was hoping there was a $Lang variable or something but there wasn't..

So what do I need to do here guys? :)

Avatar
Ingo

Forum Moderator, 801 Posts

27 February 2009 at 8:14am

You're right, in 2.2.x there's no way to find out the language for an existing DataObject instance, apart from inspecting Translatable::current_lang(). This will change in one of the next minor releases, where an overhaul of the Translatable datamodel is planned. Every object has an explicit $Lang property in the new implementation.

Avatar
Tempesta

Community Member, 8 Posts

28 February 2009 at 2:11am

So how would I go about with the "Translatable::current_lang()", is there a tutorial or something on it?

Avatar
Tempesta

Community Member, 8 Posts

6 March 2009 at 12:51am

Is there a function I can build in page.php file, so that I can do a <%control%> thing or something, this is kind of important! If anyone can give me a quick overview of what needs to be done, that would be great. The site I am working on has quite a lot of custom templates and stuff, so I would like to postpone the upgrade for now. I'm running 2.2.3.

I tried a workaround and built different templates for the different languages but then i got the " Fatal error: Call to a member function getAllFields() on a non-object in /usr/data/www/adell.adgrp.net/sapphire/core/model/Translatable.php on line 588 " error, which is also a hazzle to fix.

Kind of stuck here.

Thanks, Marius