Finish localization of the wikidata extension

This commit is contained in:
Antonin Delpeuch 2018-02-23 14:57:16 +00:00
parent d3023008e9
commit 487547bd27
5 changed files with 89 additions and 37 deletions

View File

@ -1,4 +1,12 @@
{ {
"wikidata-extension": {
"menu-label": "Wikidata",
"edit-wikidata-schema": "Edit Wikidata schema",
"manage-wikidata-account": "Manage Wikidata account",
"perform-edits-on-wikidata": "Perform edits on Wikidata",
"export-to-qs": "Export to QuickStatements",
"quickstatements-export-name": "QuickStatements"
},
"wikidata-schema": { "wikidata-schema": {
"dialog-header": "Align to Wikidata", "dialog-header": "Align to Wikidata",
"dialog-explanation": "The schema alignment skeleton below specifies how your tabular data will be transformed into Wikibase statements. You can drag and drop columns in statements: they will be replaced by their values once you export the statements.", "dialog-explanation": "The schema alignment skeleton below specifies how your tabular data will be transformed into Wikibase statements. You can drag and drop columns in statements: they will be replaced by their values once you export the statements.",
@ -7,15 +15,45 @@
"qs-preview-tab-header": "QuickStatements preview", "qs-preview-tab-header": "QuickStatements preview",
"draggable-columns-header": "Columns:", "draggable-columns-header": "Columns:",
"add-item-button": "add item", "add-item-button": "add item",
"add-term": "add term",
"remove-term": "remove term",
"add-statement": "add statement",
"remove-statement": "remove statement",
"add-value": "add value",
"add-qualifier": "add qualifier",
"add-reference": "add reference",
"add-reference-snak": "add",
"remove-reference": "remove reference",
"nb-references": " references",
"remove-column": "remove column",
"label": "Label",
"description": "Description",
"alias": "Alias",
"item-or-reconciled-column": "item or reconciled column",
"datatype-not-supported-yet": "This datatype is not supported yet, sorry.",
"invalid-schema-warning-issues": "Your schema is incomplete, fix it to see the issues.", "invalid-schema-warning-issues": "Your schema is incomplete, fix it to see the issues.",
"invalid-schema-warning-qs": "Your schema is incomplete, fix it to see the preview.", "invalid-schema-warning-qs": "Your schema is incomplete, fix it to see the preview.",
"reset-button": "Reset", "reset-button": "Reset",
"save-button": "Save", "save-button": "Save",
"close-button": "Close" "close-button": "Close",
"unsaved-changes": "There are unsaved changes. Close anyway?"
}, },
"wikidata-preview": { "wikidata-preview": {
"new-id": "new item" "new-id": "new item"
}, },
"wikidata-account": {
"dialog-header": "Wikidata account",
"explain-log-in": "Logging in to Wikidata will allow you to perform edits directly from OpenRefine.",
"username-label": "Username:",
"username-placeholder": "Enter your username",
"password-label": "Password:",
"password-placeholder": "Enter your password",
"remember-credentials-label": "Remember credentials (stored unencrypted in OpenRefine's preferences)",
"close": "Close",
"log-in": "Log in",
"logged-in-as": "You are logged in as:",
"log-out": "Log out"
},
"perform-wikidata-edits": { "perform-wikidata-edits": {
"dialog-header": "Perform edits on Wikidata", "dialog-header": "Perform edits on Wikidata",
"review-your-edits": "Please review your edits before pushing them to Wikidata. Consider requesting feedback at the <a href=\"https://www.wikidata.org/wiki/Wikidata:Data_Import_Hub\">Data Import Hub</a> for large datasets.", "review-your-edits": "Please review your edits before pushing them to Wikidata. Consider requesting feedback at the <a href=\"https://www.wikidata.org/wiki/Wikidata:Data_Import_Hub\">Data Import Hub</a> for large datasets.",
@ -42,6 +80,7 @@
"body": "There is probably something wrong in your schema or project." "body": "There is probably something wrong in your schema or project."
}, },
"new-item-without-P31-or-P279": { "new-item-without-P31-or-P279": {
"title": "New items created without any type.", "title": "New items created without any type.",
"body": "You should provide an \"instance of\" (P31) or \"subclass of\" (P279) statement for each item that you create, such as {example_entity}." "body": "You should provide an \"instance of\" (P31) or \"subclass of\" (P279) statement for each item that you create, such as {example_entity}."
}, },

View File

@ -1,8 +1,7 @@
<div class="dialog-frame" style="width: 800px;"> <div class="dialog-frame" style="width: 800px;">
<div class="dialog-header" bind="dialogHeader">Wikidata account</div> <div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody"> <div class="dialog-body" bind="dialogBody">
<p class="body-text"> <p class="body-text" bind="explainLogIn">
Logging in to Wikidata will allow you to perform edits directly from OpenRefine.
</p> </p>
<div class="wikibase-user-management-area"> <div class="wikibase-user-management-area">
<div class="wikibase-user-login" bind="loginArea"> <div class="wikibase-user-login" bind="loginArea">
@ -10,34 +9,34 @@
<form bind="loginForm" class="wikibase-login-form" method="post"> <form bind="loginForm" class="wikibase-login-form" method="post">
<table> <table>
<tr> <tr>
<td><label for="wb-username">Username:</label></td> <td><label for="wb-username" bind="usernameLabel"></label></td>
<td><input name="wb-username" placeholder="Enter your username" type="text" /></td> <td><input name="wb-username" type="text" bind="usernameInput" /></td>
</tr> </tr>
<tr> <tr>
<td><label for="wb-password">Password:</label></td> <td><label for="wb-password" bind="passwordLabel"></label></td>
<td><input name="wb-password" type="password" placeholder="Enter your password" /></td> <td><input name="wb-password" type="password" bind="passwordInput" /></td>
</tr> </tr>
<tr> <tr>
<td><input type="checkbox" name="remember-credentials" /></td> <td><input type="checkbox" name="remember-credentials" /></td>
<td><label for="remember-credentials">Remember credentials (stored unencrypted in OpenRefine's preferences)</label></td> <td><label for="remember-credentials" bind="rememberCredentialsLabel"></label></td>
</tr> </tr>
</table> </table>
</form> </form>
<div class="wikibase-login-buttons"> <div class="wikibase-login-buttons">
<button class="button cancel-button">Close</button> <button class="button cancel-button" bind="cancelButton1"></button>
<button class="button button-primary" bind="loginButton">Log in</button> <button class="button button-primary" bind="loginButton"></button>
</div> </div>
</div> </div>
<div class="wikibase-user-logout" bind="logoutArea"> <div class="wikibase-user-logout" bind="logoutArea">
<p><span bind="loggedInAs">You are logged in as:</span> <p><span bind="loggedInAs"></span>
<span bind="loggedInUsername"></span></p> <span bind="loggedInUsername"></span></p>
<form bind="logoutForm" method="post"> <form bind="logoutForm" method="post">
<input type="hidden" name="wb-username" value="null" /> <input type="hidden" name="wb-username" value="null" />
<input name="wb-password" type="hidden" value="null" /> <input name="wb-password" type="hidden" value="null" />
</form> </form>
<div class="wikibase-login-buttons"> <div class="wikibase-login-buttons">
<button class="button cancel-button">Cancel</button> <button class="button cancel-button" bind="cancelButton2"></button>
<button class="button button-primary" bind="logoutButton">Log out</button> <button class="button button-primary" bind="logoutButton"></button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -25,6 +25,20 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca
var elmts = this._elmts = DOM.bind(frame); var elmts = this._elmts = DOM.bind(frame);
console.log(saved_credentials); console.log(saved_credentials);
this._elmts.dialogHeader.text($.i18n._('wikidata-account')["dialog-header"]);
this._elmts.explainLogIn.text($.i18n._('wikidata-account')["explain-log-in"]);
this._elmts.usernameLabel.text($.i18n._('wikidata-account')["username-label"]);
this._elmts.usernameInput.attr("placeholder", $.i18n._('wikidata-account')["username-placeholder"]);
this._elmts.passwordLabel.text($.i18n._('wikidata-account')["password-label"]);
this._elmts.passwordInput.attr("placeholder", $.i18n._('wikidata-account')["password-placeholder"]);
this._elmts.rememberCredentialsLabel.text($.i18n._('wikidata-account')["remember-credentials-label"]);
this._elmts.dialogHeader.text($.i18n._('wikidata-account')["dialog-header"]);
this._elmts.cancelButton1.text($.i18n._('wikidata-account')["close"]);
this._elmts.cancelButton2.text($.i18n._('wikidata-account')["close"]);
this._elmts.loggedInAs.text($.i18n._('wikidata-account')["logged-in-as"]);
this._elmts.logoutButton.text($.i18n._('wikidata-account')["log-out"]);
this._elmts.loginButton.text($.i18n._('wikidata-account')["log-in"]);
this._level = DialogSystem.showDialog(frame); this._level = DialogSystem.showDialog(frame);
var dismiss = function() { var dismiss = function() {

View File

@ -156,7 +156,7 @@ SchemaAlignmentDialog._createDialog = function() {
self._reset(null); self._reset(null);
}); });
elmts.closeButton.click(function() { elmts.closeButton.click(function() {
if (!self._hasUnsavedChanges || window.confirm("There are unsaved changes. Close anyway?")) { if (!self._hasUnsavedChanges || window.confirm($.i18n._('wikidata-schema')["unsaved-changes"])) {
dismiss(); dismiss();
} }
}); });
@ -198,12 +198,12 @@ SchemaAlignmentDialog._addItem = function(json) {
var right = $('<div></div>').addClass('wbs-right').appendTo(item); var right = $('<div></div>').addClass('wbs-right').appendTo(item);
$('<div></div>').addClass('wbs-namedesc-container').appendTo(right); $('<div></div>').addClass('wbs-namedesc-container').appendTo(right);
var toolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(right); var toolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(right);
$('<a></a>').addClass('wbs-add-namedesc').text('add name/description').click(function() { $('<a></a>').addClass('wbs-add-namedesc').text($.i18n._('wikidata-schema')["add-term"]).click(function() {
SchemaAlignmentDialog._addNameDesc(item, null); SchemaAlignmentDialog._addNameDesc(item, null);
}).appendTo(toolbar); }).appendTo(toolbar);
$('<div></div>').addClass('wbs-statement-group-container').appendTo(right); $('<div></div>').addClass('wbs-statement-group-container').appendTo(right);
var toolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(right); var toolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(right);
$('<a></a>').addClass('wbs-add-statement-group').text('add statement').click(function() { $('<a></a>').addClass('wbs-add-statement-group').text($.i18n._('wikidata-schema')["add-statement"]).click(function() {
SchemaAlignmentDialog._addStatementGroup(item, null); SchemaAlignmentDialog._addStatementGroup(item, null);
}).appendTo(toolbar); }).appendTo(toolbar);
@ -255,20 +255,20 @@ SchemaAlignmentDialog._addNameDesc = function(item, json) {
var type_input = $('<select></select>').appendTo(type_container); var type_input = $('<select></select>').appendTo(type_container);
$('<option></option>') $('<option></option>')
.attr('value', 'LABEL') .attr('value', 'LABEL')
.text('Label') .text($.i18n._('wikidata-schema')["label"])
.appendTo(type_input); .appendTo(type_input);
$('<option></option>') $('<option></option>')
.attr('value', 'DESCRIPTION') .attr('value', 'DESCRIPTION')
.text('Description') .text($.i18n._('wikidata-schema')["description"])
.appendTo(type_input); .appendTo(type_input);
$('<option></option>') $('<option></option>')
.attr('value', 'ALIAS') .attr('value', 'ALIAS')
.text('Alias') .text($.i18n._('wikidata-schema')["alias"])
.appendTo(type_input); .appendTo(type_input);
type_input.val(type); type_input.val(type);
var toolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(namedesc); var toolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(namedesc);
$('<img src="images/close.png" />').attr('alt', 'remove name/description').click(function() { $('<img src="images/close.png" />').attr('alt', $.i18n._('wikidata-schema')["remove-term"]).click(function() {
namedesc.remove(); namedesc.remove();
}).appendTo(toolbar); }).appendTo(toolbar);
@ -308,7 +308,7 @@ SchemaAlignmentDialog._addStatementGroup = function(item, json) {
var statementContainer = $('<div></div>').addClass('wbs-statement-container').appendTo(right); var statementContainer = $('<div></div>').addClass('wbs-statement-container').appendTo(right);
SchemaAlignmentDialog._initPropertyField(inputContainer, statementContainer, property); SchemaAlignmentDialog._initPropertyField(inputContainer, statementContainer, property);
var toolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(right); var toolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(right);
var addValueButton = $('<a></a>').addClass('wbs-add-statement').text('add value').click(function() { var addValueButton = $('<a></a>').addClass('wbs-add-statement').text($.i18n._('wikidata-schema')["add-value"]).click(function() {
var datatype = inputContainer.data("jsonValue").datatype; var datatype = inputContainer.data("jsonValue").datatype;
SchemaAlignmentDialog._addStatement(statementContainer, datatype, null); SchemaAlignmentDialog._addStatement(statementContainer, datatype, null);
}).appendTo(toolbar).hide(); }).appendTo(toolbar).hide();
@ -350,7 +350,7 @@ SchemaAlignmentDialog._addStatement = function(container, datatype, json) {
var statement = $('<div></div>').addClass('wbs-statement'); var statement = $('<div></div>').addClass('wbs-statement');
var toolbar1 = $('<div></div>').addClass('wbs-toolbar').appendTo(statement); var toolbar1 = $('<div></div>').addClass('wbs-toolbar').appendTo(statement);
$('<img src="images/close.png" />').attr('alt', 'remove statement').click(function() { $('<img src="images/close.png" />').attr('alt', $.i18n._('wikidata-schema')["remove-statement"]).click(function() {
SchemaAlignmentDialog._removeStatement(statement); SchemaAlignmentDialog._removeStatement(statement);
}).appendTo(toolbar1); }).appendTo(toolbar1);
var inputContainer = $('<div></div>').addClass('wbs-target-input').appendTo(statement); var inputContainer = $('<div></div>').addClass('wbs-target-input').appendTo(statement);
@ -364,7 +364,7 @@ SchemaAlignmentDialog._addStatement = function(container, datatype, json) {
var right = $('<div></div>').addClass('wbs-right').appendTo(statement); var right = $('<div></div>').addClass('wbs-right').appendTo(statement);
var qualifierContainer = $('<div></div>').addClass('wbs-qualifier-container').appendTo(right); var qualifierContainer = $('<div></div>').addClass('wbs-qualifier-container').appendTo(right);
var toolbar2 = $('<div></div>').addClass('wbs-toolbar').appendTo(right); var toolbar2 = $('<div></div>').addClass('wbs-toolbar').appendTo(right);
$('<a></a>').addClass('wbs-add-qualifier').text('add qualifier').click(function() { $('<a></a>').addClass('wbs-add-qualifier').text($.i18n._('wikidata-schema')["add-qualifier"]).click(function() {
SchemaAlignmentDialog._addQualifier(qualifierContainer, null); SchemaAlignmentDialog._addQualifier(qualifierContainer, null);
}).appendTo(toolbar2); }).appendTo(toolbar2);
if (qualifiers) { if (qualifiers) {
@ -384,7 +384,7 @@ SchemaAlignmentDialog._addStatement = function(container, datatype, json) {
referenceContainer.hide(); referenceContainer.hide();
var right2 = $('<div></div>').addClass('wbs-right').appendTo(right); var right2 = $('<div></div>').addClass('wbs-right').appendTo(right);
var toolbar3 = $('<div></div>').addClass('wbs-toolbar').appendTo(right2); var toolbar3 = $('<div></div>').addClass('wbs-toolbar').appendTo(right2);
$('<a></a>').addClass('wbs-add-reference').text('add reference').click(function() { $('<a></a>').addClass('wbs-add-reference').text($.i18n._('wikidata-schema')["add-reference"]).click(function() {
referenceContainer.show(); referenceContainer.show();
SchemaAlignmentDialog._addReference(referenceContainer, null); SchemaAlignmentDialog._addReference(referenceContainer, null);
SchemaAlignmentDialog._updateReferencesNumber(referenceContainer); SchemaAlignmentDialog._updateReferencesNumber(referenceContainer);
@ -465,7 +465,7 @@ SchemaAlignmentDialog._addReference = function(container, json) {
var reference = $('<div></div>').addClass('wbs-reference').appendTo(container); var reference = $('<div></div>').addClass('wbs-reference').appendTo(container);
var referenceHeader = $('<div></div>').addClass('wbs-reference-header').appendTo(reference); var referenceHeader = $('<div></div>').addClass('wbs-reference-header').appendTo(reference);
var toolbarRef = $('<div></div>').addClass('wbs-toolbar').appendTo(referenceHeader); var toolbarRef = $('<div></div>').addClass('wbs-toolbar').appendTo(referenceHeader);
$('<img src="images/close.png" />').attr('alt', 'remove reference').click(function() { $('<img src="images/close.png" />').attr('alt', $.i18n._('wikidata-schema')["remove-reference"]).click(function() {
reference.remove(); reference.remove();
SchemaAlignmentDialog._updateReferencesNumber(container); SchemaAlignmentDialog._updateReferencesNumber(container);
SchemaAlignmentDialog._hasChanged(); SchemaAlignmentDialog._hasChanged();
@ -473,7 +473,7 @@ SchemaAlignmentDialog._addReference = function(container, json) {
var right = $('<div></div>').addClass('wbs-right').appendTo(reference); var right = $('<div></div>').addClass('wbs-right').appendTo(reference);
var qualifierContainer = $('<div></div>').addClass('wbs-qualifier-container').appendTo(right); var qualifierContainer = $('<div></div>').addClass('wbs-qualifier-container').appendTo(right);
var toolbar2 = $('<div></div>').addClass('wbs-toolbar').appendTo(right); var toolbar2 = $('<div></div>').addClass('wbs-toolbar').appendTo(right);
$('<a></a>').addClass('wbs-add-qualifier').text('add').click(function() { $('<a></a>').addClass('wbs-add-qualifier').text($.i18n._('wikidata-schema')['add-reference-snak']).click(function() {
SchemaAlignmentDialog._addQualifier(qualifierContainer, null); SchemaAlignmentDialog._addQualifier(qualifierContainer, null);
}).appendTo(toolbar2); }).appendTo(toolbar2);
@ -499,7 +499,7 @@ SchemaAlignmentDialog._updateReferencesNumber = function(container) {
var childrenCount = container.children().length; var childrenCount = container.children().length;
var statement = container.parents('.wbs-statement'); var statement = container.parents('.wbs-statement');
var a = statement.find('.wbs-references-toggle a').first(); var a = statement.find('.wbs-references-toggle a').first();
a.html(childrenCount+'&nbsp;references'); a.html(childrenCount+$.i18n._('wikidata-schema')["nb-references"]);
} }
/************************ /************************
@ -572,7 +572,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
} }
if (this._reconService !== null && mode === "wikibase-item") { if (this._reconService !== null && mode === "wikibase-item") {
input.attr("placeholder", "item or reconciled column"); input.attr("placeholder", $.i18n._('wikidata-schema')["item-or-reconciled-column"]);
var endpoint = null; var endpoint = null;
endpoint = this._reconService.suggest.entity; endpoint = this._reconService.suggest.entity;
var suggestConfig = $.extend({}, endpoint); var suggestConfig = $.extend({}, endpoint);
@ -616,7 +616,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
changedCallback(); changedCallback();
}); });
} else if (mode === "quantity") { } else if (mode === "quantity") {
alert("not supported yet!"); alert($.i18n._('wikidata-schema')["datatype-not-supported-yet"]);
} else if (mode === "language") { } else if (mode === "language") {
var initial_language_width = "20%"; var initial_language_width = "20%";
var expanded_width = "90px"; var expanded_width = "90px";
@ -682,7 +682,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
var columnDiv = $('<div></div>').appendTo(inputContainer); var columnDiv = $('<div></div>').appendTo(inputContainer);
column.appendTo(columnDiv); column.appendTo(columnDiv);
var deleteButton = $('&nbsp;<img src="images/close.png" />').addClass('wbs-delete-column-button').appendTo(column); var deleteButton = $('&nbsp;<img src="images/close.png" />').addClass('wbs-delete-column-button').appendTo(column);
deleteButton.attr('alt', 'remove column'); deleteButton.attr('alt', $.i18n._('wikidata-schema')["remove-column"]);
deleteButton.click(function () { deleteButton.click(function () {
columnDiv.remove(); columnDiv.remove();
input.show(); input.show();

View File

@ -20,7 +20,7 @@ ExporterManager.MenuItems.push({});
ExporterManager.MenuItems.push( ExporterManager.MenuItems.push(
{ {
"id" : "exportQuickStatements", "id" : "exportQuickStatements",
"label":"QuickStatements", "label": $.i18n._('wikidata-extions')["quickstatements-export-name"],
"click": function() { WikibaseExporterMenuBar.exportTo("quickstatements"); } "click": function() { WikibaseExporterMenuBar.exportTo("quickstatements"); }
} }
); );
@ -60,26 +60,26 @@ $(function(){
ExtensionBar.MenuItems.push( ExtensionBar.MenuItems.push(
{ {
"id":"reconcile", "id":"reconcile",
"label": "Wikidata", "label": $.i18n._('wikidata-extension')["menu-label"],
"submenu" : [ "submenu" : [
{ {
id: "wikidata/edit-schema", id: "wikidata/edit-schema",
label: "Edit Wikibase schema...", label: $.i18n._('wikidata-extension')["edit-wikidata-schema"],
click: function() { SchemaAlignmentDialog.launch(false); } click: function() { SchemaAlignmentDialog.launch(false); }
}, },
{ {
id:"wikidata/manage-account", id:"wikidata/manage-account",
label: "Manage account", label: $.i18n._('wikidata-extension')["manage-wikidata-account"],
click: function() { ManageAccountDialog.checkAndLaunch(); } click: function() { ManageAccountDialog.checkAndLaunch(); }
}, },
{ {
id:"wikidata/perform-edits", id:"wikidata/perform-edits",
label: "Push to Wikidata...", label: $.i18n._('wikidata-extension')["perform-edits-on-wikidata"],
click: function() { PerformEditsDialog.checkAndLaunch(); } click: function() { PerformEditsDialog.checkAndLaunch(); }
}, },
{ {
id:"wikidata/export-qs", id:"wikidata/export-qs",
label: "Export to QuickStatements", label: $.i18n._('wikidata-extension')["export-to-qs"],
click: function() { WikibaseExporterMenuBar.exportTo("quickstatements"); } click: function() { WikibaseExporterMenuBar.exportTo("quickstatements"); }
}, },