Repository: mockup
Branch: refs/heads/master
Date: 2014-12-20T12:54:44+01:00
Author: Timo Stollenwerk (tisto) <tisto@plone.org>
Commit: https://github.com/plone/mockup/commit/4b777fcbefc616ccbb9f063d5e5c2e1d3af846dc

Revert "Make patterns more generic by loading the i18n catalog in a separate step."

Files changed:
M mockup/js/config.js
M mockup/patterns/formunloadalert/pattern.js
M mockup/patterns/pickadate/pattern.js
M mockup/patterns/preventdoublesubmit/pattern.js
M mockup/patterns/querystring/pattern.js
M mockup/patterns/relateditems/pattern.js
M mockup/patterns/structure/pattern.js
M mockup/patterns/tinymce/pattern.js
M mockup/patterns/upload/pattern.js
D mockup/js/i18n-wrapper.js

diff --git a/mockup/js/config.js b/mockup/js/config.js
index f4224c2..bd58bf7 100644
--- a/mockup/js/config.js
+++ b/mockup/js/config.js
@@ -44,7 +44,6 @@
       'jquery.event.drag': 'lib/jquery.event.drag',
       'jquery.event.drop': 'lib/jquery.event.drop',
       'jquery.form': 'bower_components/jquery-form/jquery.form',
-      'translate': 'js/i18n-wrapper',
       'marked': 'bower_components/marked/lib/marked',
       'mockup-bundles-docs': 'js/bundles/docs',
       'mockup-bundles-filemanager': 'js/bundles/filemanager',
diff --git a/mockup/js/i18n-wrapper.js b/mockup/js/i18n-wrapper.js
deleted file mode 100644
index 72c174b..0000000
--- a/mockup/js/i18n-wrapper.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/* i18n integration.
- *
- * This is a singleton.
- * Configuration is done on the body tag data-i18ncatalogurl attribute
- *     <body data-i18ncatalogurl="/jsi18n">
- *
- *  Or, it'll default to "/jsi18n"
- */
-
-define([
-  'mockup-i18n'
-], function(i18n) {
-  'use strict';
-  i18n.loadCatalog('widgets');
-  return i18n.MessageFactory('widgets');
-});
diff --git a/mockup/patterns/formunloadalert/pattern.js b/mockup/patterns/formunloadalert/pattern.js
index 12c66ba..b48a67d 100644
--- a/mockup/patterns/formunloadalert/pattern.js
+++ b/mockup/patterns/formunloadalert/pattern.js
@@ -30,10 +30,13 @@
 define([
   'jquery',
   'mockup-patterns-base',
-  'translate'
-], function ($, Base, _t) {
+  'mockup-i18n'
+], function ($, Base, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var FormUnloadAlert = Base.extend({
     name: 'formunloadalert',
     _changed : false,       // Stores a listing of raised changes by their key
diff --git a/mockup/patterns/pickadate/pattern.js b/mockup/patterns/pickadate/pattern.js
index c756e88..699ed51 100644
--- a/mockup/patterns/pickadate/pattern.js
+++ b/mockup/patterns/pickadate/pattern.js
@@ -89,10 +89,13 @@ define([
   'picker.date',
   'picker.time',
   'mockup-patterns-select2',
-  'translate'
-], function($, Base, Picker, PickerDate, PickerTime, Select2, _t) {
+  'mockup-i18n'
+], function($, Base, Picker, PickerDate, PickerTime, Select2, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var PickADate = Base.extend({
     name: 'pickadate',
     defaults: {
diff --git a/mockup/patterns/preventdoublesubmit/pattern.js b/mockup/patterns/preventdoublesubmit/pattern.js
index fb80ef0..9997380 100644
--- a/mockup/patterns/preventdoublesubmit/pattern.js
+++ b/mockup/patterns/preventdoublesubmit/pattern.js
@@ -23,10 +23,13 @@
 define([
   'jquery',
   'mockup-patterns-base',
-  'translate'
-], function($, Base, _t) {
+  'mockup-i18n'
+], function($, Base, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var PreventDoubleSubmit = Base.extend({
     name: 'preventdoublesubmit',
     defaults: {
diff --git a/mockup/patterns/querystring/pattern.js b/mockup/patterns/querystring/pattern.js
index 34cbd53..ffd3f3f 100644
--- a/mockup/patterns/querystring/pattern.js
+++ b/mockup/patterns/querystring/pattern.js
@@ -49,10 +49,13 @@ define([
   'mockup-patterns-select2',
   'mockup-patterns-pickadate',
   'select2',
-  'translate'
-], function($, Base, Select2, PickADate, undefined, _t) {
+  'mockup-i18n'
+], function($, Base, Select2, PickADate, undefined, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var Criteria = function() { this.init.apply(this, arguments); };
   Criteria.prototype = {
     defaults: {
diff --git a/mockup/patterns/relateditems/pattern.js b/mockup/patterns/relateditems/pattern.js
index fed64eb..72e3b41 100644
--- a/mockup/patterns/relateditems/pattern.js
+++ b/mockup/patterns/relateditems/pattern.js
@@ -77,10 +77,13 @@ define([
   'mockup-patterns-select2',
   'mockup-utils',
   'mockup-patterns-tree',
-  'translate'
-], function($, _, Base, Select2, utils, Tree, _t) {
+  'mockup-i18n'
+], function($, _, Base, Select2, utils, Tree, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var RelatedItems = Base.extend({
     name: 'relateditems',
     browsing: false,
diff --git a/mockup/patterns/structure/pattern.js b/mockup/patterns/structure/pattern.js
index ea9fe66..0073c9c 100644
--- a/mockup/patterns/structure/pattern.js
+++ b/mockup/patterns/structure/pattern.js
@@ -32,15 +32,18 @@ define([
   'mockup-patterns-base',
   'mockup-utils',
   'mockup-patterns-structure-url/js/views/app',
-  'translate',
+  'mockup-i18n',
   'text!mockup-patterns-structure-url/templates/paging.xml',
   'text!mockup-patterns-structure-url/templates/selection_item.xml',
   'text!mockup-patterns-structure-url/templates/tablerow.xml',
   'text!mockup-patterns-structure-url/templates/table.xml',
   'text!mockup-ui-url/templates/popover.xml',
-], function($, Base, utils, AppView, _t) {
+], function($, Base, utils, AppView, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _ = i18n.MessageFactory('widgets');
+
   var Structure = Base.extend({
     name: 'structure',
     defaults: {
@@ -63,26 +66,26 @@ define([
         'review_state'
       ],
       availableColumns: {
-        'ModificationDate': _t('Last modified'),
-        'EffectiveDate': _t('Published'),
-        'CreationDate': _t('Created'),
-        'review_state': _t('Review state'),
-        'Subject': _t('Tags'),
-        'Type': _t('Type'),
-        'is_folderish': _t('Folder'),
-        'exclude_from_nav': _t('Excluded from nav'),
-        'getObjSize': _t('Object Size'),
-        'last_comment_date': _t('Last comment date'),
-        'total_comments': _t('Total comments')
+        'ModificationDate': _('Last modified'),
+        'EffectiveDate': _('Published'),
+        'CreationDate': _('Created'),
+        'review_state': _('Review state'),
+        'Subject': _('Tags'),
+        'Type': _('Type'),
+        'is_folderish': _('Folder'),
+        'exclude_from_nav': _('Excluded from nav'),
+        'getObjSize': _('Object Size'),
+        'last_comment_date': _('Last comment date'),
+        'total_comments': _('Total comments')
       },
       rearrange: {
         properties: {
-          'id': _t('ID'),
-          'sortable_title': _t('Title'),
-          'modified': _t('Last Modified'),
-          'created': _t('Created on'),
-          'effective': _t('Publication Date'),
-          'Type': _t('Type')
+          'id': _('ID'),
+          'sortable_title': _('Title'),
+          'modified': _('Last Modified'),
+          'created': _('Created on'),
+          'effective': _('Publication Date'),
+          'Type': _('Type')
         },
         url: '/rearrange'
       },
@@ -93,31 +96,31 @@ define([
        */
       buttonGroups: {
         primary: [{
-          title: _t('Cut'),
+          title: _('Cut'),
           url: '/cut'
         },{
-          title: _t('Copy'),
+          title: _('Copy'),
           url: '/copy'
         },{
-          title: _t('Paste'),
+          title: _('Paste'),
           url: '/paste'
         },{
-          title: _t('Delete'),
+          title: _('Delete'),
           url: '/delete',
           context: 'danger',
           icon: 'trash'
         }],
         secondary: [{
-          title: _t('Workflow'),
+          title: _('Workflow'),
           url: '/workflow'
         },{
-          title: _t('Tags'),
+          title: _('Tags'),
           url: '/tags'
         },{
-          title: _t('Properties'),
+          title: _('Properties'),
           url: '/properties'
         },{
-          title: _t('Rename'),
+          title: _('Rename'),
           url: '/rename'
         }]
       },
diff --git a/mockup/patterns/tinymce/pattern.js b/mockup/patterns/tinymce/pattern.js
index 42e4df0..34e1998 100644
--- a/mockup/patterns/tinymce/pattern.js
+++ b/mockup/patterns/tinymce/pattern.js
@@ -58,7 +58,7 @@ define([
   'text!mockup-patterns-tinymce-url/templates/selection.xml',
   'mockup-utils',
   'mockup-patterns-tinymce-url/js/links',
-  'translate',
+  'mockup-i18n',
   'tinymce-modern-theme', 'tinymce-advlist', 'tinymce-anchor', 'tinymce-autolink',
   'tinymce-autoresize', 'tinymce-autosave', 'tinymce-bbcode', 'tinymce-charmap',
   'tinymce-code', 'tinymce-colorpicker', 'tinymce-contextmenu', 'tinymce-directionality',
@@ -73,9 +73,14 @@ define([
 ], function($, _,
             Base, RelatedItems, Modal, tinymce,
             AutoTOC, ResultTemplate, SelectionTemplate,
-            utils, LinkModal, _t) {
+            utils, LinkModal, i18n) {
   'use strict';
 
+
+
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var TinyMCE = Base.extend({
     name: 'tinymce',
     defaults: {
diff --git a/mockup/patterns/upload/pattern.js b/mockup/patterns/upload/pattern.js
index 1f84094..634afe5 100644
--- a/mockup/patterns/upload/pattern.js
+++ b/mockup/patterns/upload/pattern.js
@@ -48,14 +48,17 @@ define([
   'dropzone',
   'text!mockup-patterns-upload-url/templates/upload.xml',
   'text!mockup-patterns-upload-url/templates/preview.xml',
-  'translate'
+  'mockup-i18n'
 ], function($, _, Base, RelatedItems, Dropzone,
-            UploadTemplate, PreviewTemplate, _t) {
+            UploadTemplate, PreviewTemplate, i18n) {
   'use strict';
 
   /* we do not want this plugin to auto discover */
   Dropzone.autoDiscover = false;
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var UploadPattern = Base.extend({
     name: 'upload',
     defaults: {


Repository: mockup
Branch: refs/heads/master
Date: 2014-12-20T13:14:29+01:00
Author: Timo Stollenwerk (tisto) <tisto@plone.org>
Commit: https://github.com/plone/mockup/commit/4c7b323b9610122f9d630ceb1bee4f2943ccc365

Merge pull request #453 from plone/revert-452-i18n-wrapper

Revert "Make patterns more generic by loading the i18n catalog in a sepa...

Files changed:
M mockup/js/config.js
M mockup/patterns/formunloadalert/pattern.js
M mockup/patterns/pickadate/pattern.js
M mockup/patterns/preventdoublesubmit/pattern.js
M mockup/patterns/querystring/pattern.js
M mockup/patterns/relateditems/pattern.js
M mockup/patterns/structure/pattern.js
M mockup/patterns/tinymce/pattern.js
M mockup/patterns/upload/pattern.js
D mockup/js/i18n-wrapper.js

diff --git a/mockup/js/config.js b/mockup/js/config.js
index f4224c2..bd58bf7 100644
--- a/mockup/js/config.js
+++ b/mockup/js/config.js
@@ -44,7 +44,6 @@
       'jquery.event.drag': 'lib/jquery.event.drag',
       'jquery.event.drop': 'lib/jquery.event.drop',
       'jquery.form': 'bower_components/jquery-form/jquery.form',
-      'translate': 'js/i18n-wrapper',
       'marked': 'bower_components/marked/lib/marked',
       'mockup-bundles-docs': 'js/bundles/docs',
       'mockup-bundles-filemanager': 'js/bundles/filemanager',
diff --git a/mockup/js/i18n-wrapper.js b/mockup/js/i18n-wrapper.js
deleted file mode 100644
index 72c174b..0000000
--- a/mockup/js/i18n-wrapper.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/* i18n integration.
- *
- * This is a singleton.
- * Configuration is done on the body tag data-i18ncatalogurl attribute
- *     <body data-i18ncatalogurl="/jsi18n">
- *
- *  Or, it'll default to "/jsi18n"
- */
-
-define([
-  'mockup-i18n'
-], function(i18n) {
-  'use strict';
-  i18n.loadCatalog('widgets');
-  return i18n.MessageFactory('widgets');
-});
diff --git a/mockup/patterns/formunloadalert/pattern.js b/mockup/patterns/formunloadalert/pattern.js
index 12c66ba..b48a67d 100644
--- a/mockup/patterns/formunloadalert/pattern.js
+++ b/mockup/patterns/formunloadalert/pattern.js
@@ -30,10 +30,13 @@
 define([
   'jquery',
   'mockup-patterns-base',
-  'translate'
-], function ($, Base, _t) {
+  'mockup-i18n'
+], function ($, Base, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var FormUnloadAlert = Base.extend({
     name: 'formunloadalert',
     _changed : false,       // Stores a listing of raised changes by their key
diff --git a/mockup/patterns/pickadate/pattern.js b/mockup/patterns/pickadate/pattern.js
index c756e88..699ed51 100644
--- a/mockup/patterns/pickadate/pattern.js
+++ b/mockup/patterns/pickadate/pattern.js
@@ -89,10 +89,13 @@ define([
   'picker.date',
   'picker.time',
   'mockup-patterns-select2',
-  'translate'
-], function($, Base, Picker, PickerDate, PickerTime, Select2, _t) {
+  'mockup-i18n'
+], function($, Base, Picker, PickerDate, PickerTime, Select2, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var PickADate = Base.extend({
     name: 'pickadate',
     defaults: {
diff --git a/mockup/patterns/preventdoublesubmit/pattern.js b/mockup/patterns/preventdoublesubmit/pattern.js
index fb80ef0..9997380 100644
--- a/mockup/patterns/preventdoublesubmit/pattern.js
+++ b/mockup/patterns/preventdoublesubmit/pattern.js
@@ -23,10 +23,13 @@
 define([
   'jquery',
   'mockup-patterns-base',
-  'translate'
-], function($, Base, _t) {
+  'mockup-i18n'
+], function($, Base, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var PreventDoubleSubmit = Base.extend({
     name: 'preventdoublesubmit',
     defaults: {
diff --git a/mockup/patterns/querystring/pattern.js b/mockup/patterns/querystring/pattern.js
index 34cbd53..ffd3f3f 100644
--- a/mockup/patterns/querystring/pattern.js
+++ b/mockup/patterns/querystring/pattern.js
@@ -49,10 +49,13 @@ define([
   'mockup-patterns-select2',
   'mockup-patterns-pickadate',
   'select2',
-  'translate'
-], function($, Base, Select2, PickADate, undefined, _t) {
+  'mockup-i18n'
+], function($, Base, Select2, PickADate, undefined, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var Criteria = function() { this.init.apply(this, arguments); };
   Criteria.prototype = {
     defaults: {
diff --git a/mockup/patterns/relateditems/pattern.js b/mockup/patterns/relateditems/pattern.js
index fed64eb..72e3b41 100644
--- a/mockup/patterns/relateditems/pattern.js
+++ b/mockup/patterns/relateditems/pattern.js
@@ -77,10 +77,13 @@ define([
   'mockup-patterns-select2',
   'mockup-utils',
   'mockup-patterns-tree',
-  'translate'
-], function($, _, Base, Select2, utils, Tree, _t) {
+  'mockup-i18n'
+], function($, _, Base, Select2, utils, Tree, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var RelatedItems = Base.extend({
     name: 'relateditems',
     browsing: false,
diff --git a/mockup/patterns/structure/pattern.js b/mockup/patterns/structure/pattern.js
index ea9fe66..0073c9c 100644
--- a/mockup/patterns/structure/pattern.js
+++ b/mockup/patterns/structure/pattern.js
@@ -32,15 +32,18 @@ define([
   'mockup-patterns-base',
   'mockup-utils',
   'mockup-patterns-structure-url/js/views/app',
-  'translate',
+  'mockup-i18n',
   'text!mockup-patterns-structure-url/templates/paging.xml',
   'text!mockup-patterns-structure-url/templates/selection_item.xml',
   'text!mockup-patterns-structure-url/templates/tablerow.xml',
   'text!mockup-patterns-structure-url/templates/table.xml',
   'text!mockup-ui-url/templates/popover.xml',
-], function($, Base, utils, AppView, _t) {
+], function($, Base, utils, AppView, i18n) {
   'use strict';
 
+  i18n.loadCatalog('widgets');
+  var _ = i18n.MessageFactory('widgets');
+
   var Structure = Base.extend({
     name: 'structure',
     defaults: {
@@ -63,26 +66,26 @@ define([
         'review_state'
       ],
       availableColumns: {
-        'ModificationDate': _t('Last modified'),
-        'EffectiveDate': _t('Published'),
-        'CreationDate': _t('Created'),
-        'review_state': _t('Review state'),
-        'Subject': _t('Tags'),
-        'Type': _t('Type'),
-        'is_folderish': _t('Folder'),
-        'exclude_from_nav': _t('Excluded from nav'),
-        'getObjSize': _t('Object Size'),
-        'last_comment_date': _t('Last comment date'),
-        'total_comments': _t('Total comments')
+        'ModificationDate': _('Last modified'),
+        'EffectiveDate': _('Published'),
+        'CreationDate': _('Created'),
+        'review_state': _('Review state'),
+        'Subject': _('Tags'),
+        'Type': _('Type'),
+        'is_folderish': _('Folder'),
+        'exclude_from_nav': _('Excluded from nav'),
+        'getObjSize': _('Object Size'),
+        'last_comment_date': _('Last comment date'),
+        'total_comments': _('Total comments')
       },
       rearrange: {
         properties: {
-          'id': _t('ID'),
-          'sortable_title': _t('Title'),
-          'modified': _t('Last Modified'),
-          'created': _t('Created on'),
-          'effective': _t('Publication Date'),
-          'Type': _t('Type')
+          'id': _('ID'),
+          'sortable_title': _('Title'),
+          'modified': _('Last Modified'),
+          'created': _('Created on'),
+          'effective': _('Publication Date'),
+          'Type': _('Type')
         },
         url: '/rearrange'
       },
@@ -93,31 +96,31 @@ define([
        */
       buttonGroups: {
         primary: [{
-          title: _t('Cut'),
+          title: _('Cut'),
           url: '/cut'
         },{
-          title: _t('Copy'),
+          title: _('Copy'),
           url: '/copy'
         },{
-          title: _t('Paste'),
+          title: _('Paste'),
           url: '/paste'
         },{
-          title: _t('Delete'),
+          title: _('Delete'),
           url: '/delete',
           context: 'danger',
           icon: 'trash'
         }],
         secondary: [{
-          title: _t('Workflow'),
+          title: _('Workflow'),
           url: '/workflow'
         },{
-          title: _t('Tags'),
+          title: _('Tags'),
           url: '/tags'
         },{
-          title: _t('Properties'),
+          title: _('Properties'),
           url: '/properties'
         },{
-          title: _t('Rename'),
+          title: _('Rename'),
           url: '/rename'
         }]
       },
diff --git a/mockup/patterns/tinymce/pattern.js b/mockup/patterns/tinymce/pattern.js
index 42e4df0..34e1998 100644
--- a/mockup/patterns/tinymce/pattern.js
+++ b/mockup/patterns/tinymce/pattern.js
@@ -58,7 +58,7 @@ define([
   'text!mockup-patterns-tinymce-url/templates/selection.xml',
   'mockup-utils',
   'mockup-patterns-tinymce-url/js/links',
-  'translate',
+  'mockup-i18n',
   'tinymce-modern-theme', 'tinymce-advlist', 'tinymce-anchor', 'tinymce-autolink',
   'tinymce-autoresize', 'tinymce-autosave', 'tinymce-bbcode', 'tinymce-charmap',
   'tinymce-code', 'tinymce-colorpicker', 'tinymce-contextmenu', 'tinymce-directionality',
@@ -73,9 +73,14 @@ define([
 ], function($, _,
             Base, RelatedItems, Modal, tinymce,
             AutoTOC, ResultTemplate, SelectionTemplate,
-            utils, LinkModal, _t) {
+            utils, LinkModal, i18n) {
   'use strict';
 
+
+
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var TinyMCE = Base.extend({
     name: 'tinymce',
     defaults: {
diff --git a/mockup/patterns/upload/pattern.js b/mockup/patterns/upload/pattern.js
index 1f84094..634afe5 100644
--- a/mockup/patterns/upload/pattern.js
+++ b/mockup/patterns/upload/pattern.js
@@ -48,14 +48,17 @@ define([
   'dropzone',
   'text!mockup-patterns-upload-url/templates/upload.xml',
   'text!mockup-patterns-upload-url/templates/preview.xml',
-  'translate'
+  'mockup-i18n'
 ], function($, _, Base, RelatedItems, Dropzone,
-            UploadTemplate, PreviewTemplate, _t) {
+            UploadTemplate, PreviewTemplate, i18n) {
   'use strict';
 
   /* we do not want this plugin to auto discover */
   Dropzone.autoDiscover = false;
 
+  i18n.loadCatalog('widgets');
+  var _t = i18n.MessageFactory('widgets');
+
   var UploadPattern = Base.extend({
     name: 'upload',
     defaults: {