From 884991e4a0eabb46c08b1875b78d19c5f6dcc18e Mon Sep 17 00:00:00 2001 From: Alexander Jones Date: Thu, 26 Mar 2020 01:54:05 -0500 Subject: [PATCH] Localize numbers before passing to mw.msg This commit localizes numbers before passing to mw.msg. This occurs in two places, the successful replacement count and the error message where too many cells are used in the table tool. The comment above the second call was not correct, as the existing message used a substitution. Bug: T244812 Change-Id: I00f83bd478bc42cb536edceba2bcc9daf0b13b3d --- i18n/en.json | 2 +- modules/jquery.wikiEditor.dialogs.config.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index e8ca3a24..931e319b 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -108,7 +108,7 @@ "wikieditor-toolbar-tool-table-insert": "Insert", "wikieditor-toolbar-tool-table-cancel": "Cancel", "wikieditor-toolbar-tool-table-example-text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut nec purus diam. Sed aliquam imperdiet nunc quis lacinia. Donec rutrum consectetur placerat. Sed volutpat neque non purus faucibus id ultricies enim euismod.", - "wikieditor-toolbar-tool-table-toomany": "Inserting a table with more than $1 {{PLURAL:$1|cells}} is not possible with this dialog.", + "wikieditor-toolbar-tool-table-toomany": "Inserting a table with more than $1 {{PLURAL:$1|cell|cells}} is not possible with this dialog.", "wikieditor-toolbar-tool-table-invalidnumber": "You have not entered a valid number of rows or columns.", "wikieditor-toolbar-tool-table-zero": "You cannot insert a table with zero rows or columns.", "wikieditor-toolbar-tool-replace": "Search and replace", diff --git a/modules/jquery.wikiEditor.dialogs.config.js b/modules/jquery.wikiEditor.dialogs.config.js index 32ed5355..a0751d06 100644 --- a/modules/jquery.wikiEditor.dialogs.config.js +++ b/modules/jquery.wikiEditor.dialogs.config.js @@ -850,9 +850,8 @@ return; } if ( ( rows * cols ) > 1000 ) { - // 1000 is in the English message. The parameter replacement is kept for BC. // eslint-disable-next-line no-alert - alert( mw.msg( 'wikieditor-toolbar-tool-table-toomany', 1000 ) ); + alert( mw.msg( 'wikieditor-toolbar-tool-table-toomany', mw.language.convertNumber( 1000 ) ) ); return; } headerText = mw.msg( 'wikieditor-toolbar-tool-table-example-header' ); @@ -1021,7 +1020,7 @@ } else if ( mode === 'replaceAll' ) { $textarea.textSelection( 'setContents', text.replace( regex, replaceStr ) ); $( '#wikieditor-toolbar-replace-success' ) - .text( mw.msg( 'wikieditor-toolbar-tool-replace-success', match.length ) ) + .text( mw.msg( 'wikieditor-toolbar-tool-replace-success', mw.language.convertNumber( match.length ) ) ) .show(); $( this ).data( 'offset', 0 ); } else {