From 72cf12a2de751daa67d920dec30e12b74d01cf15 Mon Sep 17 00:00:00 2001 From: WMDE-Fisch Date: Thu, 26 Sep 2024 21:00:06 +0200 Subject: [PATCH] Adjust messages related to sub-referencing Also adding some margin where it made sense looking at the mocks in the message document. Bug: T373876 Change-Id: I1165681521565d900b705a45579fd816fe625a8f --- extension.json | 5 +++++ modules/ve-cite/i18n/en.json | 11 +++++++--- modules/ve-cite/i18n/qqq.json | 11 +++++++--- .../ve-cite/ve.ui.MWReferenceContextItem.js | 2 +- modules/ve-cite/ve.ui.MWReferenceDialog.js | 3 +++ modules/ve-cite/ve.ui.MWReferenceDialog.less | 4 ++++ .../ve.ui.MWSetExtendsContentDialog.js | 22 ++++++------------- .../ve.ui.MWSetExtendsContentDialog.less | 7 ++++-- 8 files changed, 41 insertions(+), 24 deletions(-) diff --git a/extension.json b/extension.json index ff5704b95..f91eee9a9 100644 --- a/extension.json +++ b/extension.json @@ -162,6 +162,9 @@ "cite-ve-citationneeded-description", "cite-ve-citationneeded-reason", "cite-ve-citationneeded-title", + "cite-ve-dialog-reference-contextitem-extends", + "cite-ve-dialog-reference-editing-add-details", + "cite-ve-dialog-reference-editing-add-details-placeholder", "cite-ve-dialog-reference-editing-reused", "cite-ve-dialog-reference-editing-reused-long", "cite-ve-dialog-reference-editing-extends", @@ -172,6 +175,8 @@ "cite-ve-dialog-reference-options-section", "cite-ve-dialog-reference-placeholder", "cite-ve-dialog-reference-title", + "cite-ve-dialog-reference-title-add-details", + "cite-ve-dialog-reference-title-edit-details", "cite-ve-dialog-reference-useexisting-tool", "cite-ve-dialog-referenceslist-contextitem-description-general", "cite-ve-dialog-referenceslist-contextitem-description-named", diff --git a/modules/ve-cite/i18n/en.json b/modules/ve-cite/i18n/en.json index aa2ee2146..bc13a3524 100644 --- a/modules/ve-cite/i18n/en.json +++ b/modules/ve-cite/i18n/en.json @@ -34,16 +34,21 @@ "cite-ve-citationneeded-description": "An editor has indicated that this claim needs a citation to a reliable source.", "cite-ve-citationneeded-reason": "Reason given:", "cite-ve-citationneeded-title": "Citation needed", + "cite-ve-dialog-reference-contextitem-extends": "This reference is a re-use with additional details.", + "cite-ve-dialog-reference-editing-add-details": "You're adding additional details to this reference:", + "cite-ve-dialog-reference-editing-add-details-placeholder": "Write or paste the information you would like to add to this reference here.", "cite-ve-dialog-reference-editing-reused": "This reference is used {{PLURAL:$1|once|2=twice|$1 times}} on this page.", "cite-ve-dialog-reference-editing-reused-long": "This reference is used {{PLURAL:$1|once|2=twice|$1 times}} on this page. Changes made here will be applied in all places where this reference is reused.", - "cite-ve-dialog-reference-editing-extends": "This is an extension of another reference.", - "cite-ve-dialog-reference-missing-parent-ref": "This subreference is missing a parent reference.", + "cite-ve-dialog-reference-editing-extends": "This reference is a re-use with additional details. Here, you can only edit the details.", + "cite-ve-dialog-reference-missing-parent-ref": "The reference that these details are linked to, is missing. Please remove these details from the page or fix the issue in source mode.", "cite-ve-dialog-reference-options-group-label": "Use this group", "cite-ve-dialog-reference-options-group-placeholder": "General references", "cite-ve-dialog-reference-options-responsive-label": "Use responsive column layout", "cite-ve-dialog-reference-options-section": "Options", "cite-ve-dialog-reference-placeholder": "Write or paste your reference here, or insert a citation template.", "cite-ve-dialog-reference-title": "Reference", + "cite-ve-dialog-reference-title-add-details": "Add details to reference", + "cite-ve-dialog-reference-title-edit-details": "Edit additional details", "cite-ve-dialog-reference-useexisting-tool": "Re-use", "cite-ve-dialog-referenceslist-contextitem-description-general": "List of general references", "cite-ve-dialog-referenceslist-contextitem-description-named": "List of references for group \"$1\"", @@ -57,7 +62,7 @@ "cite-ve-reference-input-placeholder": "Search within current citations", "cite-ve-referenceslist-isempty": "There are no references with the group \"$1\" on this page to include in this list.", "cite-ve-referenceslist-isempty-default": "There are no references on this page to include in this list.", - "cite-ve-referenceslist-missing-parent": "There are subreferences with a missing parent reference.", + "cite-ve-referenceslist-missing-parent": "The reference that the details below are linked to, is missing. Please remove these details from the page or fix this issue in source mode.", "cite-ve-referenceslist-missingref": "This reference is defined in a template or other generated block, and for now can only be edited in source mode.", "cite-ve-referenceslist-missingref-in-list": "This reference is defined in a template or other generated block, and for now can only be previewed in source mode.", "cite-ve-referenceslist-missingreflist": "This reference list is generated by a template.", diff --git a/modules/ve-cite/i18n/qqq.json b/modules/ve-cite/i18n/qqq.json index aeb829cd3..a7127fab6 100644 --- a/modules/ve-cite/i18n/qqq.json +++ b/modules/ve-cite/i18n/qqq.json @@ -48,16 +48,21 @@ "cite-ve-citationneeded-description": "Description in citation needed context, explaining that a citation is needed", "cite-ve-citationneeded-reason": "Label for reason given for citation being needed.", "cite-ve-citationneeded-title": "Title of citation needed context", + "cite-ve-dialog-reference-contextitem-extends": "Message shown to an editor when they click on a sub-reference with additional details.", + "cite-ve-dialog-reference-editing-add-details": "Text shown at the top of the reference dialog when adding additional details while creating a sub-reference.", + "cite-ve-dialog-reference-editing-add-details-placeholder": "Placeholder for the content editor when adding additional details while creating a sub-reference.", "cite-ve-dialog-reference-editing-reused": "Text shown in reference context menu when editing a reference that is used multiple times. This is a shorter version of {{msg-mw|cite-ve-dialog-reference-editing-reused-long}}.\n\nParameters:\n* $1 - Number of times used. This is always greater than 1.\n\nNote that the explicit '2' value is useful in English, but not necessarily for other languages. Don't translate the 2 value if it's not useful for your language.", "cite-ve-dialog-reference-editing-reused-long": "Text shown at the top of the reference dialog when editing a reference that is used multiple times. This is a more detailed version of {{msg-mw|cite-ve-dialog-reference-editing-reused}}.\n\nParameters:\n* $1 - Number of times used. This is always greater than 1.\n\nNote that the explicit '2' value is useful in English, but not necessarily for other languages. Don't translate the 2 value if it's not useful for your language.", - "cite-ve-dialog-reference-editing-extends": "Text shown in reference context menu when editing a reference that extends another reference.", - "cite-ve-dialog-reference-missing-parent-ref": "Message that appears in popup dialogs when a subreference is missing its parent reference.", + "cite-ve-dialog-reference-editing-extends": "Text shown at the top of the reference dialog when editing a sub-reference with additional details.", + "cite-ve-dialog-reference-missing-parent-ref": "Message that appears in popup dialogs when a sub-reference is missing its main reference.", "cite-ve-dialog-reference-options-group-label": "Label for the reference group input", "cite-ve-dialog-reference-options-group-placeholder": "Placeholder for the reference group input", "cite-ve-dialog-reference-options-responsive-label": "Label for the responsive layout checkbox", "cite-ve-dialog-reference-options-section": "Label for the reference options sub-section.\n{{Identical|Options}}", "cite-ve-dialog-reference-placeholder": "Placeholder text shown in a basic reference when no text has yet been entered.", "cite-ve-dialog-reference-title": "{{Identical|Reference}}", + "cite-ve-dialog-reference-title-add-details": "Title for the dialog to add additional details when creating a sub-reference.", + "cite-ve-dialog-reference-title-edit-details": "Title for the dialog to change additional details when editing a sub-reference.", "cite-ve-dialog-reference-useexisting-tool": "'''FIXME:''' patchwork translation used in different contexts. See [https://phabricator.wikimedia.org/T223349 T223349].\n\nUsed as label for the button to let the user pick an existing reference from a list to insert a duplicate.\n\nUsed by {{msg-mw|Cite-ve-othergroup-item}}.\n\n{{Identical|Re-use}}", "cite-ve-dialog-referenceslist-contextitem-description-general": "Message shown to an editor when they click on a reference list without a group, explaining to them that the item will list all \"general\" references on the page.", "cite-ve-dialog-referenceslist-contextitem-description-named": "Message shown to an editor when they click on a reference list with a group, explaining to them that the item will list all references on the page with that particular group.\n\n* $1 – the name of the group of references (user-entered)", @@ -71,7 +76,7 @@ "cite-ve-reference-input-placeholder": "Placeholder text for reference search field: searches existing on-page references.", "cite-ve-referenceslist-isempty": "Message that appears in the references list when there are no references on the page of that group.\n\nParameters:\n* $1 - reference-group name", "cite-ve-referenceslist-isempty-default": "Message that appears in the references list when there are no references on the page in the default group.", - "cite-ve-referenceslist-missing-parent": "Message that appears in place of the parent reference in the reference list, when a subreference has no corresponding parent.", + "cite-ve-referenceslist-missing-parent": "Message that appears in place of the main reference in the reference list, when a sub-reference has no corresponding main reference.", "cite-ve-referenceslist-missingref": "Message that appears as a tooltip on the reference, for references that are generated by a template or are otherwise uneditable.\n\nSee also:\n* {{msg-mw|visualeditor-dialog-meta-languages-readonlynote}}", "cite-ve-referenceslist-missingref-in-list": "Message that appears in the references list for references that are generated by a template or are otherwise uneditable.\n\nSee also:\n* {{msg-mw|visualeditor-dialog-meta-languages-readonlynote}}", "cite-ve-referenceslist-missingreflist": "Message that appears as a tooltip on the reference list for lists that are generated by a template.", diff --git a/modules/ve-cite/ve.ui.MWReferenceContextItem.js b/modules/ve-cite/ve.ui.MWReferenceContextItem.js index e49d425cf..2fec597e5 100644 --- a/modules/ve-cite/ve.ui.MWReferenceContextItem.js +++ b/modules/ve-cite/ve.ui.MWReferenceContextItem.js @@ -94,7 +94,7 @@ ve.ui.MWReferenceContextItem.prototype.getExtendsWarning = function () { if ( this.model.getAttribute( 'extendsRef' ) ) { return $( '
' ) .addClass( 've-ui-mwReferenceContextItem-muted' ) - .text( mw.msg( 'cite-ve-dialog-reference-editing-extends' ) ); + .text( mw.msg( 'cite-ve-dialog-reference-contextitem-extends' ) ); } }; diff --git a/modules/ve-cite/ve.ui.MWReferenceDialog.js b/modules/ve-cite/ve.ui.MWReferenceDialog.js index 920b3fe6e..5c930d5c6 100644 --- a/modules/ve-cite/ve.ui.MWReferenceDialog.js +++ b/modules/ve-cite/ve.ui.MWReferenceDialog.js @@ -218,6 +218,9 @@ ve.ui.MWReferenceDialog.prototype.getSetupProcess = function ( data ) { if ( this.selectedNode instanceof ve.dm.MWReferenceNode ) { // edit an existing reference ref = ve.dm.MWReferenceModel.static.newFromReferenceNode( this.selectedNode ); + if ( ref.extendsRef ) { + this.title.setLabel( OO.ui.deferMsg( 'cite-ve-dialog-reference-title-edit-details' ) ); + } } else { // create a new reference ref = new ve.dm.MWReferenceModel( this.getFragment().getDocument() ); diff --git a/modules/ve-cite/ve.ui.MWReferenceDialog.less b/modules/ve-cite/ve.ui.MWReferenceDialog.less index d3c7ebb8e..b62ba468b 100644 --- a/modules/ve-cite/ve.ui.MWReferenceDialog.less +++ b/modules/ve-cite/ve.ui.MWReferenceDialog.less @@ -9,4 +9,8 @@ .ve-ui-mwReferenceDialog-extendsWarning { font-weight: normal; margin-bottom: 1em; + + .ve-ui-previewElement { + margin: 1em 0; + } } diff --git a/modules/ve-cite/ve.ui.MWSetExtendsContentDialog.js b/modules/ve-cite/ve.ui.MWSetExtendsContentDialog.js index f60c4664e..1ba96eec0 100644 --- a/modules/ve-cite/ve.ui.MWSetExtendsContentDialog.js +++ b/modules/ve-cite/ve.ui.MWSetExtendsContentDialog.js @@ -32,7 +32,7 @@ ve.ui.MWSetExtendsContentDialog.static.name = 'setExtendsContent'; ve.ui.MWSetExtendsContentDialog.static.size = 'medium'; // TODO extends i18n -ve.ui.MWSetExtendsContentDialog.static.title = 'Extend a reference'; +ve.ui.MWSetExtendsContentDialog.static.title = OO.ui.deferMsg( 'cite-ve-dialog-reference-title-add-details' ); ve.ui.MWSetExtendsContentDialog.static.actions = [ { @@ -61,12 +61,9 @@ ve.ui.MWSetExtendsContentDialog.prototype.initialize = function () { scrollable: true, padded: true } ); - // Icon message widget - this.extendsWarning = new OO.ui.MessageWidget( { - icon: 'alert', - inline: true, - classes: [ 've-ui-setExtendsContentDialog-warning' ] - } ); + this.$extendsNote = $( '
' ) + .addClass( 've-ui-setExtendsContentDialog-note' ) + .text( ve.msg( 'cite-ve-dialog-reference-editing-add-details' ) ); this.referenceTarget = ve.init.target.createTargetWidget( { @@ -74,15 +71,14 @@ ve.ui.MWSetExtendsContentDialog.prototype.initialize = function () { excludeCommands: ve.ui.MWReferenceEditPanel.static.getExcludeCommands(), importRules: ve.ui.MWReferenceEditPanel.static.getImportRules(), inDialog: this.constructor.static.name, - // TODO extends i18n - placeholder: 'Write or paste the content for the extension here' + placeholder: OO.ui.deferMsg( 'cite-ve-dialog-reference-editing-add-details-placeholder' ) } ); this.contentFieldset = new OO.ui.FieldsetLayout(); this.contentFieldset.$element.append( this.referenceTarget.$element ); - this.editPanel.$element.append( this.extendsWarning.$element, this.contentFieldset.$element ); + this.editPanel.$element.append( this.$extendsNote, this.contentFieldset.$element ); this.$body.append( this.editPanel.$element ); }; @@ -98,11 +94,7 @@ ve.ui.MWSetExtendsContentDialog.prototype.getSetupProcess = function ( data ) { const parentItemNode = data.internalList.getItemNode( this.originalRef.getListIndex() ); const $parentRefPreview = new ve.ui.MWPreviewElement( parentItemNode, { useView: true } ).$element; - this.extendsWarning.setLabel( - $( '

' ) - .text( mw.msg( 'cite-ve-dialog-reference-editing-extends' ) ) - .append( $parentRefPreview ) - ); + this.$extendsNote.append( $parentRefPreview ); this.referenceTarget.setDocument( this.newRef.getDocument() ); } ); diff --git a/modules/ve-cite/ve.ui.MWSetExtendsContentDialog.less b/modules/ve-cite/ve.ui.MWSetExtendsContentDialog.less index a81463bd6..d22b3122d 100644 --- a/modules/ve-cite/ve.ui.MWSetExtendsContentDialog.less +++ b/modules/ve-cite/ve.ui.MWSetExtendsContentDialog.less @@ -5,7 +5,10 @@ * @license MIT */ -.ve-ui-setExtendsContentDialog-warning { - font-weight: normal; +.ve-ui-setExtendsContentDialog-note { margin-bottom: 1em; + + .ve-ui-previewElement { + margin-top: 1em; + } }