Jump to:

4873 Posts in 7242 Topics by 1471 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » Error 'Undefined index: en_US'

Getting SilverStripe up and running on your computer and on your web server.

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

Page: 1
Go to End
Author Topic: 2043 Views
  • SSilence
    Avatar
    Community Member
    2 Posts

    Error 'Undefined index: en_US' Link to this post

    After the install I changed the language settings in my profile. On accessing the admin interface I get following error message. Why, I can't understand this. en_US and de_DE are both available.

    [Notice] Undefined index: en_US
    GET /admin/

    Line 16 in /htdocs/elektrovoitl.de/cms/lang/de_DE.php
    Source

    7 */
    8
    9 i18n::include_locale_file('cms', 'en_US');
    10
    11 global $lang;
    12
    13 if(array_key_exists('de_DE', $lang) && is_array($lang['de_DE'])) {
    14    $lang['de_DE'] = array_merge($lang['en_US'], $lang['de_DE']);
    15 } else {
    16    $lang['de_DE'] = $lang['en_US'];
    17 }
    18
    19 $lang['de_DE']['AssetAdmin']['CHOOSEFILE'] = 'Datei auswählen';
    20 $lang['de_DE']['AssetAdmin']['CONTENTMODBY'] = 'Inhalt veränderbar durch';
    21 $lang['de_DE']['AssetAdmin']['CONTENTUSABLEBY'] = 'Inhalt einsetzbar von';
    22 $lang['de_DE']['AssetAdmin']['DELETEDX'] = '%s Dateien gelöscht';

    Trace

    * include_once(/htdocs/elektrovoitl.de/cms/lang/de_DE.php)
    Line 1076 of i18n.php
    * i18n::include_by_locale(de_DE)
    Line 824 of i18n.php
    * i18n::_t(LeftAndMain.HELP,Help,100,Menu title)
    Line 286 of Core.php
    * _t(LeftAndMain.HELP,Help,100,Menu title)
    Line 113 of LeftAndMain.php
    * LeftAndMain->init()
    Line 80 of CMSMain.php
    * CMSMain->init()
    Line 113 of Controller.php
    * Controller->handleRequest(HTTPRequest)
    Line 262 of Director.php
    * Director::handleRequest(HTTPRequest,Session)
    Line 106 of Director.php
    * Director::direct(admin/)
    Line 115 of main.php

    Thanks!
    Tobi

  • SSilence
    Avatar
    Community Member
    2 Posts

    Re: Error 'Undefined index: en_US' Link to this post

    I found a dirty fix: I updated the sapphire/core/i18n.php and replaced the include_once through an include:

    static function include_locale_file($module, $locale) {
       if (file_exists($file = Director::getAbsFile("$module/lang/$locale.php"))) include($file);
    }

    It seems that the global variable $locale will be overwritten in the processing before (but I can't find where).

    Tobi

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