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, biapar, Willr, Ingo, simon_w

Multilanguage & Events


Reply


8 Posts   1928 Views

Avatar
MDL

Community Member, 1 Post

30 June 2008 at 5:04am

Ehy!
I've just discovered that amazinc cms! I love how to easy build different templates for different pages exactly like i want!
I have a project and i would really use SilverStripe for it but i really need the site to be multilanguage (i mean the content) and i need an event calendar with categories.
I'm a designer and not a programmer so i can't do it on myself.
I've read that the multilanguage should be there but i can't make it work and i've seen a module calendar but it's not complete.
There's a way to do it or i should still use other cms and spend a lot of time trying to make themes for them?

Thank you in advance.

Avatar
Double-A-Ron

Community Member, 604 Posts

1 July 2008 at 11:38am

The events module: You have already found the incomplete calendar module. AFAIK that's all that is available at present out of the box.

To do what you are after in SS, you would need to create the module yourself or pay a programmer to do so for you.

Cheers
Aaron

Avatar
cerelac

Community Member, 34 Posts

2 July 2008 at 9:19pm

Hi.

MDL, you have in download section a languagechooser widget, i've implemented it in my project and it works.

Best regards

Avatar
PassePartout

Community Member, 21 Posts

3 July 2008 at 1:21am

Edited: 03/07/2008 1:22am

let us know how that events calendar is going, I have to do basically the same thing but might ignore the showing it on the calendar since it might be too much trouble

Avatar
dio5

Community Member, 501 Posts

3 July 2008 at 4:09am

Edited: 03/07/2008 4:22am

@Cerelac: re the languages, how did you translate custom fields of subclasses of Page/SiteTree then?

I tried with adding

static $extensions = array(
         "Translatable('MyField')",
      );

in the SubClassOfPage.php

but this resulted in huge errors in the cms.

The docs say:

"If you want to translate custom columns in your SiteTree-subclasses, you have to explicitly enable them for translation. "

How?

Even having dataobjects - through a complextablefield - and without having the translation for them enabled - results in massive errors.

I wonder how someone is even able to use i18n at all...

Avatar
cerelac

Community Member, 34 Posts

3 July 2008 at 9:27pm

Edited: 03/07/2008 9:31pm

dio5, I've only downloaded the language chooser widget and then I've only made a /db/build.

I have this code in my "languagechooser.php" (this file is part of languagechooser widget):

class LanguageChooser extends Widget {
static $title = "Language Chooser";
static $cmsTitle = "Language Chooser";
static $description = "Allows you to choose your language";

static $db = array("ShowCurrent" => "Boolean");
static $defaults = array('ShowCurrent' => false);

function getCMSFields(){
return new FieldSet(new CheckboxField('ShowCurrent', _t('LanguageChooser.SHOWCURRENT', 'Show current language')));
}

function Chooser() {
      if(!isset(Controller::currentController()->ID)) {
         return; // So it doesn't break on Controller-less pages
      }
$langs = i18n::get_existing_content_languages();
$data = new DataObjectSet();
foreach(array_keys($langs) as $code) {
if($code == Translatable::current_lang() && !$this->ShowCurrent) {
continue;
}
$page = Translatable::get_one_by_lang("SiteTree", $code, "`SiteTree`.ID = " . Controller::currentController()->ID);
if(!$page) {
$data->push(new ArrayData(array('name' => i18n::get_language_name($code, true), 'link' => Director::protocolAndHost() . Director::baseURL() . '?lang=' . $code)));
} else {
$data->push(new ArrayData(array('name' => i18n::get_language_name($code, true), 'link' => Director::protocolAndHost() . Director::baseURL() . $page->URLSegment . '?lang=' . $code)));
}
}
return $data;
}

function WidgetHolder() {
if(count(i18n::get_existing_content_languages()) > 1) {
return $this->renderWith("WidgetHolder");
}
return "";
}
}

I hope this code help you.

I'm not sure if this is what you want, but it's what I'm using.

Best Regards

Avatar
Willr

Forum Moderator, 5513 Posts

3 July 2008 at 10:06pm

results in massive errors...

dio5 whats the error?

Avatar
Ingo

Forum Moderator, 801 Posts

3 July 2008 at 11:19pm

all i18n and Translatable code is in dire need for unit testing. it was a (pretty heroic) one-person effort during GSOC, but still needs a lot of work. as mentioned on the mailinglist (and some i18n tickets), we're really hoping for the community to get involved with this one.
i understand that this is a itchy point for pretty much everybody outside of english speaking countries, but you have to understand that i18n seldomly comes up with Silverstripe client work, so is naturally not right up the priority list.