Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » i18n and fallback language

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

Page: 1
Go to End
Author Topic: 1540 Views
  • carlgmathisen
    Avatar
    Community Member
    4 Posts

    i18n and fallback language Link to this post

    Hi guys,

    I've set up Internationalization on my SilverStripe installation with:

    i18n::enable();
    i18n::set_default_lang('en');

    ... and it works like a charm. My question is, is it possible to have a fallback language?

    1. Let's say my main menu looks something like this in English:

    |- Home
    |- About Us
    |- Contact

    2. I translate the Contact page to the norwegian title "Kontakt"

    My main menu, when setting locale to Norwegian on the site, will currently look like this:

    |- Kontakt

    As a result, the english articles are hidden, as the site (naturally) only shows the translated pages to the current locale.

    Is it possible to specify a fallback language, that my menu may look like this?

    |- Home
    |- About Us
    |- Kontakt

    Thanks guys

    Carl

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: i18n and fallback language Link to this post

    You're using our daily builds/trunk, right?

    Hm, currently not possible, but would make sense. We have a similiar module (subsites) which can link pages between different "subsites", which is essentially the same as different translations of the same page. Technically, it will be challenging to get these fallbacks working without having them explicitly created.

    So, couple of options worth investigating:
    - globally enable fallbacks automatically through a code-preference (selecting both translated and untranslated pages)
    - explicitly creating placeholder pages as a "VirtualPage" (showing untranslated content, no redirect). we could have a checkbox on "create translation" button to optionally create this placeholder instead of a full-fleged editable translation
    - batch-creating placeholder pages for the whole site or a specific sub-tree through some user action

    Sorry if this goes too much into depth, I'm basically kicking off discussion about the implementation. Our first goal will be to get Translatable in a stable and tested state, so don't expect any work on placeholder pages in the next month or two - unless we get help/contributions of course.

  • carlgmathisen
    Avatar
    Community Member
    4 Posts

    Re: i18n and fallback language Link to this post

    Hi Ingo,

    Thank you for your elaborate answer. Very interesting. In my case, I've solved it in the short run by convincing the client to translate every page

    The creation of virtual placeholder pages is a good idea - this will solve the issue for those in a more precarious need for this functionality.

    Your first option definately seems like the easiest solution for the developer, using SilverStripe. If it's the easiest solution to implement for the SilverStripe framework developer... well that's another discussion

    I will also have a look to see what can be done.

    Carl

  • lise
    Avatar
    Community Member
    47 Posts

    Re: i18n and fallback language Link to this post

    Hello,

    I am wondering what is the status of this problem/discussion as I have exactly the same issue. My client is looking at SilverSTripe
    to create a large website in multiple languages (using Content localization and the Translatable class). But all the pages
    will not be translated in all the languages. However they would like visitors to always have access to all the pages : each page
    would be served either in the "locale" language if it has been translated on in the "default" language if it has not.

    Is it possible? How can this be implemented?

    Thanks

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