Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

17478 Posts in 4473 Topics by 1972 members

Archive

SilverStripe Forums » Archive » i18n multilingual sites: add a default language and limit list of languages in translation tab

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

Page: 1
Go to End
Author Topic: i18n multilingual sites: add a default language and limit list of languages in translation tab 561 Views
  • Anatol
    avatar
    102 posts

    i18n multilingual sites: add a default language and limit list of languages in translation tab Link to this post

    Hi,

    I am trying to build my first Silverstripe multilingual site. How can I add Māori to the list in the translation tab and remove all other languages (without touching the core code)? The site should only be in English (en_NZ) as a default language and Māori (mi_NZ).

    Any help would be greatly appreciated.

    Cheers!
    Anatol

  • Anatol
    avatar
    102 posts

    Re: i18n multilingual sites: add a default language and limit list of languages in translation tab Link to this post

    As a temporary solution I simply went to /sapphire/core/i18n.php and added the language/s I wanted and then commented all of the languages I did not need:

    /**
    * A list of commonly used languages, in the form
    * langcode => array( EnglishName, NativeName)
    */
    public static $common_languages = array(
          'en' => array('English', 'English'),
          'mi' => array('Maori', 'Māori')

          /* deactivated languages for future reference
          'af' => array('Afrikaans', 'Afrikaans'),
          ... etc ...
          'zu' => array('Zulu', 'isiZulu')
          */

    );

    This just leaves English and Māori to toggle below the site tree and the translation tab only offers Māori.

    It seems to work well. However, this method means changing the core code. I was hoping to find a nicer way so I don't need to do this. Something like a setting for the _conf.php file, e.g. the imaginary methods:

    i18n::setCommonLanguages = array('en' => array('English', 'English'));
    or addCommonLanguages(), removeCommonLanguages() or removeAllCommonLanguages()

    Maybe I just did not find it, but there was nothing obvious in the API. Or maybe it's just too late in the day

    If you know of any better way please let me know.

    Cheers!
    Anatol

    561 Views
Page: 1
Go to Top

Currently Online: Euphemismus

Welcome to our latest member: jonchamberlain

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

Comments on this website? Please give feedback.