Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe /

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

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

Error 'Undefined index: en_US'


Reply


2 Posts   2157 Views

Avatar
SSilence

Community Member, 2 Posts

25 February 2009 at 9:28am

Edited: 05/03/2009 10:23am

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

Avatar
SSilence

Community Member, 2 Posts

25 February 2009 at 10:09am

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