mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
ENHANCEMENT Started using ss.i18n clientside javascript in LeftAndMain classes (only a fraction made translatable)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@63569 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
2a93f96436
commit
ee4c409e56
@ -126,6 +126,7 @@ class LeftAndMain extends Controller {
|
||||
Requirements::javascript(THIRDPARTY_DIR . '/loader.js');
|
||||
Requirements::javascript(THIRDPARTY_DIR . '/hover.js');
|
||||
Requirements::javascript(THIRDPARTY_DIR . '/layout_helpers.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
|
||||
|
||||
Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');
|
||||
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Activator.js');
|
||||
@ -584,7 +585,7 @@ JS;
|
||||
*/
|
||||
public function getActionUpdateJS($record) {
|
||||
// Get the new action buttons
|
||||
|
||||
|
||||
$tempForm = $this->getEditForm($record->ID);
|
||||
$actionList = '';
|
||||
foreach($tempForm->Actions() as $action) {
|
||||
|
@ -71,10 +71,10 @@ addpage.prototype = {
|
||||
var parentID = st.getIdxOf(st.firstSelected());
|
||||
// TODO: Remove 'new-' code http://open.silverstripe.com/ticket/875
|
||||
if(parentID && parentID.substr(0,3) == 'new') {
|
||||
alert("You have to save a page before adding children underneath it");
|
||||
alert(ss.i18n._t('CMSMAIN.WARNINGSAVEPAGESBEFOREADDING'));
|
||||
|
||||
} else if( Element.hasClassName( st.firstSelected(), "nochildren" ) ) {
|
||||
alert("You can't add children to the selected node" );
|
||||
alert(ss.i18n._t('CMSMAIN.CANTADDCHILDREN') );
|
||||
} else {
|
||||
$(_HANDLER_FORMS.addpage).elements.ParentID.value = parentID ? parentID : 0;
|
||||
|
||||
@ -93,7 +93,7 @@ addpage.prototype = {
|
||||
},
|
||||
|
||||
showAddPageError: function(response) {
|
||||
errorMessage('Error adding page', response);
|
||||
errorMessage(ss.i18n._t('CMSMAIN.ERRORADDINGPAGE'), response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,10 +180,13 @@ showonlydrafts.prototype = {
|
||||
Behaviour.apply();
|
||||
$('SiteTreeIsFiltered').value = 1;
|
||||
$('batchactions').multiselectTransform();
|
||||
statusMessage('Filtered tree to only show changed pages','good');
|
||||
statusMessage(ss.i18n._t('CMSMAIN.FILTEREDTREE'),'good');
|
||||
},
|
||||
onFailure : function(response) {
|
||||
errorMessage('Could not filter tree to only show changed pages<br />' + response.responseText);
|
||||
errorMessage(ss.i18n.printf(
|
||||
ss.i18n._t('CMSMAIN.ERRORFILTERPAGES'),
|
||||
response.responseText
|
||||
));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@ -270,10 +273,13 @@ batchActionGlobals = {
|
||||
Behaviour.apply();
|
||||
$('SiteTreeIsFiltered').value = 0;
|
||||
$('batchactions').multiselectTransform();
|
||||
statusMessage('Unfiltered tree','good');
|
||||
statusMessage(ss.i18n._t('CMSMAIN.SUCCESSUNFILTER'),'good');
|
||||
},
|
||||
onFailure : function(response) {
|
||||
errorMessage('Could not unfilter site tree<br />' + response.responseText);
|
||||
errorMessage(ss.i18n.printf(
|
||||
ss.i18n._t('CMSMAIN.ERRORUNFILTER'),
|
||||
response.responseText
|
||||
));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -291,7 +297,7 @@ publishpage.prototype = {
|
||||
if(csvIDs) {
|
||||
this.elements.csvIDs.value = csvIDs;
|
||||
|
||||
statusMessage('Publishing pages...');
|
||||
statusMessage(ss.i18n._t('CMSMAIN.PUBLISHINGPAGES'));
|
||||
|
||||
// Put an AJAXY loading icon on the button
|
||||
$('action_publish_selected').className = 'loading';
|
||||
@ -302,11 +308,11 @@ publishpage.prototype = {
|
||||
treeactions.closeSelection($('batchactions'));
|
||||
},
|
||||
onFailure : function(response) {
|
||||
errorMessage('Error publishing pages', response);
|
||||
errorMessage(ss.i18n._t('CMSMAIN.ERRORPUBLISHING'), response);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert("Please select at least 1 page.");
|
||||
alert(ss.i18n._t('CMSMAIN.SELECTONEPAGE'));
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -325,10 +331,13 @@ deletepage.prototype = {
|
||||
if(csvIDs || batchActionGlobals.newNodes.length > 0) {
|
||||
batchActionGlobals.count += batchActionGlobals.newNodes.length;
|
||||
|
||||
if(confirm("Do you really want to delete the " + batchActionGlobals.count + " marked pages?")) {
|
||||
if(confirm(ss.i18n.printf(
|
||||
ss.i18n._t('CMSMAIN.REALLYDELETEPAGES'),
|
||||
batchActionGlobals.count
|
||||
))) {
|
||||
this.elements.csvIDs.value = csvIDs;
|
||||
|
||||
statusMessage('Deleting pages...');
|
||||
statusMessage(ss.i18n._t('CMSMAIN.DELETINGPAGES'));
|
||||
// TODO: Remove 'new-' code http://open.silverstripe.com/ticket/875
|
||||
for( var idx = 0; idx < batchActionGlobals.newNodes.length; idx++ ) {
|
||||
var newNode = $('sitetree').getTreeNodeByIdx( batchActionGlobals.newNodes[idx] );
|
||||
@ -351,13 +360,13 @@ deletepage.prototype = {
|
||||
treeactions.closeSelection($('batchactions'));
|
||||
},
|
||||
onFailure : function(response) {
|
||||
errorMessage('Error deleting pages', response);
|
||||
errorMessage(ss.i18n._t('CMSMAIN.ERRORDELETINGPAGES'), response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
alert("Please select at least 1 page.");
|
||||
alert(ss.i18n._t('CMSMAIN.SELECTONEPAGE'));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1,16 +1,16 @@
|
||||
function action_publish_right() {
|
||||
$('Form_EditForm_action_publish').value = 'Publishing...';
|
||||
$('Form_EditForm_action_publish').value = ss.i18n._t('CMSMAIN.PUBLISHING');
|
||||
$('Form_EditForm_action_publish').className = 'action loading';
|
||||
var publish = true;
|
||||
$('Form_EditForm').save(false, null, 'save', publish);
|
||||
}
|
||||
function action_revert_right() {
|
||||
$('Form_EditForm_action_revert').value = 'Restoring...';
|
||||
$('Form_EditForm_action_revert').value = ss.i18n._t('CMSMAIN.RESTORING');
|
||||
$('Form_EditForm_action_revert').className = 'action loading';
|
||||
Ajax.SubmitForm('Form_EditForm', 'action_revert', {
|
||||
onSuccess : Ajax.Evaluator,
|
||||
onFailure : function(response) {
|
||||
errorMessage('Error reverting to live content', response);
|
||||
errorMessage(ss.i18n._t('CMSMAIN.ERRORREVERTING'), response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ function prepareAjaxActions(actions, formName, tabName) {
|
||||
if(window[this.name + '_' + tabName]) {
|
||||
window[this.name + '_' + tabName](e);
|
||||
} else {
|
||||
statusMessage(ingize(this.value));
|
||||
statusMessage('...');
|
||||
Ajax.SubmitForm(this.ownerForm, this.name, {
|
||||
onSuccess: Ajax.Evaluator,
|
||||
onFailure: ajaxErrorHandler
|
||||
@ -291,6 +291,9 @@ function prepareAjaxActions(actions, formName, tabName) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 2.3 Please use ss.i18n
|
||||
*/
|
||||
function ingize(val) {
|
||||
var ingWord, suffix;
|
||||
if(!val) val = "process";
|
||||
|
@ -336,7 +336,7 @@ SiteTreeNode.prototype = {
|
||||
var currentlyOpenPageID = 0;
|
||||
if($('Form_EditForm').elements.ID) currentlyOpenPageID = $('Form_EditForm').elements.ID.value;
|
||||
|
||||
statusMessage('saving...', '', true);
|
||||
statusMessage(ss.i18n._t('CMSMAIN.SAVING'), '', true);
|
||||
new Ajax.Request(SiteTreeHandlers.parentChanged_url, {
|
||||
method : 'post',
|
||||
postBody : 'ID=' + node.getIdx() + '&ParentID=' + newParent.getIdx() + '&CurrentlyOpenPageID=' + currentlyOpenPageID,
|
||||
@ -355,7 +355,7 @@ SiteTreeNode.prototype = {
|
||||
* movedNode is the node that actually got moved to trigger this resorting
|
||||
*/
|
||||
onOrderChanged : function(nodeList, movedNode) {
|
||||
statusMessage('saving...', '', true);
|
||||
statusMessage(ss.i18n._t('CMSMAIN.SAVING'), '', true);
|
||||
|
||||
var i, parts = Array();
|
||||
sort = 0;
|
||||
|
@ -184,7 +184,7 @@ CMSForm.prototype = {
|
||||
data += '&publish=1';
|
||||
}
|
||||
|
||||
statusMessage("Saving...", null, true);
|
||||
statusMessage(ss.i18n._t('CMSMAIN.SAVING'), null, true);
|
||||
new Ajax.Request(this.action, {
|
||||
method : this.method,
|
||||
postBody: data,
|
||||
@ -311,7 +311,7 @@ CMSRightForm.applyTo('#Form_EditForm', 'right');
|
||||
|
||||
function action_save_right() {
|
||||
_AJAX_LOADING = true;
|
||||
$('Form_EditForm_action_save').value = 'Saving...';
|
||||
$('Form_EditForm_action_save').value = ss.i18n._t('CMSMAIN.SAVING');
|
||||
$('Form_EditForm_action_save').className = 'action loading';
|
||||
$('Form_EditForm').save(false);
|
||||
}
|
||||
@ -411,7 +411,7 @@ function autoSave(confirmation, callAfter) {
|
||||
// save is still used if confirmation = false
|
||||
var options = {
|
||||
save: function() {
|
||||
statusMessage('saving...', '', true);
|
||||
statusMessage(ss.i18n._t('CMSMAIN.SAVING'), '', true);
|
||||
var i;
|
||||
for(i=0;i<__forms.length;i++) {
|
||||
if(__forms[i].isChanged && __forms[i].isChanged()) {
|
||||
|
23
javascript/lang/de_DE.js
Normal file
23
javascript/lang/de_DE.js
Normal file
@ -0,0 +1,23 @@
|
||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||
console.error('Class ss.i18n not defined');
|
||||
} else {
|
||||
ss.i18n.addDictionary('de_DE', {
|
||||
'CMSMAIN.WARNINGSAVEPAGESBEFOREADDING' : "Sie müssen diese Seite speichern bevor Unterseiten hingefügt werden können",
|
||||
'CMSMAIN.CANTADDCHILDREN' : "Unterseiten nicht erlaubt",
|
||||
'CMSMAIN.ERRORADDINGPAGE' : 'Fehler beim Hinzufügen der Seite',
|
||||
'CMSMAIN.FILTEREDTREE' : 'Gefilterter Seitenbaum zeigt nur Änderungen',
|
||||
'CMSMAIN.ERRORFILTERPAGES' : 'Konnte Seitenbaum nicht filtern<br />%s',
|
||||
'CMSMAIN.ERRORUNFILTER' : 'Konnte Filterung des Seitenbaumes nicht aufheben<br />%s',
|
||||
'CMSMAIN.ERRORUNFILTER' : 'Filterung des Seitenbaumes zurückgesetzt',
|
||||
'CMSMAIN.PUBLISHINGPAGES' : 'Publiziere Seiten...',
|
||||
'CMSMAIN.SELECTONEPAGE' : "Bitte mindestens eine Seite auswählen",
|
||||
'CMSMAIN.ERRORPUBLISHING' : 'Fehler beim Veröffentlichen der Seiten',
|
||||
'CMSMAIN.REALLYDELETEPAGE' : "Wollen Sie wirklich %s Seiten löschen?",
|
||||
'CMSMAIN.DELETINGPAGES' : 'Lösche Seiten...',
|
||||
'CMSMAIN.ERRORDELETINGPAGES': 'Fehler beim Löschen der Seiten',
|
||||
'CMSMAIN.PUBLISHING' : 'Veröffentliche...',
|
||||
'CMSMAIN.RESTORING': 'Wiederherstellen...',
|
||||
'CMSMAIN.ERRORREVERTING': 'Fehler beim Wiederherstellen des Live-Inhaltes',
|
||||
'CMSMAIN.SAVING' : 'Sichern...'
|
||||
});
|
||||
}
|
25
javascript/lang/en_US.js
Normal file
25
javascript/lang/en_US.js
Normal file
@ -0,0 +1,25 @@
|
||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||
console.error('Class ss.i18n not defined');
|
||||
} else {
|
||||
ss.i18n.addDictionary('en_US', {
|
||||
'CMSMAIN.WARNINGSAVEPAGESBEFOREADDING' : "You have to save a page before adding children underneath it",
|
||||
'CMSMAIN.CANTADDCHILDREN' : "You can't add children to the selected node",
|
||||
'CMSMAIN.ERRORADDINGPAGE' : 'Error adding page',
|
||||
'CMSMAIN.FILTEREDTREE' : 'Filtered tree to only show changed pages',
|
||||
'CMSMAIN.ERRORFILTERPAGES' : 'Could not filter tree to only show changed pages<br />%s',
|
||||
'CMSMAIN.ERRORUNFILTER' : 'Could not unfilter site tree<br />%s',
|
||||
'CMSMAIN.ERRORUNFILTER' : 'Unfiltered tree',
|
||||
'CMSMAIN.PUBLISHINGPAGES' : 'Publishing pages...',
|
||||
'CMSMAIN.SELECTONEPAGE' : "Please select at least 1 page.",
|
||||
'CMSMAIN.ERRORPUBLISHING' : 'Error publishing pages',
|
||||
'CMSMAIN.REALLYDELETEPAGE' : "Do you really want to delete the %s marked pages?",
|
||||
'CMSMAIN.DELETINGPAGES' : 'Deleting pages...',
|
||||
'CMSMAIN.ERRORDELETINGPAGES': 'Error deleting pages',
|
||||
'CMSMAIN.PUBLISHING' : 'Publishing...',
|
||||
'CMSMAIN.RESTORING': 'Restoring...',
|
||||
'CMSMAIN.ERRORREVERTING': 'Error reverting to live content',
|
||||
'CMSMAIN.SAVING' : 'saving...',
|
||||
|
||||
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user