Bartosz Dziewoński has uploaded a new change for review. https://gerrit.wikimedia.org/r/300799
Change subject: Improve errors about invalid filenames ...................................................................... Improve errors about invalid filenames We had two different error messages about invalid filenames. One was awful, the other pretty good but incomplete. This replaces them with one. Message changes: * 'mwe-upwiz-error-title-badchars' removed. * 'mwe-upwiz-unparseable-title' renamed to 'mwe-upwiz-error-title-invalid' with minor changes (translations are compatible, but should be fuzzied). Bug: T140222 Change-Id: I9caab08b2fc78ffbd2568ced03296cdcf9acc40c --- M extension.json M i18n/en.json M i18n/qqq.json M resources/details/uw.TitleDetailsWidget.js M resources/mw.QuickTitleChecker.js M resources/mw.UploadWizardDetails.js 6 files changed, 9 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard refs/changes/99/300799/1 diff --git a/extension.json b/extension.json index 65e2c89..22b724c 100644 --- a/extension.json +++ b/extension.json @@ -441,9 +441,9 @@ "mwe-upwiz-error-too-short", "mwe-upwiz-error-bad-descriptions", "mwe-upwiz-error-title-blacklisted", - "mwe-upwiz-error-title-badchars", "mwe-upwiz-error-title-senselessimagename", "mwe-upwiz-error-title-hosting", + "mwe-upwiz-error-title-invalid", "mwe-upwiz-error-title-thumbnail", "mwe-upwiz-error-title-fileexists-shared-forbidden", "mwe-upwiz-error-title-double-apostrophe", @@ -519,7 +519,6 @@ "mwe-upwiz-categories-missing", "mwe-upwiz-thumbnail-failed", "mwe-upwiz-unparseable-filename", - "mwe-upwiz-unparseable-title", "mwe-upwiz-subhead-bugs", "mwe-upwiz-subhead-alt-upload", "mwe-upwiz-subhead-alternatives", diff --git a/i18n/en.json b/i18n/en.json index 65a390b..3ef67c8 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -211,7 +211,6 @@ "mwe-upwiz-error-too-short": "This entry is too short.\nPlease make sure this entry is at least $1 {{PLURAL:$1|character|characters}}.", "mwe-upwiz-error-bad-descriptions": "There are problems with some of the descriptions.", "mwe-upwiz-error-title-blacklisted": "This title contains some undesirable text. Please revise it.", - "mwe-upwiz-error-title-badchars": "This title contains some undesirable characters. Please remove them.", "mwe-upwiz-error-title-senselessimagename": "Please make this title more meaningful.", "mwe-upwiz-error-title-hosting": "This looks like a file you obtained from another image host. Please make the title more meaningful. Also, double check that you have the rights to publish it on this site.", "mwe-upwiz-error-title-thumbnail": "This looks like a thumbnail title. Please do not upload thumbnails back to the same wiki. Otherwise, please fix the filename so it is more meaningful, and does not have the thumbnail prefix.", @@ -304,7 +303,7 @@ "mwe-upwiz-categories-missing": "One of the categories lacks a description page. Are you sure you typed the name correctly?", "mwe-upwiz-thumbnail-failed": "The upload succeeded, but the server could not get a preview thumbnail.", "mwe-upwiz-unparseable-filename": "Could not understand the filename \"$1\".", - "mwe-upwiz-unparseable-title": "This title is invalid. Make sure to remove characters like square brackets, colons, comparison operators, pipes and curly brackets.", + "mwe-upwiz-error-title-invalid": "This title is invalid. Make sure to remove characters like square brackets, colons, slashes, comparison operators, pipes and curly brackets.", "mwe-upwiz-subhead-bugs": "[$1 Known issues]", "mwe-upwiz-subhead-alt-upload": "Back to the old form", "mwe-upwiz-subhead-alternatives": "Alternative upload methods", diff --git a/i18n/qqq.json b/i18n/qqq.json index d6ea2a9..1d522af 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -235,7 +235,6 @@ "mwe-upwiz-error-too-short": "Used as error message. Parameters:\n* $1 - minimum number of characters\nSee also:\n* {{msg-mw|Mwe-upwiz-error-too-long}}", "mwe-upwiz-error-bad-descriptions": "Used as error message.", "mwe-upwiz-error-title-blacklisted": "Error message shown to the user when they have entered a file name that matches the 'blacklist' of banned words.", - "mwe-upwiz-error-title-badchars": "Error message shown to the user when they have entered a file name that matches the 'blacklist' of banned characters.", "mwe-upwiz-error-title-senselessimagename": "Error message shown to the user when they have entered a file name that looks like an automatic name rather than a useful one.", "mwe-upwiz-error-title-hosting": "Appears when the upload title is similar to another site's default format for downloads - like Flickr.", "mwe-upwiz-error-title-thumbnail": "Appears when thumbnail title is similar to \"22px-Example.jpg\" - the prefix is what MW adds when downloading pictures as thumbnails.", @@ -328,7 +327,7 @@ "mwe-upwiz-categories-missing": "Used to let the user know that the category they entered does not have a description page, and thus is likely unused and not what they meant. Displayed as a tooltip.\n\nSee also:\n* {{msg-mw|visualeditor-dialog-meta-categories-missing}}", "mwe-upwiz-thumbnail-failed": "Error shown when no upload preview could be fetched from the server.", "mwe-upwiz-unparseable-filename": "Used as error message. Parameters:\n* $1 - filename", - "mwe-upwiz-unparseable-title": "Used as error message. More information about page titles [[:mw:Manual:Page title|at MediaWiki.org]].", + "mwe-upwiz-error-title-invalid": "Used as error message. More information about page titles [[:mw:Manual:Page title|at MediaWiki.org]].", "mwe-upwiz-subhead-bugs": "Unused at this time. Parameters:\n* $1 - full URL\n{{Identical|Known issue}}", "mwe-upwiz-subhead-alt-upload": "Used as a link in the sub-header. Will go to an alternate upload form.", "mwe-upwiz-subhead-alternatives": "Used as a link in the sub-header. Will go to a page that lists upload tools.", diff --git a/resources/details/uw.TitleDetailsWidget.js b/resources/details/uw.TitleDetailsWidget.js index 6a46c2b..9a46a51 100644 --- a/resources/details/uw.TitleDetailsWidget.js +++ b/resources/details/uw.TitleDetailsWidget.js @@ -100,7 +100,7 @@ } if ( !title ) { - errors.push( mw.message( 'mwe-upwiz-unparseable-title' ) ); + errors.push( mw.message( 'mwe-upwiz-error-title-invalid' ) ); return $.Deferred().resolve( errors ).promise(); } @@ -112,7 +112,7 @@ moreErrors = moreErrors.concat( mw.QuickTitleChecker.checkTitle( title.getNameText() ).map( function ( errorCode ) { // Messages: - // mwe-upwiz-error-title-badchars, mwe-upwiz-error-title-senselessimagename, + // mwe-upwiz-error-title-invalid, mwe-upwiz-error-title-senselessimagename, // mwe-upwiz-error-title-thumbnail, mwe-upwiz-error-title-extension, return mw.message( 'mwe-upwiz-error-title-' + errorCode ); } ) @@ -150,7 +150,7 @@ titleString = uw.TitleDetailsWidget.static.makeTitleInFileNS( titleString ).getPrefixedText(); } catch ( e ) { // Unparseable result? This shouldn't happen, we checked for that earlier... - errors.push( mw.message( 'mwe-upwiz-unparseable-title' ) ); + errors.push( mw.message( 'mwe-upwiz-error-title-invalid' ) ); return errors; } diff --git a/resources/mw.QuickTitleChecker.js b/resources/mw.QuickTitleChecker.js index 9dc4a19..7bd068c 100644 --- a/resources/mw.QuickTitleChecker.js +++ b/resources/mw.QuickTitleChecker.js @@ -20,7 +20,7 @@ mw.QuickTitleChecker.regexSets = { - badchars: [ + invalid: [ /[\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]/, // NBSP and other unusual spaces /[\u202A-\u202E]/, // BiDi overrides /[\x00-\x1f]/, // Control characters @@ -66,7 +66,7 @@ * * @param {string} title * @return {string[]} Array of error codes; if it's empty, the title is acceptable. - * Possible error codes are 'badchars', 'senselessimagename', 'thumbnail', 'extension'. + * Possible error codes are 'invalid', 'senselessimagename', 'thumbnail', 'extension'. */ mw.QuickTitleChecker.checkTitle = function ( title ) { var errors = []; diff --git a/resources/mw.UploadWizardDetails.js b/resources/mw.UploadWizardDetails.js index 10ec494..0b7617f 100644 --- a/resources/mw.UploadWizardDetails.js +++ b/resources/mw.UploadWizardDetails.js @@ -861,7 +861,7 @@ if ( warnings.thumb || warnings[ 'thumb-name' ] ) { this.recoverFromError( mw.message( 'mwe-upwiz-error-title-thumbnail' ), 'error-title-thumbnail' ); } else if ( warnings.badfilename ) { - this.recoverFromError( mw.message( 'mwe-upwiz-error-title-badchars' ), 'title-badchars' ); + this.recoverFromError( mw.message( 'mwe-upwiz-error-title-invalid' ), 'title-invalid' ); } else if ( warnings[ 'bad-prefix' ] ) { this.recoverFromError( mw.message( 'mwe-upwiz-error-title-senselessimagename' ), 'title-senselessimagename' ); } else if ( existingFile ) { -- To view, visit https://gerrit.wikimedia.org/r/300799 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9caab08b2fc78ffbd2568ced03296cdcf9acc40c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/UploadWizard Gerrit-Branch: master Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits