Crusade against hardcoded English, i18n for everything

Change-Id: Ibc658e5f67a373394a4ba149e9b9003f3803023a
This commit is contained in:
Catrope 2012-06-19 01:30:30 -07:00
parent 6a48f2b829
commit 97a1edfd72
11 changed files with 102 additions and 28 deletions

View file

@ -12,11 +12,34 @@ $messages['en'] = array(
'visualeditor-tooltip-wikitext' => 'Toggle wikitext view',
'visualeditor-tooltip-json' => 'Toggle JSON view',
'visualeditor-tooltip-html' => 'Toggle HTML view',
'visualeditor-tooltip-render' => 'Toggle preview',
'visualeditor-tooltip-render' => 'Toggle preview',
'visualeditor-tooltip-history' => 'Toggle transaction history view',
'visualeditor-tooltip-help' => 'Toggle help view',
'visualeditor-feedback-prompt' => 'Leave feedback',
'visualeditor-feedback-dialog-title' => 'Leave feedback about VisualEditor Sandbox',
'visualeditor-ca-editsource' => 'Edit source',
'visualeditor-linkinspector-title' => 'Edit link',
'visualeditor-linkinspector-label-pagetitle' => 'Page title',
'visualeditor-formatdropdown-title' => 'Change format',
'visualeditor-formatdropdown-format-paragraph' => 'Paragraph',
'visualeditor-formatdropdown-format-heading1' => 'Heading 1',
'visualeditor-formatdropdown-format-heading2' => 'Heading 2',
'visualeditor-formatdropdown-format-heading3' => 'Heading 3',
'visualeditor-formatdropdown-format-heading4' => 'Heading 4',
'visualeditor-formatdropdown-format-heading5' => 'Heading 5',
'visualeditor-formatdropdown-format-heading6' => 'Heading 6',
'visualeditor-formatdropdown-format-preformatted' => 'Preformatted',
'visualeditor-annotationbutton-bold-tooltip' => 'Bold',
'visualeditor-annotationbutton-italic-tooltip' => 'Italic',
'visualeditor-annotationbutton-link-tooltip' => 'Link',
'visualeditor-indentationbutton-indent-tooltip' => 'Increase indentation',
'visualeditor-indentationbutton-outdent-tooltip' => 'Decrease indentation',
'visualeditor-listbutton-number-tooltip' => 'Numbered list',
'visualeditor-listbutton-bullet-tooltip' => 'Bullet list',
'visualeditor-clearbutton-tooltip' => 'Clear formatting',
'visualeditor-historybutton-undo-tooltip' => 'Undo',
'visualeditor-historybutton-redo-tooltip' => 'Redo',
'visualeditor-viewpage-savewarning' => 'Are you sure you want to go back to view mode without saving first?',
);
/** Message documentation (Message documentation)
@ -31,6 +54,29 @@ $messages['qqq'] = array(
'visualeditor-tooltip-render' => 'Tooltip for a toolbar button which activates or deactivates a split view, with the visual editor on the left-hand side, and a dynamically updating preview on the right-hand side. This view is primarily useful for debugging purposes.',
'visualeditor-tooltip-history' => "Tooltip for a toolbar button which activates or deactivates a split view, with the visual editor on the left-hand side, and a history of the user's edit transactions on the right-hand side. This view is primarily useful for debugging purposes.",
'visualeditor-feedback-prompt' => 'A link that opens feedback form in http://www.mediawiki.org/wiki/Special:VisualEditorSandbox',
'visualeditor-ca-editsource' => 'Text for the edit source link in the tab dropdown',
'visualeditor-linkinspector-title' => 'Title of the link inspector dialog',
'visualeditor-linkinspector-label-pagetitle' => 'Label for the text field that holds the link target in the link inspector',
'visualeditor-formatdropdown-tooltip' => 'Tooltip for the formatting dropdown',
'visualeditor-formatdropdown-format-paragraph' => 'Item in the formatting dropdown for paragraphs (normal text)',
'visualeditor-formatdropdown-format-heading1' => 'Item in the formatting dropdown for a level 1 heading',
'visualeditor-formatdropdown-format-heading2' => 'Item in the formatting dropdown for a level 2 heading',
'visualeditor-formatdropdown-format-heading3' => 'Item in the formatting dropdown for a level 3 heading',
'visualeditor-formatdropdown-format-heading4' => 'Item in the formatting dropdown for a level 4 heading',
'visualeditor-formatdropdown-format-heading5' => 'Item in the formatting dropdown for a level 5 heading',
'visualeditor-formatdropdown-format-heading6' => 'Item in the formatting dropdown for a level 6 heading',
'visualeditor-formatdropdown-format-preformatted' => 'Item in the formatting dropdown for preformatted text',
'visualeditor-annotationbutton-bold-tooltip' => 'Tooltip for the bold button',
'visualeditor-annotationbutton-italic-tooltip' => 'Tooltip for the italic button',
'visualeditor-annotationbutton-link-tooltip' => 'Tooltip for the link button',
'visualeditor-indentationbutton-indent-tooltip' => 'Tooltip for the list indent button',
'visualeditor-indentationbutton-outdent-tooltip' => 'Tooltip for the list outdent button',
'visualeditor-listbutton-number-tooltip' => 'Tooltip for the numbered list button',
'visualeditor-listbutton-bullet-tooltip' => 'Tooltip for the bullet list button',
'visualeditor-clearbutton-tooltip' => 'Tooltip for the clear formatting button',
'visualeditor-historybutton-undo-tooltip' => 'Tooltip for the undo button',
'visualeditor-historybutton-redo-tooltip' => 'Tooltip for the redo button',
'visualeditor-viewpage-savewarning' => 'Text shown when the user tries to leave the editor without saving their changes',
);
/** Asturian (asturianu)

View file

@ -111,7 +111,8 @@ $wgResourceModules += array(
'create',
'accesskey-ca-edit',
'tooltip-ca-edit',
'viewsource'
'viewsource',
'visualeditor-ca-editsource'
),
),
'ext.visualEditor.init' => $wgVisualEditorResourceTemplate + array(
@ -256,6 +257,28 @@ $wgResourceModules += array(
'visualeditor-tooltip-history',
'visualeditor-tooltip-help',
'visualeditor',
'visualeditor-linkinspector-tooltip',
'visualeditor-linkinspector-label-pagetitle',
'visualeditor-formatdropdown-tooltip',
'visualeditor-formatdropdown-format-paragraph',
'visualeditor-formatdropdown-format-heading1',
'visualeditor-formatdropdown-format-heading2',
'visualeditor-formatdropdown-format-heading3',
'visualeditor-formatdropdown-format-heading4',
'visualeditor-formatdropdown-format-heading5',
'visualeditor-formatdropdown-format-heading6',
'visualeditor-formatdropdown-format-preformatted',
'visualeditor-annotationbutton-bold-tooltip',
'visualeditor-annotationbutton-italic-tooltip',
'visualeditor-annotationbutton-link-tooltip',
'visualeditor-indentationbutton-indent-tooltip',
'visualeditor-indentationbutton-outdent-tooltip',
'visualeditor-listbutton-number-tooltip',
'visualeditor-listbutton-bullet-tooltip',
'visualeditor-clearbutton-tooltip',
'visualeditor-historybutton-undo-tooltip',
'visualeditor-historybutton-redo-tooltip',
'visualeditor-viewpage-savewarning',
),
)
);

View file

@ -77,12 +77,12 @@ ve.init.ViewPageTarget.saveDialogTemplate = '\
<input type="checkbox" name="minorEdit" \
id="ve-init-viewPageTarget-saveDialog-minorEdit">\
<label class="ve-init-viewPageTarget-saveDialog-minorEdit-label" \
for="ve-init-viewPageTarget-saveDialog-minorEdit">This is a minor edit</label>\
for="ve-init-viewPageTarget-saveDialog-minorEdit"></label>\
<div style="clear:both"></div>\
<input type="checkbox" name="watchList" \
id="ve-init-viewPageTarget-saveDialog-watchList">\
<label class="ve-init-viewPageTarget-saveDialog-watchList-label" \
for="ve-init-viewPageTarget-saveDialog-watchList">Watch this page</label>\
for="ve-init-viewPageTarget-saveDialog-watchList"></label>\
</div>\
<div class="ve-init-viewPageTarget-button ve-init-viewPageTarget-saveDialog-saveButton">\
<span class="ve-init-viewPageTarget-saveDialog-saveButton-label"></span>\
@ -125,7 +125,7 @@ ve.init.ViewPageTarget.prototype.deactivate = function( override ) {
if (
override ||
!this.surface.getModel().getHistory().length ||
confirm( 'Are you sure you want to go back to view mode without saving first?' )
confirm( mw.msg( 'visualeditor-viewpage-savewarning' ) )
) {
this.deactivating = true;
// User interface changes
@ -373,7 +373,7 @@ ve.init.ViewPageTarget.prototype.setupSkinTabs = function() {
mw.util.addPortletLink(
'p-cactions',
this.editUri,
'Edit Source', // TODO: i18n
mw.msg( 'visualeditor-ca-editsource' ),
'ca-editsource'
);
}

View file

@ -11,8 +11,13 @@ ve.ui.LinkInspector = function( toolbar, context ) {
// Properties
this.$clearButton = $( '<div class="es-inspector-button es-inspector-clearButton"></div>' )
.prependTo( this.$ );
this.$.prepend( '<div class="es-inspector-title">Edit link</div>' );
this.$locationLabel = $( '<label>Page title</label>' ).appendTo( this.$form );
this.$.prepend(
$( '<div class="es-inspector-title"></div>' )
.text( mw.msg( 'visualeditor-linkinspector-title' ) )
);
this.$locationLabel = $( '<label></label>' )
.text( mw.msg( 'visualeditor-linkinspector-label-pagetitle' ) )
.appendTo( this.$form );
this.$locationInput = $( '<input type="text">' ).appendTo( this.$form );
this.initialValue = null;

View file

@ -63,7 +63,7 @@ ve.ui.AnnotationButtonTool.prototype.updateState = function( annotations, nodes
ve.ui.Tool.tools.bold = {
'constructor': ve.ui.AnnotationButtonTool,
'name': 'bold',
'title': 'Bold (ctrl/cmd + B)',
'title': mw.msg( 'visualeditor-annotationbutton-bold-tooltip' ),
'data': {
'annotation': { 'type': 'textStyle/bold' }
}
@ -72,7 +72,7 @@ ve.ui.Tool.tools.bold = {
ve.ui.Tool.tools.italic = {
'constructor': ve.ui.AnnotationButtonTool,
'name': 'italic',
'title': 'Italic (ctrl/cmd + I)',
'title': mw.msg( 'visualeditor-annotationbutton-italic-tooltip' ),
'data': {
'annotation': { 'type': 'textStyle/italic' }
}
@ -81,7 +81,7 @@ ve.ui.Tool.tools.italic = {
ve.ui.Tool.tools.link = {
'constructor': ve.ui.AnnotationButtonTool,
'name': 'link',
'title': 'Link (ctrl/cmd + K)',
'title': mw.msg( 'visualeditor-annotationbutton-link-tooltip' ),
'data': {
'annotation': { 'type': 'link/wikiLink', 'data': { 'title': '' } },
'inspector': 'link'

View file

@ -50,7 +50,7 @@ ve.ui.ClearButtonTool.prototype.updateState = function( annotations ) {
ve.ui.Tool.tools.clear = {
'constructor': ve.ui.ClearButtonTool,
'name': 'clear',
'title': 'Clear formatting'
'title': mw.msg( 'visualeditor-clearbutton-tooltip' )
};
/* Inheritance */

View file

@ -13,48 +13,48 @@ ve.FormatDropdownTool = function( toolbar, name, title ) {
ve.ui.DropdownTool.call( this, toolbar, name, title, [
{
'name': 'paragraph',
'label': 'Paragraph',
'label': mw.msg( 'visualeditor-formatdropdown-format-paragraph' ),
'type' : 'paragraph'
},
{
'name': 'heading-1',
'label': 'Heading 1',
'label': mw.msg( 'visualeditor-formatdropdown-format-heading1' ),
'type' : 'heading',
'attributes': { 'level': 1 }
},
{
'name': 'heading-2',
'label': 'Heading 2',
'label': mw.msg( 'visualeditor-formatdropdown-format-heading2' ),
'type' : 'heading',
'attributes': { 'level': 2 }
},
{
'name': 'heading-3',
'label': 'Heading 3',
'label': mw.msg( 'visualeditor-formatdropdown-format-heading3' ),
'type' : 'heading',
'attributes': { 'level': 3 }
},
{
'name': 'heading-4',
'label': 'Heading 4',
'label': mw.msg( 'visualeditor-formatdropdown-format-heading4' ),
'type' : 'heading',
'attributes': { 'level': 4 }
},
{
'name': 'heading-5',
'label': 'Heading 5',
'label': mw.msg( 'visualeditor-formatdropdown-format-heading5' ),
'type' : 'heading',
'attributes': { 'level': 5 }
},
{
'name': 'heading-6',
'label': 'Heading 6',
'label': mw.msg( 'visualeditor-formatdropdown-format-heading6' ),
'type' : 'heading',
'attributes': { 'level': 6 }
},
{
'name': 'preformatted',
'label': 'Preformatted',
'label': mw.msg( 'visualeditor-formatdropdown-format-preformatted' ),
'type' : 'preformatted'
}
] );
@ -115,7 +115,7 @@ ve.FormatDropdownTool.prototype.updateState = function( annotations, nodes ) {
ve.ui.Tool.tools.format = {
'constructor': ve.FormatDropdownTool,
'name': 'format',
'title': 'Change format'
'title': mw.msg( 'visualeditor-formatdropdown-tooltip' )
};
/* Inheritance */

View file

@ -60,13 +60,13 @@ ve.ui.HistoryButtonTool.prototype.updateState = function( annotations ) {
ve.ui.Tool.tools.undo = {
'constructor': ve.ui.HistoryButtonTool,
'name': 'undo',
'title': 'Undo (ctrl/cmd + Z)'
'title': mw.msg( 'visualeditor-historybutton-undo-tooltip' )
};
ve.ui.Tool.tools.redo = {
'constructor': ve.ui.HistoryButtonTool,
'name': 'redo',
'title': 'Redo (ctrl/cmd + shift + Z)'
'title': mw.msg( 'visualeditor-historybutton-redo-tooltip' )
};
/* Inhertiance */

View file

@ -101,13 +101,13 @@ ve.ui.IndentationButtonTool.prototype.updateState = function( annotations, nodes
ve.ui.Tool.tools.indent = {
'constructor': ve.ui.IndentationButtonTool,
'name': 'indent',
'title': 'Increase indentation'
'title': mw.msg( 'visualeditor-indentationbutton-indent-tooltip' ),
};
ve.ui.Tool.tools.outdent = {
'constructor': ve.ui.IndentationButtonTool,
'name': 'outdent',
'title': 'Reduce indentation'
'title': mw.msg( 'visualeditor-indentationbutton-outdent-tooltip' ),
};
/* Inheritance */

View file

@ -129,13 +129,13 @@ ve.ui.ListButtonTool.prototype.updateState = function( annotations, nodes ) {
ve.ui.Tool.tools.number = {
'constructor': ve.ui.ListButtonTool,
'name': 'number',
'title': 'Numbered list'
'title': mw.msg( 'visualeditor-listbutton-number-tooltip' ),
};
ve.ui.Tool.tools.bullet = {
'constructor': ve.ui.ListButtonTool,
'name': 'bullet',
'title': 'Bulleted list'
'title': mw.msg( 'visualeditor-listbutton-bullet-tooltip' ),
};
/* Inheritance */

View file

@ -63,7 +63,7 @@ ve.ui.Menu.prototype.addItem = function( item, before ) {
if ( item.label ) {
item.$ = $( '<div class="es-menuView-item"></div>' )
.attr( 'rel', item.name )
// TODO: i18n time!
// TODO: this should take a labelmsg instead and call mw.msg()
.append( $( '<span></span>' ).text( item.label ) );
} else {
// No label, must be a break