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.

Customising the CMS /

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

Correct way of setting security access to editors


Go to End


22 Posts   7229 Views

Avatar
Kalileo

Community Member, 127 Posts

6 October 2009 at 7:39am

Edited: 06/10/2009 7:41am

Thanks a lot, AlexBeka, your patch works for me, content admins can now see the translations (the sitetree in second ++ language). This saves me from some headache tomorrow :)

For a better solution it would be nice if the content admin could actually use the language selector, and not have to switch translations using the translation tab in any of the translated pages.

To my surprise the event calendar issue i see Event Calendar and Translatable - error adding announcements in second languageseems to be related, the patch seemed to have helped there too, halfway at least.

Avatar
Ingo

Forum Moderator, 801 Posts

6 October 2009 at 10:24am

I've made some commits to trunk in the last 24h which should fix this properly. There's now a TRANSLATE_ALL permission, or alternatively TRANSLATE_<locale> if Translate::set_allowed_locales() is used. You should be able to patch a 2.3 installation with those commits as well. open.ss.com is currently down, but the commits will show up in there soon: http://open.silverstripe.com/timeline

Avatar
Kalileo

Community Member, 127 Posts

6 October 2009 at 1:12pm

Edited: 06/10/2009 1:13pm

Thanks Ingo, that was fast :)

I applied the changesets manually
Changeset [88123] by ischommer
Changeset [88125] by ischommer
Changeset [88137] by ischommer
Changeset [88138] by ischommer
Changeset [88139] by ischommer

and it works now, even content admins can switch Translations easily :)

BTW, the Translatable.php as it is now on open.ss.com does not work for me, it's full with "SiteTree"."Locale" which mysql does not like, it wants `SiteTree`.`Locale`

Avatar
Ingo

Forum Moderator, 801 Posts

6 October 2009 at 6:14pm

You'll need 2.3.3 (and please read the upgrade notes on doc.ss.com carefully)

Avatar
Kalileo

Community Member, 127 Posts

6 October 2009 at 6:37pm

Ingo, yes, I applied your changesets to a vanilla 2.3.3 Translatable.php, and all is fine.

However before I did that I took the Translatable.php from open.ss.com and that had these MySQL errors about "SiteTree"."Locale" (which mysql does not like, it wants `SiteTree`.`Locale`) however that's trunk and work in progress, so nevermind. The language / translation selection was our issue here, and that you fixed.

Thanks again.

Avatar
AlexBeka

Community Member, 21 Posts

7 October 2009 at 12:58am

thanks a lot for your changesets Ingo;

i just commented out the following lines in constructor of LanguageDropDownField.php which you added in changeset 88138:

 foreach($usedLocalesWithTitle as $locale => $localeTitle) { 
 	if($instance && !$instance->canTranslate(null, $locale)) { 
 		unset($usedLocalesWithTitle[$locale]); 
	}
} 

because of the following behaviour:
1.) added the user "EnglishTranslator" and given the group the permission to edit site content and to translate to english ('TRANSLATE_en_GB');
2.) logging in with that user shows the german sitetree but in the dropdown is just "English (United Kingdom)" displayed, so the "wrong" language is displayed for the current sitetree; navigating through the german sitetree is also not possible because ajax is missing the locale from the dropdown;

Avatar
Kalileo

Community Member, 127 Posts

7 October 2009 at 8:40am

Edited: 07/10/2009 8:41am

AlexBeka, have you explicitely allowed languages? IIRC that was needed for me to overcome exactly the same issue you talk about. I assume that your default language is not set to English, but to German, then it would be like this in _config.php:

Object::add_extension('SiteTree', 'Translatable'); 
Translatable::set_default_locale('de_DE'); 
$allowed_locales = array( 
   'de_DE' 
   'en_GB', 
); 
Translatable::set_allowed_locales($allowed_locales);

That works for me, without having to uncomment these lines LanguageDropDownField.php

Avatar
AlexBeka

Community Member, 21 Posts

7 October 2009 at 9:26pm

my settings in _config.php are:

Object::add_extension('SiteTree', 'Translatable');
Translatable::set_default_locale('de_AT');
Translatable::set_allowed_locales(array('de_AT', 'en_GB')); 

so i have explicitely defined the "allowed" languges; i am wondering Kalileo that you cannot reproduce my described steps:

1.) added the user "EnglishTranslator" and given the group the permission to edit site content and to translate to english ('TRANSLATE_en_GB');
2.) logging in with that user shows the german sitetree but in the dropdown is just "English (United Kingdom)" displayed, so the "wrong" language is displayed for the current sitetree; navigating through the german sitetree is also not possible because ajax is missing the locale from the dropdown;

Kalileo, if you reproduce these steps you see in in the language dropdown of the sitetree still the german language (you are also using SS 2.3.3, isn´t it)? with the code of Ingo it shouldn´t be because in this foreach loop in LanguageDropdownField.php

foreach($usedLocalesWithTitle as $locale => $localeTitle) { 
	if($instance && !$instance->canTranslate(null, $locale)) { 
		unset($usedLocalesWithTitle[$locale]); 
	}
 } 

can_Translate will return false for "de_AT" locale and so it is removed from the $usedLocalesWithTitle array, if the user has just the permisision-code TRANSLATE_en_GB as in my testcase above defined;