mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 11:05:59 +02:00
fixed editing translated siteconfigs
fixed editings translated configs, and added a link for the 'add translation' not working for siteconfigs
This commit is contained in:
parent
2fb20aa7e5
commit
91afab6ed1
@ -241,6 +241,9 @@ class Translatable extends DataExtension implements PermissionProvider {
|
||||
if((isset($_GET['locale']) && !$langsAvailable) || (isset($_GET['locale']) && in_array($_GET['locale'], $langsAvailable))) {
|
||||
// get from GET parameter
|
||||
self::set_current_locale($_GET['locale']);
|
||||
} else if((isset($_POST['Locale']) && !$langsAvailable) || (isset($_POST['Locale']) && in_array($_POST['Locale'], $langsAvailable))) {
|
||||
// get from POST parameter
|
||||
self::set_current_locale($_POST['Locale']);
|
||||
} else {
|
||||
self::set_current_locale(self::default_locale());
|
||||
}
|
||||
@ -933,7 +936,13 @@ class Translatable extends DataExtension implements PermissionProvider {
|
||||
$existingTransHTML = '<ul>';
|
||||
foreach($alreadyTranslatedLocales as $langCode) {
|
||||
$existingTranslation = $this->owner->getTranslation($langCode);
|
||||
if($existingTranslation && $existingTranslation->hasMethod('CMSEditLink')) {
|
||||
if ($existingTranslation && $this->owner->ClassName == "SiteConfig") {
|
||||
$existingTransHTML .= sprintf('<li><a href="%s">%s</a></li>',
|
||||
sprintf('%s/?locale=%s', Director::baseURL()."admin/settings", $langCode),
|
||||
i18n::get_locale_name($langCode)
|
||||
);
|
||||
}
|
||||
else if($existingTranslation && $existingTranslation->hasMethod('CMSEditLink')) {
|
||||
$existingTransHTML .= sprintf('<li><a href="%s">%s</a></li>',
|
||||
sprintf('%s/?locale=%s', $existingTranslation->CMSEditLink(), $langCode),
|
||||
i18n::get_locale_name($langCode)
|
||||
|
@ -60,5 +60,16 @@
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
/* for adding siteconfig translations */
|
||||
$('.CMSSettingsController :input[name=action_createtranslation]').entwine({
|
||||
onclick: function(e) {
|
||||
var newurl = document.location.href.split("?");
|
||||
newurl = newurl[0];
|
||||
document.location = newurl+"?locale="+$('select.languagedropdown').val()
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}(jQuery));
|
Loading…
Reference in New Issue
Block a user