From 58193750224d23d5f36d0331030c26525a414a68 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Sat, 25 May 2013 12:01:32 +0200 Subject: [PATCH] Internationalisation for the metadata dialog Change-Id: Iefb6d5c90583f0684cb9548d38b83048b43d3c81 --- VisualEditor.i18n.php | 26 +++++++++++++++---- VisualEditor.php | 12 +++++++-- modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js | 15 +++++------ .../ui/widgets/ve.ui.MWCategoryInputWidget.js | 8 +++--- .../ui/widgets/ve.ui.MWCategoryPopupWidget.js | 2 +- 5 files changed, 43 insertions(+), 20 deletions(-) diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php index 5b6d8e6b98..d18f410f3e 100644 --- a/VisualEditor.i18n.php +++ b/VisualEditor.i18n.php @@ -25,8 +25,6 @@ $messages['en'] = array( 'visualeditor-ca-createsource' => 'Create source', 'visualeditor-ca-ve-edit' => 'VisualEditor', 'visualeditor-ca-ve-create' => 'VisualEditor', - 'visualeditor-category-input-placeholder' => 'Add category', - 'visualeditor-category-settings-label' => 'Category settings', 'visualeditor-dialog-meta-title' => 'Page settings', 'visualeditor-dialog-content-title' => 'Content settings', 'visualeditor-dialog-media-title' => 'Media settings', @@ -81,6 +79,16 @@ $messages['en'] = array( 'visualeditor-historybutton-redo-tooltip' => 'Redo', 'visualeditor-inspector-close-tooltip' => 'Close', 'visualeditor-inspector-remove-tooltip' => 'Remove', + 'visualeditor-dialog-meta-categories-section' => 'Categories', + 'visualeditor-dialog-meta-categories-data-label' => 'Categories', + 'visualeditor-dialog-meta-categories-settings-label' => 'Category settings', + 'visualeditor-dialog-meta-categories-input-placeholder' => 'Add category', + 'visualeditor-dialog-meta-categories-input-newcategorylabel' => 'New category', + 'visualeditor-dialog-meta-categories-input-movecategorylabel' => 'Move this category here', + 'visualeditor-dialog-meta-categories-input-matchingcategorieslabel' => 'Matching categories', + 'visualeditor-dialog-meta-categories-sortkey-label' => 'Page name in category', + 'visualeditor-dialog-meta-categories-defaultsort-label' => 'Default page name on category page', + 'visualeditor-dialog-meta-langlinks-section' => 'Languages', 'visualeditor-viewpage-savewarning' => 'Are you sure you want to go back to view mode without saving first?', 'visualeditor-loadwarning' => 'Error loading data from server: $1. Would you like to retry?', 'visualeditor-loadwarning-token' => 'Error loading edit token from server: $1. Would you like to retry?', @@ -145,9 +153,6 @@ If the page exists, the following link text is used: {{msg-mw|Visualeditor-ca-ed 'visualeditor-ca-ve-create' => ' Link text of the dedicated VisualEditor Create tab. {{Identical|visualeditor}}', - 'visualeditor-category-input-placeholder' => 'Placeholder text for category input -{{Identical|Add category}}', - 'visualeditor-category-settings-label' => 'Title of category settings popup menu', 'visualeditor-dialog-meta-title' => 'MetaData dialog title text', 'visualeditor-dialog-content-title' => 'Content dialog title text', 'visualeditor-dialog-media-title' => 'Title for the editing dialog to set how a media item is displayed on the page', @@ -216,6 +221,17 @@ See also: {{Identical|Redo}}', 'visualeditor-inspector-close-tooltip' => 'Tooltip for the button to close an inspector', 'visualeditor-inspector-remove-tooltip' => 'Tooltip for the button to remove an annotation in an inspector', + 'visualeditor-dialog-meta-categories-section' => 'Label for the categories dialog section', + 'visualeditor-dialog-meta-categories-data-label' => 'Label for the categories sub-section', + 'visualeditor-dialog-meta-categories-settings-label' => 'Label for the category settings sub-section', + 'visualeditor-dialog-meta-categories-input-placeholder' => 'Placeholder text for category input +{{Identical|Add category}}', + 'visualeditor-dialog-meta-categories-input-newcategorylabel' => 'Label for suggested categories for an uncreated category', + 'visualeditor-dialog-meta-categories-input-movecategorylabel' => 'Label for moving a given category to end of list', + 'visualeditor-dialog-meta-categories-input-matchingcategorieslabel' => 'Label for matching suggested categories', + 'visualeditor-dialog-meta-categories-sortkey-label' => 'Label for setting the page\'s sort key for a given category', + 'visualeditor-dialog-meta-categories-defaultsort-label' => 'Label for field setting the category default sort', + 'visualeditor-dialog-meta-langlinks-section' => 'Label for the language links dialog section', 'visualeditor-viewpage-savewarning' => 'Text shown when the user tries to leave the editor without saving their changes', 'visualeditor-loadwarning' => 'Text (JavaScript confirm()) shown when the editor fails to load properly. diff --git a/VisualEditor.php b/VisualEditor.php index c43ffd1c1f..18f607d40c 100644 --- a/VisualEditor.php +++ b/VisualEditor.php @@ -516,8 +516,16 @@ $wgResourceModules += array( 'visualeditor-dialog-action-apply', 'visualeditor-dialog-action-cancel', 'visualeditor-dialog-action-close', - 'visualeditor-category-input-placeholder', - 'visualeditor-category-settings-label' + 'visualeditor-dialog-meta-categories-section', + 'visualeditor-dialog-meta-categories-data-label', + 'visualeditor-dialog-meta-categories-settings-label', + 'visualeditor-dialog-meta-categories-input-placeholder', + 'visualeditor-dialog-meta-categories-input-newcategorylabel', + 'visualeditor-dialog-meta-categories-input-movecategorylabel', + 'visualeditor-dialog-meta-categories-input-matchingcategorieslabel', + 'visualeditor-dialog-meta-categories-sortkey-label', + 'visualeditor-dialog-meta-categories-defaultsort-label', + 'visualeditor-dialog-meta-langlinks-section', ), ), 'ext.visualEditor.experimental' => $wgVisualEditorResourceTemplate + array( diff --git a/modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js b/modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js index dd016ca624..5dfa2eb40e 100644 --- a/modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js +++ b/modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js @@ -56,10 +56,10 @@ ve.ui.MWMetaDialog.prototype.initialize = function () { // Properties this.categoriesFieldset = new ve.ui.FieldsetLayout( { - '$$': this.frame.$$, 'label': 'Categories', 'icon': 'tag' + '$$': this.frame.$$, 'label': ve.msg( 'visualeditor-dialog-meta-categories-data-label' ), 'icon': 'tag' } ); this.categorySettingsFieldset = new ve.ui.FieldsetLayout( { - '$$': this.frame.$$, 'label': 'Category settings', 'icon': 'settings' + '$$': this.frame.$$, 'label': ve.msg( 'visualeditor-dialog-meta-categories-settings-label' ), 'icon': 'settings' } ); this.categoryWidget = new ve.ui.MWCategoryWidget( { '$$': this.frame.$$, '$overlay': this.surface.$globalOverlay @@ -70,7 +70,7 @@ ve.ui.MWMetaDialog.prototype.initialize = function () { this.defaultSortLabel = new ve.ui.InputLabelWidget( { '$$': this.frame.$$, 'input': this.defaultSortInput, - 'label': 'Default page name on category page' + 'label': ve.msg( 'visualeditor-dialog-meta-categories-defaultsort-label' ) } ); // Events @@ -84,14 +84,13 @@ ve.ui.MWMetaDialog.prototype.initialize = function () { // Initialization this.categoryWidget.addItems( this.getCategoryItems() ); - this.addPage( 'categories', 'Categories', 'tag' ); + this.addPage( 'categories', ve.msg( 'visualeditor-dialog-meta-categories-section' ), 'tag' ); // TODO: Implement language editing. Load page with: - // .addPage( 'languages', 'Languages', 'language' ); + // .addPage( 'languages', ve.msg( 'visualeditor-dialog-meta-langlinks-section' ), 'language' ); + this.pages.categories.$.append( this.categoriesFieldset.$, this.categorySettingsFieldset.$ ); this.categoriesFieldset.$.append( this.categoryWidget.$ ); - this.categorySettingsFieldset.$.append( - this.defaultSortLabel.$, this.defaultSortInput.$ - ); + this.categorySettingsFieldset.$.append( this.defaultSortLabel.$, this.defaultSortInput.$ ); }; /** diff --git a/modules/ve/ui/widgets/ve.ui.MWCategoryInputWidget.js b/modules/ve/ui/widgets/ve.ui.MWCategoryInputWidget.js index 3c0ccd1674..324adca46d 100644 --- a/modules/ve/ui/widgets/ve.ui.MWCategoryInputWidget.js +++ b/modules/ve/ui/widgets/ve.ui.MWCategoryInputWidget.js @@ -22,7 +22,7 @@ ve.ui.MWCategoryInputWidget = function VeUiMWCategoryInputWidget( categoryWidget, config ) { // Config intialization config = ve.extendObject( { - 'placeholder': ve.msg( 'visualeditor-category-input-placeholder' ) + 'placeholder': ve.msg( 'visualeditor-dialog-meta-categories-input-placeholder' ) }, config ); // Parent constructor @@ -134,7 +134,7 @@ ve.ui.MWCategoryInputWidget.prototype.getLookupMenuItemsFromData = function ( da // Add sections for non-empty groups if ( newCategoryItems.length ) { items.push( new ve.ui.MenuSectionItemWidget( - 'newCategory', { '$$': menu$$, 'label': 'New category' } + 'newCategory', { '$$': menu$$, 'label': ve.msg( 'visualeditor-dialog-meta-categories-input-newcategorylabel' ) } ) ); for ( i = 0, len = newCategoryItems.length; i < len; i++ ) { item = newCategoryItems[i]; @@ -143,7 +143,7 @@ ve.ui.MWCategoryInputWidget.prototype.getLookupMenuItemsFromData = function ( da } if ( existingCategoryItems.length ) { items.push( new ve.ui.MenuSectionItemWidget( - 'inArticle', { '$$': menu$$, 'label': 'Move this category here' } + 'inArticle', { '$$': menu$$, 'label': ve.msg( 'visualeditor-dialog-meta-categories-input-movecategorylabel' ) } ) ); for ( i = 0, len = existingCategoryItems.length; i < len; i++ ) { item = existingCategoryItems[i]; @@ -152,7 +152,7 @@ ve.ui.MWCategoryInputWidget.prototype.getLookupMenuItemsFromData = function ( da } if ( matchingCategoryItems.length ) { items.push( new ve.ui.MenuSectionItemWidget( - 'matchingCategories', { '$$': menu$$, 'label': 'Matching categories' } + 'matchingCategories', { '$$': menu$$, 'label': ve.msg( 'visualeditor-dialog-meta-categories-input-matchingcategorieslabel' ) } ) ); for ( i = 0, len = matchingCategories.length; i < len; i++ ) { item = matchingCategories[i]; diff --git a/modules/ve/ui/widgets/ve.ui.MWCategoryPopupWidget.js b/modules/ve/ui/widgets/ve.ui.MWCategoryPopupWidget.js index d3191add83..e0350d5867 100644 --- a/modules/ve/ui/widgets/ve.ui.MWCategoryPopupWidget.js +++ b/modules/ve/ui/widgets/ve.ui.MWCategoryPopupWidget.js @@ -30,7 +30,7 @@ ve.ui.MWCategoryPopupWidget = function VeUiMwCategoryPopupWidget ( config ) { } ); this.sortKeyInput = new ve.ui.TextInputWidget( { '$$': this.$$ } ); this.sortKeyLabel = new ve.ui.InputLabelWidget( - { '$$': this.$$, '$input': this.sortKeyInput, 'label': 'Page name in category' } + { '$$': this.$$, '$input': this.sortKeyInput, 'label': ve.msg ( 'visualeditor-dialog-meta-categories-sortkey-label' ) } ); this.$sortKeyForm = this.$$( '
' ).addClass( 've-ui-mwCategorySortkeyForm' ) .append( this.sortKeyLabel.$, this.sortKeyInput.$ );