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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

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

when Translatable enabled, JS error in CMS


Go to End


2 Posts   1717 Views

Avatar
qlex

Community Member, 68 Posts

22 September 2009 at 1:56am

Hi,
when i enable Translatable in _config.php, and login to admin, a JS error shows up when i select any page in sitetree of CMS.

Im trying to add translations to all pages, and then add a language switcher to the theme and im stuck at the very beginning.

I would really appreciate if somebody could give me a hand as i want to allow my client start adding tri-lingual content to his website (polish ,english, german)

cheers,
Qlex

Below is the error:

ERROR [Notice]: Object of class Panel could not be converted to int
IN POST /ztm/admin/getitem?ID=15&locale=pl_PL&ajax=1
Line 22 in /home/2eur/www/ztm/sapphire/forms/LanguageDropdownField.php

Source
======
  13:  	 * @param string $title
  14:  	 * @param array $excludeLocales List of locales that won't be included
  15:  	 * @param string $translatingClass Name of the class with translated instances where to look for
       used languages
  16:  	 * @param string $list Indicates the source language list. Can be either Common-English,
       Common-Native, Locale-English, Locale-Native
  17:  	 */
  18:  	function __construct($name, $title, $excludeLocales = array(), $translatingClass = 'SiteTree',
       $list = 'Common-English', $instance = null) {
  19:  		$usedLocalesWithTitle = Translatable::get_existing_content_languages($translatingClass);
  20:  		$usedLocalesWithTitle = array_diff_key($usedLocalesWithTitle, $excludeLocales);
  21:  
* 22:  		if('Common-English' == $list) $allLocalesWithTitle = i18n::get_common_languages();
  23:  		else if('Common-Native' == $list) $allLocalesWithTitle = i18n::get_common_languages(true);
  24:  		else if('Locale-English' == $list) $allLocalesWithTitle = i18n::get_common_locales();
  25:  		else if('Locale-Native' == $list) $allLocalesWithTitle = i18n::get_common_locales(true);
  26:  		else $allLocalesWithTitle = i18n::get_locale_list();
  27:  
  28:  		if(isset($allLocales[Translatable::default_locale()]))
       unset($allLocales[Translatable::default_locale()]);

<ul>LanguageDropdownField->__construct(NewTransLang,Nowy język,Array,SiteTree,Object id #50)
line 879 of Translatable.php

Translatable->updateCMSFields(Object id #47,,,,,,)
line 741 of Object.php

Object->extend(updateCMSFields,Object id #47)
line 1328 of SiteTree.php

SiteTree->getCMSFields(Object id #17)
line 390 of CMSMain.php

CMSMain->getEditForm(15)
line 925 of LeftAndMain.php

LeftAndMain->EditForm()
line 380 of LeftAndMain.php

LeftAndMain->getitem(Object id #15)
line 162 of Controller.php

Controller->handleAction(Object id #15)
line 129 of RequestHandler.php

RequestHandler->handleRequest(Object id #15)
line 122 of Controller.php

Controller->handleRequest(Object id #15)
line 277 of Director.php

Director::handleRequest(Object id #15,Session)
line 121 of Director.php

Director::direct(/admin/getitem)
line 118 of main.php

</ul>

Avatar
qlex

Community Member, 68 Posts

26 September 2009 at 12:26am

on irc simon helped me to provide a temporary solution to get rid of this JS error.

Steps required:
- edit sapphire/core/model/Translatable.php
- in line 873, after 'SiteTree', add 'Common-Native',

with quote and comma being imporant.

This should make the error dissapear.

Qlex