diff --git a/extensions/wikidata/module/langs/translation-en.json b/extensions/wikidata/module/langs/translation-en.json index 50be8999a..2f1b8f272 100644 --- a/extensions/wikidata/module/langs/translation-en.json +++ b/extensions/wikidata/module/langs/translation-en.json @@ -31,8 +31,10 @@ "wikidata-schema/property-placeholder": "property", "wikidata-schema/nb-references": " references", "wikidata-schema/remove-column": "remove column", - "wikidata-schema/label": "Label", - "wikidata-schema/description": "Description", + "wikidata-schema/label-if-new": "New label", + "wikidata-schema/label-override": "Override label", + "wikidata-schema/description-if-new": "New description", + "wikidata-schema/description-override": "Override description", "wikidata-schema/alias": "Alias", "wikidata-schema/item-or-reconciled-column": "type item or drag reconciled column here", "wikidata-schema/amount": "amount", diff --git a/extensions/wikidata/module/langs/translation-fr.json b/extensions/wikidata/module/langs/translation-fr.json index 1a8448aee..3c098ae53 100644 --- a/extensions/wikidata/module/langs/translation-fr.json +++ b/extensions/wikidata/module/langs/translation-fr.json @@ -28,8 +28,10 @@ "wikidata-schema/property-placeholder": "propriété", "wikidata-schema/nb-references": " références", "wikidata-schema/remove-column": "supprimer la colonne", - "wikidata-schema/label": "Libellé", - "wikidata-schema/description": "Description", + "wikidata-schema/label-if-new": "Nouveau libellé", + "wikidata-schema/label-override": "Écraser le libellé", + "wikidata-schema/description-if-new": "Nouvelle description", + "wikidata-schema/description-override": "Écraser la description", "wikidata-schema/alias": "Alias", "wikidata-schema/item-or-reconciled-column": "entrer un élément ou déposer une colonne réconciliée ici", "wikidata-schema/amount": "quantité", diff --git a/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js b/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js index 1bb8f8183..1ca97ea6b 100644 --- a/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js +++ b/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js @@ -441,11 +441,19 @@ SchemaAlignmentDialog._addNameDesc = function(item, json) { var type_input = $('').appendTo(type_container); $('') .attr('value', 'LABEL') - .text($.i18n('wikidata-schema/label')) + .text($.i18n('wikidata-schema/label-override')) + .appendTo(type_input); + $('') + .attr('value', 'LABEL_IF_NEW') + .text($.i18n('wikidata-schema/label-if-new')) .appendTo(type_input); $('') .attr('value', 'DESCRIPTION') - .text($.i18n('wikidata-schema/description')) + .text($.i18n('wikidata-schema/description-override')) + .appendTo(type_input); + $('') + .attr('value', 'DESCRIPTION_IF_NEW') + .text($.i18n('wikidata-schema/description-if-new')) .appendTo(type_input); $('') .attr('value', 'ALIAS') diff --git a/extensions/wikidata/module/scripts/previewrenderer.js b/extensions/wikidata/module/scripts/previewrenderer.js index 304f5f116..3d40a7c6e 100644 --- a/extensions/wikidata/module/scripts/previewrenderer.js +++ b/extensions/wikidata/module/scripts/previewrenderer.js @@ -37,13 +37,17 @@ EditRenderer._renderItem = function(json, container) { // Terms if ((json.labels && json.labels.length) || + (json.labelsIfNew && json.labelsIfNew.length) || (json.descriptions && json.descriptions.length) || + (json.descriptionsIfNew && json.descriptionsIfNew.length) || (json.addedAliases && json.addedAliases.length)) { var termsContainer = $('
').addClass('wbs-namedesc-container') .appendTo(right); - this._renderTermsList(json.labels, "label", termsContainer); - this._renderTermsList(json.descriptions, "description", termsContainer); + this._renderTermsList(json.labels, "label-override", termsContainer); + this._renderTermsList(json.labelsIfNew, "label-if-new", termsContainer); + this._renderTermsList(json.descriptions, "description-override", termsContainer); + this._renderTermsList(json.descriptionsIfNew, "description-if-new", termsContainer); this._renderTermsList(json.addedAliases, "alias", termsContainer); // Clear the float diff --git a/extensions/wikidata/src/org/openrefine/wikidata/updates/ItemUpdate.java b/extensions/wikidata/src/org/openrefine/wikidata/updates/ItemUpdate.java index dab87d97b..d9571ffcb 100644 --- a/extensions/wikidata/src/org/openrefine/wikidata/updates/ItemUpdate.java +++ b/extensions/wikidata/src/org/openrefine/wikidata/updates/ItemUpdate.java @@ -242,8 +242,13 @@ public class ItemUpdate { */ @JsonIgnore public boolean isEmpty() { - return (addedStatements.isEmpty() && deletedStatements.isEmpty() && labels.isEmpty() && descriptions.isEmpty() - && aliases.isEmpty()); + return (addedStatements.isEmpty() && + deletedStatements.isEmpty() && + labels.isEmpty() && + descriptions.isEmpty() && + aliases.isEmpty() && + labelsIfNew.isEmpty() && + descriptionsIfNew.isEmpty()); } /** diff --git a/extensions/wikidata/tests/src/org/openrefine/wikidata/updates/ItemUpdateTest.java b/extensions/wikidata/tests/src/org/openrefine/wikidata/updates/ItemUpdateTest.java index a5773f57e..9443f167d 100644 --- a/extensions/wikidata/tests/src/org/openrefine/wikidata/updates/ItemUpdateTest.java +++ b/extensions/wikidata/tests/src/org/openrefine/wikidata/updates/ItemUpdateTest.java @@ -209,6 +209,7 @@ public class ItemUpdateTest { ItemUpdate merged = update1.merge(update2); assertEquals(Collections.singleton(description1), merged.getDescriptionsIfNew()); assertEquals(Collections.emptySet(), merged.getDescriptions()); + assertFalse(merged.isEmpty()); } @Test