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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Multilingual Content - alternative to 'translatable'


Go to End


44 Posts   16906 Views

Avatar
schellmax

Community Member, 126 Posts

5 February 2009 at 6:51am

hi
i just set up a recipe in the docs on how to achieve multlingual sites which don't rely on silverstripe's 'translatable' implementation, which poses a number of problems (buggy cms UI, non-cacheable urls...). this might be a temporary solution as things are announced to be changed in version 2.4.

see http://doc.silverstripe.com/doku.php?id=recipes:multilingual_content

i hope it's useful as an alternative approach to translatable content for smaller sites.

do you know other solutions as well? found a mistake in my script? know how to do it better?
any comments are welcome

Avatar
Apophenian

Community Member, 46 Posts

10 February 2009 at 7:26pm

This works great for what I need - thanks!

Have you tested it in 2.3?

Cheers,

Rane

Avatar
schellmax

Community Member, 126 Posts

11 February 2009 at 2:18am

haven't tested in 2.3 (still waiting for the final release...) but from what i can see it shouldn't cause any problems. maybe someone else can confirm it's working there?

Avatar
danbalbo

Community Member, 6 Posts

28 February 2009 at 6:01am

Hello,
i am using ss 2.3 and ur nice solution for multilanguage web sites. Everything works fine except for home. Request to /en/home/ or /en/ always redirects to /home and shows the default texts instead of english version. Some help to solve the problem is appreciated.

Avatar
schellmax

Community Member, 126 Posts

28 February 2009 at 7:20am

Edited: 28/02/2009 7:20am

just had a glance at the controller class, seems like things have heavily changed there from 2.2 to 2.3, so my current workaround for this problem (setting urlParams['action'] to an empty string) doesn't work any more.
unfortunaltey i'm running short of time at the moment, maybe you want to give it a try (check the new controller class in sapphire), for me it will take some days until i got time to have a look at this

Avatar
Iain_vdw

Community Member, 22 Posts

3 March 2009 at 5:52am

Edited: 03/03/2009 5:57am

Hi there, i'm currently implementing this workaround to avoid the messy CMS UI crap. Problem is, translations are already entered for some pages. Is there any way to modify this workaround to load the translated text into the newly created fields under the "English" tab?

I've tried this with no success:
$fields->addFieldToTab('Root.Content.English', new TextField('SiteTree_lang.MENUTITLE', 'Navigation Label'));
$fields->addFieldToTab('Root.Content.English', new HtmlEditorField('SiteTree_lang.CONTENT', 'Content'));

What i want is to load the english content from the database, and exactly those two fields into the CMS fields so i don't have to copy and paste the english content all over again.

Avatar
schellmax

Community Member, 126 Posts

5 March 2009 at 6:42am

sorry for the delay

@ danbalbo: i've spent some time on the problem now, but it seems i'm not clever enough to understand what's going on there. problem is in sapphire\core\control\contentcontroller.php, line 93 ('Director::redirect...', redirecting '/home/' to '/'). commenting out this line will do the trick for now, but i'd really appreciate another solution without touching the core. maybe someone else can help here.

@ flowzor: don't know how to do this in silverstripe, but you might run a sql query copying the fields?

Avatar
kneedle

Community Member, 1 Post

14 March 2009 at 3:27am

Hello.

Nice tutorial, evrything works fine except...

...except searching. Please can somebody tell me how to make silverstripe to search in the "translation tables" when not in default language?

Thanks

Go to Top