Q: Limit languages in cms I use silverstripe 3.1
I would like to limit the languages (To only German and English) which are available in the drop down in the CMS. Therefore I put
the following code in my mysite/_config.php
i18n::set_locale('de_DE');
$allowed_locales = array(
   'de_DE' => array('Deutsch', 'Deutsch'),
   'en_EN' => array('English', 'English')
);
i18n::$common_locales = $allowed_locales;

Afer a flush=1 i get the following error: 
Fatal error: Cannot access private property i18n::$common_locales in ... _config.php
Any ideas what goes wrong?
Thank you 

A: as of 3.1 most of the static php variables are private. this means you can no longer access those.
the reason for this api change is that they are now cached by the config layer (this is also why you have to ?flush=1 now after changing private statics in classes like for example with private static $db)
if you want to update something in the config layer, you can do this with:
 Config::inst()->update('CLASS', 'FIELD', $value);

you could use use the config update to overwrite the common locales (class would be 'i18n', and field would be 'common_locales'):
Config::inst()->update('i18n', 'common_locales', $array);

Note: if you want to completely overwrite an existing configuration, you have to do a remove() first.
Config::inst()->remove('i18n', 'common_locales');
Config::inst()->update('i18n', 'common_locales', $array);


however, if you are using the translatable module and you want to limit the number of translatable languages, there is a much better way already built in:
// in your _config.php
i18n::set_locale('en_US');
Translatable::set_allowed_locales(array(
    'de_DE',
    'en_US',
 ));


A: Config it through YAML:
i18n:
  common_locales:
    nl_BE:
       name: Dutch (Belgium)
       native: Nederlands
    fr_BE:
      name: French (Belgium)
      native: Francais

