Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Multilanguage & Events

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

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

Page: 1
Go to End
Author Topic: 1908 Views
  • MDL
    Avatar
    Community Member
    1 Post

    Multilanguage & Events Link to this post

    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.

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: Multilanguage & Events Link to this post

    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

  • cerelac
    Avatar
    Community Member
    34 Posts

    Re: Multilanguage & Events Link to this post

    Hi.

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

    Best regards

  • PassePartout
    Avatar
    Community Member
    21 Posts

    Re: Multilanguage & Events Link to this post

    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

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Multilanguage & Events Link to this post

    @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...

  • cerelac
    Avatar
    Community Member
    34 Posts

    Re: Multilanguage & Events Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Multilanguage & Events Link to this post

    results in massive errors...

    dio5 whats the error?

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Multilanguage & Events Link to this post

    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.

    1908 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.