New module-based JS translation keys

This commit is contained in:
Aaron Carlino 2017-04-24 14:47:00 +12:00
parent 29805ee446
commit b6d4eb3e77
6 changed files with 43 additions and 73 deletions

View File

@ -36,7 +36,7 @@ d&&(s=parseInt(JSON.parse(d).ParentID,10))}var l={selector:this.data("targetPane
s?(o=this.data("extraParams")?this.data("extraParams"):"",c=t.path.addSearchParams(i18n.sprintf(this.data("urlAddpage"),s),o)):c=this.attr("href"),t(".cms-container").loadPanel(c,null,l),n.preventDefault(),
this.blur()}})})},function(t,e,n){"use strict"
function a(t){return t&&t.__esModule?t:{default:t}}var i=n(2),s=a(i),o=n(5),r=a(o)
s.default.entwine("ss",function(t){t(".cms-edit-form :input[name=ClassName]").entwine({onchange:function t(){alert(r.default._t("CMSMAIN.ALERTCLASSNAME"))}}),t(".cms-edit-form input[name=Title]").entwine({
s.default.entwine("ss",function(t){t(".cms-edit-form :input[name=ClassName]").entwine({onchange:function t(){alert(r.default._t("CMS.ALERTCLASSNAME"))}}),t(".cms-edit-form input[name=Title]").entwine({
onmatch:function e(){var n=this
n.data("OrigVal",n.val())
var a=n.closest("form"),i=t("input:text[name=URLSegment]",a),s=t("input[name=LiveLink]",a)
@ -48,9 +48,8 @@ e.val()==a&&(e.val(n),e.updatedRelatedFields&&e.updatedRelatedFields())})},updat
i.update(n),s.is(":visible")&&s.hide()},updateBreadcrumbLabel:function e(n){var a=t(".cms-edit-form input[name=ID]").val(),i=t("span.cms-panel-link.crumb")
n&&""!=n&&i.text(n)},_addActions:function e(){var n=this,a
a=t("<button />",{class:"update ss-ui-button-small",text:r.default._t("URLSEGMENT.UpdateURL"),type:"button",click:function t(e){e.preventDefault(),n.updateURLSegment(n.val())}}),a.insertAfter(n),a.hide()
}}),t(".cms-edit-form .parentTypeSelector").entwine({onmatch:function t(){var e=this
a=t("<button />",{class:"update ss-ui-button-small",text:r.default._t("CMS.UpdateURL"),type:"button",click:function t(e){e.preventDefault(),n.updateURLSegment(n.val())}}),a.insertAfter(n),a.hide()}}),t(".cms-edit-form .parentTypeSelector").entwine({
onmatch:function t(){var e=this
this.find(":input[name=ParentType]").bind("click",function(t){e._toggleSelection(t)}),this.find(".TreeDropdownField").bind("change",function(t){e._changeParentId(t)}),this._changeParentId(),this._toggleSelection(),
this._super()},onunmatch:function t(){this._super()},_toggleSelection:function e(n){var a=this.find(":input[name=ParentType]:checked").val(),i=this.find("#Form_EditForm_ParentID_Holder")
"root"==a?this.find(":input[name=ParentID]").val(0):this.find(":input[name=ParentID]").val(this.find("#Form_EditForm_ParentType_subpage").data("parentIdValue")),"root"!=a?i.slideDown(400,function(){t(this).css("overflow","visible")
@ -66,13 +65,13 @@ a[e?"hide":"slideUp"](function(){n.removeClass("field--merge-below")}).css("over
return"http://"!=a.substr(0,7)&&(a=t("base").attr("href")+a),window.open(a,"printable"),!1}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_rollback").entwine({onclick:function t(e){var n=this.parents("form:first"),a=n.find(":input[name=Version]").val(),i=""
return i=a?r.default.sprintf(r.default._t("CMSMain.RollbackToVersion"),a):r.default._t("CMSMain.ConfirmRestoreFromLive"),!!confirm(i)&&this._super(e)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_archive").entwine({
return i=a?r.default.sprintf(r.default._t("CMS.RollbackToVersion"),a):r.default._t("CMS.ConfirmRestoreFromLive"),!!confirm(i)&&this._super(e)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_archive").entwine({
onclick:function t(e){var n=this.parents("form:first"),a=""
return a=n.find("input[name=ArchiveWarningMessage]").val().replace(/\\n/g,"\n"),!!confirm(a)&&this._super(e)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_restore").entwine({onclick:function t(e){
var n=this.parents("form:first"),a=n.find(":input[name=Version]").val(),i="",s=this.data("toRoot")
return i=r.default.sprintf(r.default._t(s?"CMSMain.RestoreToRoot":"CMSMain.Restore"),a),!!confirm(i)&&this._super(e)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_unpublish").entwine({onclick:function t(e){
return i=r.default.sprintf(r.default._t(s?"CMS.RestoreToRoot":"CMS.Restore"),a),!!confirm(i)&&this._super(e)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_unpublish").entwine({onclick:function t(e){
var n=this.parents("form:first"),a=n.find(":input[name=Version]").val(),i=""
return i=r.default.sprintf(r.default._t("CMSMain.Unpublish"),a),!!confirm(i)&&this._super(e)}}),t(".cms-edit-form.changed").entwine({onmatch:function t(e){var n=this.find("button[name=action_save]")
return i=r.default.sprintf(r.default._t("CMS.Unpublish"),a),!!confirm(i)&&this._super(e)}}),t(".cms-edit-form.changed").entwine({onmatch:function t(e){var n=this.find("button[name=action_save]")
n.attr("data-text-alternate")&&(n.attr("data-text-standard",n.text()),n.text(n.attr("data-text-alternate"))),n.attr("data-btn-alternate")&&(n.attr("data-btn-standard",n.attr("class")),n.attr("class",n.attr("data-btn-alternate"))),
n.removeClass("btn-secondary-outline").addClass("btn-primary")
var a=this.find("button[name=action_publish]")
@ -113,17 +112,17 @@ n.each(function(e){var a="1",i=t(n[e]).find("li").length
i>20?a="3":i>10&&(a="2"),t(n[e]).addClass("col-"+a).removeClass("right"),t(n[e]).find("li").on("mouseenter",function(e){t(this).parent("ul").removeClass("right")})})},getTreeConfig:function e(){var n=this,a=this._super(),i=this.getHints()
return a.plugins.push("contextmenu"),a.contextmenu={items:function e(a){var i={edit:{label:a.hasClass("edit-disabled")?r.default._t("Tree.EditPage","Edit page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"):r.default._t("Tree.ViewPage","View page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),
return a.plugins.push("contextmenu"),a.contextmenu={items:function e(a){var i={edit:{label:a.hasClass("edit-disabled")?r.default._t("CMS.EditPage","Edit page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"):r.default._t("CMS.ViewPage","View page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),
action:function e(a){t(".cms-container").entwine(".ss").loadPanel(r.default.sprintf(n.data("urlEditpage"),a.data("id")))}}}
a.hasClass("nochildren")||(i.showaslist={label:r.default._t("Tree.ShowAsList"),action:function e(a){t(".cms-container").entwine(".ss").loadPanel(n.data("urlListview")+"&ParentID="+a.data("id"),null,{tabState:{
a.hasClass("nochildren")||(i.showaslist={label:r.default._t("CMS.ShowAsList"),action:function e(a){t(".cms-container").entwine(".ss").loadPanel(n.data("urlListview")+"&ParentID="+a.data("id"),null,{tabState:{
"pages-controller-cms-content":{tabSelector:".content-listview"}}})}})
var s=a.data("pagetype"),o=a.data("id"),d=a.find(">a .item").data("allowedchildren"),l={},c=!1
return t.each(d,function(e,a){c=!0,l["allowedchildren-"+e]={label:'<span class="jstree-pageicon"></span>'+a,_class:"class-"+e,action:function a(i){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r.default.sprintf(n.data("urlAddpage"),o,e),n.data("extraParams")))
}}}),c&&(i.addsubpage={label:r.default._t("Tree.AddSubPage","Add page under this page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),submenu:l}),a.hasClass("edit-disabled")||(i.duplicate={
label:r.default._t("Tree.Duplicate"),submenu:[{label:r.default._t("Tree.ThisPageOnly"),action:function e(a){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r.default.sprintf(n.data("urlDuplicate"),a.data("id")),n.data("extraParams")))
}}}),c&&(i.addsubpage={label:r.default._t("CMS.AddSubPage","Add page under this page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),submenu:l}),a.hasClass("edit-disabled")||(i.duplicate={
label:r.default._t("CMS.Duplicate"),submenu:[{label:r.default._t("CMS.ThisPageOnly"),action:function e(a){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r.default.sprintf(n.data("urlDuplicate"),a.data("id")),n.data("extraParams")))
}},{label:r.default._t("Tree.ThisPageAndSubpages"),action:function e(a){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r.default.sprintf(n.data("urlDuplicatewithchildren"),a.data("id")),n.data("extraParams")))
}},{label:r.default._t("CMS.ThisPageAndSubpages"),action:function e(a){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r.default.sprintf(n.data("urlDuplicatewithchildren"),a.data("id")),n.data("extraParams")))
}}]}),i}},a}}),t(".cms-tree a.jstree-clicked").entwine({onmatch:function t(){var e=this,n=e.parents(".cms-panel-content"),a;(e.offset().top<0||e.offset().top>n.height()-e.height())&&(a=n.scrollTop()+e.offset().top+n.height()/2,
n.animate({scrollTop:a},"slow"))}}),t(".cms-tree-filtered .clear-filter").entwine({onclick:function t(){window.location=location.protocol+"//"+location.host+location.pathname}})})},function(t,e,n){"use strict"
@ -142,7 +141,7 @@ t(".cms-container").loadPanel(d,"",{pjax:"CurrentForm"})}}),t("#Form_VersionsFor
},onchange:function t(){this.toggle()},toggle:function e(){var n=t(this),a=n.parents("form")
n.attr("checked")?a.find("tr[data-published=false]").css("display",""):a.find("tr[data-published=false]").css("display","none")._unselect()}}),t("#Form_VersionsForm tbody tr").entwine({onclick:function t(e){
var n,a
return n=this.parents("form").find(":input[name=CompareMode]").attr("checked"),a=this.siblings(".active"),n&&this.hasClass("active")?void this._unselect():n?a.length>1?alert(r.default._t("ONLYSELECTTWO","You can only compare two versions at this time.")):(this._select(),
return n=this.parents("form").find(":input[name=CompareMode]").attr("checked"),a=this.siblings(".active"),n&&this.hasClass("active")?void this._unselect():n?a.length>1?alert(r.default._t("CMS.ONLYSELECTTWO","You can only compare two versions at this time.")):(this._select(),
void(1==a.length&&this.parents("form").submit())):(this._select(),a._unselect(),this.parents("form").submit(),void 0)},_unselect:function t(){this.removeClass("active"),this.find(":input[type=checkbox]").attr("checked",!1)
},_select:function t(){this.addClass("active"),this.find(":input[type=checkbox]").attr("checked",!0)}})})},function(t,e,n){"use strict"

View File

@ -49,5 +49,5 @@ if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') {
"URLSEGMENT.OK": "OK",
"URLSEGMENT.UpdateURL": "Update URL",
"WidgetAreaEditor.TOOMANY": "Sorry, you have reached the maximum number of widgets in this area"
});
}
});
}

View File

@ -1,46 +1,17 @@
{
"CMSMAIN.ALERTCLASSNAME": "The page type will be updated after the page is saved",
"CMSMAIN.AddSearchCriteria": "Add Criteria",
"CMSMAIN.CANTADDCHILDREN": "You can't add children to the selected node",
"CMSMAIN.DELETINGPAGES": "Deleting pages...",
"CMSMAIN.ERRORADDINGPAGE": "Error adding page",
"CMSMAIN.ERRORDELETINGPAGES": "Error deleting pages",
"CMSMAIN.ERRORFILTERPAGES": "Could not filter tree to only show changed pages<br \/>%s",
"CMSMAIN.ERRORPUBLISHING": "Error publishing pages",
"CMSMAIN.ERRORREVERTING": "Error reverting to live content",
"CMSMAIN.ERRORUNFILTER": "Unfiltered tree",
"CMSMAIN.FILTEREDTREE": "Filtered tree to only show changed pages",
"CMSMAIN.PUBLISHING": "Publishing...",
"CMSMAIN.PUBLISHINGPAGES": "Publishing pages...",
"CMSMAIN.REALLYDELETEPAGES": "Do you really want to delete the %s marked pages?",
"CMSMAIN.RESTORING": "Restoring...",
"CMSMAIN.SAVING": "saving...",
"CMSMAIN.SELECTMOREPAGES": "You have %s pages selected.\n\nDo you really want to perform this action?",
"CMSMAIN.SELECTONEPAGE": "Please select at least 1 page.",
"CMSMAIN.URLSEGMENTVALIDATION": "URLs can only be made up of letters, digits and hyphens.",
"CMSMAIN.WARNINGSAVEPAGESBEFOREADDING": "You have to save a page before adding children underneath it",
"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.BATCHACTIONSDELETECONFIRM": "Do you really want to delete %s folders?",
"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ConfirmDelete": "Do you really want to delete this folder and all contained files?",
"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.MOVING": "Moving %s file(s)",
"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.REALLYDELETE": "Do you really want to delete the marked files?",
"SilverStripe\\Assets\\Folder.Name": "Folder name",
"SilverStripe\\CMS\\Controllers\\CMSMain.Archive": "Are you sure you want to archive this page and all of its children pages?\n\nThis page and all of its children will be unpublished and sent to the archive.",
"SilverStripe\\CMS\\Controllers\\CMSMain.ConfirmRestoreFromLive": "Are you sure you want to revert draft to when the page was last published?",
"SilverStripe\\CMS\\Controllers\\CMSMain.DeleteFromDraft": "Are you sure you want to remove your page from the draft site?\n\nThis page will remain on the published site.",
"SilverStripe\\CMS\\Controllers\\CMSMain.Restore": "Are you sure you want to restore this page from archive?",
"SilverStripe\\CMS\\Controllers\\CMSMain.RestoreToRoot": "Are you sure you want to restore this page from archive?\n\nBecause the parent page is not available this will be restored to the top level.",
"SilverStripe\\CMS\\Controllers\\CMSMain.RollbackToVersion": "Do you really want to roll back to version #%s of this page?",
"SilverStripe\\CMS\\Controllers\\CMSMain.Unpublish": "Are you sure you want to remove your page from the published site?\n\nThis page will still be available in the sitetree as draft.",
"Tree.AddSubPage": "Add new page here",
"Tree.Duplicate": "Duplicate",
"Tree.EditPage": "Edit",
"Tree.ShowAsList": "Show children as list",
"Tree.ThisPageAndSubpages": "This page and subpages",
"Tree.ThisPageOnly": "This page only",
"Tree.ViewPage": "View",
"URLSEGMENT.Cancel": "Cancel",
"URLSEGMENT.Edit": "Edit",
"URLSEGMENT.OK": "OK",
"URLSEGMENT.UpdateURL": "Update URL",
"WidgetAreaEditor.TOOMANY": "Sorry, you have reached the maximum number of widgets in this area"
"CMS.ALERTCLASSNAME": "The page type will be updated after the page is saved",
"CMS.ConfirmRestoreFromLive": "Are you sure you want to revert draft to when the page was last published?",
"CMS.Restore": "Are you sure you want to restore this page from archive?",
"CMS.RestoreToRoot": "Are you sure you want to restore this page from archive?\n\nBecause the parent page is not available this will be restored to the top level.",
"CMS.RollbackToVersion": "Do you really want to roll back to version #%s of this page?",
"CMS.Unpublish": "Are you sure you want to remove your page from the published site?\n\nThis page will still be available in the sitetree as draft.",
"CMS.AddSubPage": "Add new page here",
"CMS.Duplicate": "Duplicate",
"CMS.EditPage": "Edit",
"CMS.ShowAsList": "Show children as list",
"CMS.ThisPageAndSubpages": "This page and subpages",
"CMS.ThisPageOnly": "This page only",
"CMS.ViewPage": "View",
"CMS.UpdateURL": "Update URL",
"CMS.ONLYSELECTTWO": "You can only compare two versions at this time."
}

View File

@ -13,7 +13,7 @@ $.entwine('ss', function($){
$('.cms-edit-form :input[name=ClassName]').entwine({
// Function: onchange
onchange: function() {
alert(i18n._t('CMSMAIN.ALERTCLASSNAME'));
alert(i18n._t('CMS.ALERTCLASSNAME'));
}
});
@ -123,7 +123,7 @@ $.entwine('ss', function($){
// update button
updateURLFromTitle = $('<button />', {
'class': 'update ss-ui-button-small',
'text': i18n._t('URLSEGMENT.UpdateURL'),
'text': i18n._t('CMS.UpdateURL'),
'type': 'button',
'click': function(e) {
e.preventDefault();
@ -282,11 +282,11 @@ $.entwine('ss', function($){
var form = this.parents('form:first'), version = form.find(':input[name=Version]').val(), message = '';
if(version) {
message = i18n.sprintf(
i18n._t('CMSMain.RollbackToVersion'),
i18n._t('CMS.RollbackToVersion'),
version
);
} else {
message = i18n._t('CMSMain.ConfirmRestoreFromLive');
message = i18n._t('CMS.ConfirmRestoreFromLive');
}
if(confirm(message)) {
return this._super(e);
@ -342,7 +342,7 @@ $.entwine('ss', function($){
message = '',
toRoot = this.data('toRoot');
message = i18n.sprintf(
i18n._t(toRoot ? 'CMSMain.RestoreToRoot' : 'CMSMain.Restore'),
i18n._t(toRoot ? 'CMS.RestoreToRoot' : 'CMS.Restore'),
version
);
if(confirm(message)) {
@ -368,7 +368,7 @@ $.entwine('ss', function($){
onclick: function(e) {
var form = this.parents('form:first'), version = form.find(':input[name=Version]').val(), message = '';
message = i18n.sprintf(
i18n._t('CMSMain.Unpublish'),
i18n._t('CMS.Unpublish'),
version
);
if(confirm(message)) {

View File

@ -43,8 +43,8 @@ $.entwine('ss.tree', function($){
var menuitems = {
edit: {
'label': (node.hasClass('edit-disabled')) ?
i18n._t('Tree.EditPage', 'Edit page', 100, 'Used in the context menu when right-clicking on a page node in the CMS tree')
: i18n._t('Tree.ViewPage', 'View page', 100, 'Used in the context menu when right-clicking on a page node in the CMS tree'),
i18n._t('CMS.EditPage', 'Edit page', 100, 'Used in the context menu when right-clicking on a page node in the CMS tree')
: i18n._t('CMS.ViewPage', 'View page', 100, 'Used in the context menu when right-clicking on a page node in the CMS tree'),
'action': function(obj) {
$('.cms-container').entwine('.ss').loadPanel(i18n.sprintf(
self.data('urlEditpage'), obj.data('id')
@ -56,7 +56,7 @@ $.entwine('ss.tree', function($){
// Add "show as list"
if(!node.hasClass('nochildren')) {
menuitems['showaslist'] = {
'label': i18n._t('Tree.ShowAsList'),
'label': i18n._t('CMS.ShowAsList'),
'action': function(obj) {
$('.cms-container').entwine('.ss').loadPanel(
self.data('urlListview') + '&ParentID=' + obj.data('id'),
@ -94,17 +94,17 @@ $.entwine('ss.tree', function($){
if(hasAllowedChildren) {
menuitems['addsubpage'] = {
'label': i18n._t('Tree.AddSubPage', 'Add page under this page', 100, 'Used in the context menu when right-clicking on a page node in the CMS tree'),
'label': i18n._t('CMS.AddSubPage', 'Add page under this page', 100, 'Used in the context menu when right-clicking on a page node in the CMS tree'),
'submenu': menuAllowedChildren
};
}
if (!node.hasClass('edit-disabled')) {
menuitems['duplicate'] = {
'label': i18n._t('Tree.Duplicate'),
'label': i18n._t('CMS.Duplicate'),
'submenu': [
{
'label': i18n._t('Tree.ThisPageOnly'),
'label': i18n._t('CMS.ThisPageOnly'),
'action': function (obj) {
$('.cms-container').entwine('.ss').loadPanel(
$.path.addSearchParams(
@ -114,7 +114,7 @@ $.entwine('ss.tree', function($){
);
}
}, {
'label': i18n._t('Tree.ThisPageAndSubpages'),
'label': i18n._t('CMS.ThisPageAndSubpages'),
'action': function (obj) {
$('.cms-container').entwine('.ss').loadPanel(
$.path.addSearchParams(

View File

@ -134,7 +134,7 @@ $.entwine('ss', function($){
else if(compare) {
// check if we have already selected more than two.
if(selected.length > 1) {
return alert(i18n._t('ONLYSELECTTWO', 'You can only compare two versions at this time.'));
return alert(i18n._t('CMS.ONLYSELECTTWO', 'You can only compare two versions at this time.'));
}
this._select();