Internationalization of the reconciliation part

This commit is contained in:
Blakko 2013-07-08 11:40:11 +02:00
parent 4492ca3bed
commit eb3eba9c5e
10 changed files with 100 additions and 34 deletions

View File

@ -1,13 +1,13 @@
<div class="dialog-frame" style="width: 300px;"> <div class="dialog-frame" style="width: 300px;">
<div class="dialog-header" bind="dialogHeader">Add Namespaced Reconciliation Service</div> <div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody"><div class="grid-layout layout-full layout-tighter"><table> <div class="dialog-body" bind="dialogBody"><div class="grid-layout layout-full layout-tighter"><table>
<tr><td>Namespace:</td></tr> <tr><td><span bind="or_recon_namespace"></span></td></tr>
<tr><td><div class="input-container"><input bind="namespaceInput" /></td></tr> <tr><td><div class="input-container"><input bind="namespaceInput" /></td></tr>
<tr><td>Type of Entities (optional):</td></tr> <tr><td><span bind="or_recon_entType"></span></td></tr>
<tr><td><div class="input-container"><input bind="typeInput" /></td></tr> <tr><td><div class="input-container"><input bind="typeInput" /></td></tr>
</table></div></div> </table></div></div>
<div class="dialog-footer" bind="dialogFooter"> <div class="dialog-footer" bind="dialogFooter">
<button class="button" bind="addButton">Add Service</button> <button class="button" bind="addButton"></button>
<button class="button" bind="cancelButton">Cancel</button> <button class="button" bind="cancelButton"></button>
</div> </div>
</div> </div>

View File

@ -1,11 +1,11 @@
<div class="dialog-frame" style="width: 500px;"> <div class="dialog-frame" style="width: 500px;">
<div class="dialog-header" bind="dialogHeader">Add Standard Reconciliation Service</div> <div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody"> <div class="dialog-body" bind="dialogBody">
<p>Enter the service's URL:</p> <p><span bind="or_recon_enterUrl"></span></p>
<div class="input-container"><input value="http://" bind="input" /></div> <div class="input-container"><input value="http://" bind="input" /></div>
</div> </div>
<div class="dialog-footer" bind="dialogFooter"> <div class="dialog-footer" bind="dialogFooter">
<button class="button" bind="addButton">Add Service</button> <button class="button" bind="addButton"></button>
<button class="button" bind="cancelButton">Cancel</button> <button class="button" bind="cancelButton"></button>
</div> </div>
</div> </div>

View File

@ -1,20 +1,20 @@
<div class="recon-dialog-service-panel"> <div class="recon-dialog-service-panel">
<p>Each cell contains:</p> <p bind="or_recon_contain"></p>
<div class="grid-layout layout-normal layout-full"><table> <div class="grid-layout layout-normal layout-full"><table>
<tr><td width="1%"><input type="radio" name="recon-dialog-strict-choice" value="id" checked /></td><td>a Freebase ID, e.g., /en/solar_system</td></tr> <tr><td width="1%"><input type="radio" name="recon-dialog-strict-choice" value="id" checked /></td><td bind="or_recon_fbId"></td></tr>
<tr><td><input type="radio" name="recon-dialog-strict-choice" value="guid" /></td><td>a Freebase GUID, e.g., #9202a8c04000641f80000000000354ae</td></tr> <tr><td><input type="radio" name="recon-dialog-strict-choice" value="guid" /></td><td bind="or_recon_fbGuid"></td></tr>
<tr> <tr>
<td width="1%"><input type="radio" name="recon-dialog-strict-choice" value="key" /></td> <td width="1%"><input type="radio" name="recon-dialog-strict-choice" value="key" /></td>
<td> <td>
<div class="grid-layout layout-tighter layout-full"><table> <div class="grid-layout layout-tighter layout-full"><table>
<tr><td colspan="2">a Freebase key in</td></tr> <tr><td colspan="2" bind="or_recon_fbKey"></td></tr>
<tr> <tr>
<td width="1%"><input type="radio" name="recon-dialog-strict-namespace-choice" value="/wikipedia/en" nsName="Wikipedia EN" checked /></td> <td width="1%"><input type="radio" name="recon-dialog-strict-namespace-choice" value="/wikipedia/en" nsName="Wikipedia EN" checked /></td>
<td>the Wikipedia English namespace</td> <td bind="or_recon_fbEnNs"></td>
</tr> </tr>
<tr> <tr>
<td width="1%"><input type="radio" name="recon-dialog-strict-namespace-choice" value="other" /></td> <td width="1%"><input type="radio" name="recon-dialog-strict-namespace-choice" value="other" /></td>
<td>this namespace: <input bind="strictNamespaceInput" /></td> <td bind="or_recon_thisNs"><input bind="strictNamespaceInput" /></td>
</tr> </tr>
</table></div> </table></div>
</td> </td>

View File

@ -60,6 +60,14 @@ ReconFreebaseQueryPanel.prototype._constructUI = function() {
var self = this; var self = this;
this._panel = $(DOM.loadHTML("core", "scripts/reconciliation/freebase-query-panel.html")).appendTo(this._container); this._panel = $(DOM.loadHTML("core", "scripts/reconciliation/freebase-query-panel.html")).appendTo(this._container);
this._elmts = DOM.bind(this._panel); this._elmts = DOM.bind(this._panel);
this._elmts.or_recon_contain.html($.i18n._('core-recon')["cell-contains"]);
this._elmts.or_recon_fbId.html($.i18n._('core-recon')["fb-id"]);
this._elmts.or_recon_fbGuid.html($.i18n._('core-recon')["fb-guid"]);
this._elmts.or_recon_fbKey.html($.i18n._('core-recon')["fb-key"]);
this._elmts.or_recon_fbEnNs.html($.i18n._('core-recon')["fb-en-ns"]);
this._elmts.or_recon_thisNs.html($.i18n._('core-recon')["this-ns"]);
this._wireEvents(); this._wireEvents();
}; };
@ -84,7 +92,7 @@ ReconFreebaseQueryPanel.prototype.start = function() {
if (namespaceChoice.value == "other") { if (namespaceChoice.value == "other") {
var suggest = this._elmts.strictNamespaceInput.data("data.suggest"); var suggest = this._elmts.strictNamespaceInput.data("data.suggest");
if (!suggest) { if (!suggest) {
alert("Please specify a namespace."); alert($.i18n._('core-recon')["specify-ns"]);
return; return;
} }
namespace = { namespace = {

View File

@ -7,19 +7,18 @@
</td> </td>
<td><div class="recon-dialog-service-panel-container" bind="servicePanelContainer"> <td><div class="recon-dialog-service-panel-container" bind="servicePanelContainer">
<div class="recon-dialog-service-panel-message" bind="servicePanelMessage"> <div class="recon-dialog-service-panel-message" bind="servicePanelMessage">
Pick a Service or Extension on Left
</div> </div>
</div></td> </div></td>
</tr></table></div> </tr></table></div>
</div> </div>
<div class="dialog-footer" bind="dialogFooter"><table width="100%"><tr> <div class="dialog-footer" bind="dialogFooter"><table width="100%"><tr>
<td align="left"> <td align="left">
<button class="button" bind="addStandardServiceButton">Add Standard Service...</button> <button class="button" bind="addStandardServiceButton"></button>
<button class="button" bind="addNamespacedServiceButton">Add Namespaced Service...</button> <button class="button" bind="addNamespacedServiceButton"></button>
</td> </td>
<td align="right"> <td align="right">
<button class="button" bind="reconcileButton">Start Reconciling</button> <button class="button" bind="reconcileButton"></button>
<button class="button" bind="cancelButton">Cancel</button> <button class="button" bind="cancelButton"></button>
</td> </td>
</div> </div>
</div> </div>

View File

@ -44,7 +44,13 @@ ReconDialog.prototype._createDialog = function() {
var dialog = $(DOM.loadHTML("core", "scripts/reconciliation/recon-dialog.html")); var dialog = $(DOM.loadHTML("core", "scripts/reconciliation/recon-dialog.html"));
this._elmts = DOM.bind(dialog); this._elmts = DOM.bind(dialog);
this._elmts.dialogHeader.text('Reconcile column "' + this._column.name + '"'); this._elmts.dialogHeader.text($.i18n._('core-recon')["recon-col"]+' "' + this._column.name + '"');
this._elmts.servicePanelMessage.html($.i18n._('core-recon')["pick-service"]);
this._elmts.addStandardServiceButton.html($.i18n._('core-buttons')["add-std-svc"]+"...");
this._elmts.addNamespacedServiceButton.html($.i18n._('core-buttons')["add-named-svc"]+"...");
this._elmts.reconcileButton.html($.i18n._('core-buttons')["start-recon"]);
this._elmts.cancelButton.html($.i18n._('core-buttons')["cancel"]);
this._elmts.addStandardServiceButton.click(function() { self._onAddStandardService(); }); this._elmts.addStandardServiceButton.click(function() { self._onAddStandardService(); });
this._elmts.addNamespacedServiceButton.click(function() { self._onAddNamespacedService(); }); this._elmts.addNamespacedServiceButton.click(function() { self._onAddNamespacedService(); });
@ -173,6 +179,11 @@ ReconDialog.prototype._onAddStandardService = function() {
var dialog = $(DOM.loadHTML("core", "scripts/reconciliation/add-standard-service-dialog.html")); var dialog = $(DOM.loadHTML("core", "scripts/reconciliation/add-standard-service-dialog.html"));
var elmts = DOM.bind(dialog); var elmts = DOM.bind(dialog);
elmts.dialogHeader.html($.i18n._('core-recon')["add-std-srv"]);
elmts.or_recon_enterUrl.html($.i18n._('core-recon')["enter-url"]+":");
elmts.addButton.html($.i18n._('core-buttons')["add-service"]);
elmts.cancelButton.html($.i18n._('core-buttons')["cancel"]);
var level = DialogSystem.showDialog(dialog); var level = DialogSystem.showDialog(dialog);
var dismiss = function() { var dismiss = function() {
DialogSystem.dismissUntil(level - 1); DialogSystem.dismissUntil(level - 1);
@ -196,6 +207,12 @@ ReconDialog.prototype._onAddNamespacedService = function() {
var dialog = $(DOM.loadHTML("core", "scripts/reconciliation/add-namespaced-service-dialog.html")); var dialog = $(DOM.loadHTML("core", "scripts/reconciliation/add-namespaced-service-dialog.html"));
var elmts = DOM.bind(dialog); var elmts = DOM.bind(dialog);
elmts.dialogHeader.html($.i18n._('core-recon')["add-recon-srv"]);
elmts.or_recon_namespace.html($.i18n._('core-recon')["namespace"]+":");
elmts.or_recon_entType.html($.i18n._('core-recon')["ent-type"]+":");
elmts.addButton.html($.i18n._('core-buttons')["add-service"]);
elmts.cancelButton.html($.i18n._('core-buttons')["cancel"]);
var level = DialogSystem.showDialog(dialog); var level = DialogSystem.showDialog(dialog);
var dismiss = function() { var dismiss = function() {
DialogSystem.dismissUntil(level - 1); DialogSystem.dismissUntil(level - 1);

View File

@ -75,7 +75,7 @@ ReconciliationManager.registerService = function(service) {
}; };
ReconciliationManager.registerStandardService = function(url, f) { ReconciliationManager.registerStandardService = function(url, f) {
var dismissBusy = DialogSystem.showBusy("Contacting reconciliation service..."); var dismissBusy = DialogSystem.showBusy($.i18n._('core-recon')["contact-service"]+"...");
$.ajax( $.ajax(
url, url,
@ -103,7 +103,7 @@ ReconciliationManager.registerStandardService = function(url, f) {
}) })
.error(function(jqXHR, textStatus, errorThrown) { .error(function(jqXHR, textStatus, errorThrown) {
dismissBusy(); dismissBusy();
alert('Error contacting recon service: ' + textStatus + ' : ' + errorThrown + ' - ' + url); alert($.i18n._('core-recon')["error-contact"]+': ' + textStatus + ' : ' + errorThrown + ' - ' + url);
}); });
}; };
@ -141,7 +141,7 @@ ReconciliationManager.save = function(f) {
(function() { (function() {
ReconciliationManager.customServices.push({ ReconciliationManager.customServices.push({
"name" : "Freebase Query-based Reconciliation", "name" : $.i18n._('core-recon')["fb-recon"],
"ui" : { "handler" : "ReconFreebaseQueryPanel" } "ui" : { "handler" : "ReconFreebaseQueryPanel" }
}); });

View File

@ -2,12 +2,12 @@
<div class="grid-layout layout-normal layout-full grid-layout-for-ui"><table> <div class="grid-layout layout-normal layout-full grid-layout-for-ui"><table>
<tr> <tr>
<td colspan="2" style="text-align: right;"> <td colspan="2" style="text-align: right;">
&raquo; Access <a href="" target="_blank" bind="rawServiceLink">Service API</a> <span bind="or_proc_access"></span> <a href="" target="_blank" bind="rawServiceLink"></a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Reconcile each cell to an entity of one of these types:</td> <td bind="or_proc_cellType"></td>
<td>Also use relevant details from other columns:</td> <td bind="or_proc_colDetail"></td>
</tr> </tr>
<tr> <tr>
<td><div class="type-container" bind="typeContainer"></div></td> <td><div class="type-container" bind="typeContainer"></div></td>
@ -15,18 +15,18 @@
</tr> </tr>
<tr> <tr>
<td><input type="radio" name="type-choice" value=""> <td><input type="radio" name="type-choice" value="">
Reconcile against type: <input size="20" bind="typeInput" /></td> <span bind="or_proc_againsType"></span> <input size="20" bind="typeInput" /></td>
<td> <td>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><input type="radio" name="type-choice" value="-"> <td><input type="radio" name="type-choice" value="-">
Reconcile against no particular type</td> <span bind="or_proc_noType"></span></td>
<td> <td>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><input type="checkbox" checked bind="automatchCheck" /> Auto-match candidates with high confidence</td> <td><input type="checkbox" checked bind="automatchCheck" /> <span bind="or_proc_autoMatch"></span></td>
<td></td> <td></td>
</tr> </tr>
</table></div> </table></div>

View File

@ -83,6 +83,14 @@ ReconStandardServicePanel.prototype._constructUI = function() {
this._panel = $(DOM.loadHTML("core", "scripts/reconciliation/standard-service-panel.html")).appendTo(this._container); this._panel = $(DOM.loadHTML("core", "scripts/reconciliation/standard-service-panel.html")).appendTo(this._container);
this._elmts = DOM.bind(this._panel); this._elmts = DOM.bind(this._panel);
this._elmts.or_proc_access.html("&raquo; "+$.i18n._('core-recon')["access"]);
this._elmts.rawServiceLink.html($.i18n._('core-recon')["service-api"]);
this._elmts.or_proc_cellType.html($.i18n._('core-recon')["cell-type"]+":");
this._elmts.or_proc_colDetail.html($.i18n._('core-recon')["col-detail"]+":");
this._elmts.or_proc_againsType.html($.i18n._('core-recon')["against-type"]+":");
this._elmts.or_proc_noType.html($.i18n._('core-recon')["no-type"]);
this._elmts.or_proc_autoMatch.html($.i18n._('core-recon')["auto-match"]);
this._elmts.rawServiceLink.attr("href", this._service.url); this._elmts.rawServiceLink.attr("href", this._service.url);
this._guessTypes(function() { this._guessTypes(function() {
@ -157,7 +165,7 @@ ReconStandardServicePanel.prototype._populatePanel = function() {
} else { } else {
$('<div>') $('<div>')
.addClass("recon-dialog-standard-service-panel-message") .addClass("recon-dialog-standard-service-panel-message")
.text("Sorry, we can't suggest any type for your data. Please specify a type yourself below.") .text($.i18n._('core-recon')["warning-type-sugg"])
.appendTo(this._elmts.typeContainer); .appendTo(this._elmts.typeContainer);
this._panel this._panel
@ -176,7 +184,7 @@ ReconStandardServicePanel.prototype._populatePanel = function() {
var detailTable = $( var detailTable = $(
'<table>' + '<table>' +
'<tr><th>Column</th><th>Include?</th><th>As Property</th></tr>' + '<tr><th>'+$.i18n._('core-recon')["column"]+'</th><th>'+$.i18n._('core-recon')["include"]+'?</th><th>'+$.i18n._('core-recon')["as-property"]+'</th></tr>' +
'</table>' '</table>'
).appendTo(detailTableContainer)[0]; ).appendTo(detailTableContainer)[0];

View File

@ -320,6 +320,36 @@
"continue-remaining": "Continue with the remaining operations", "continue-remaining": "Continue with the remaining operations",
"undo": "Undo" "undo": "Undo"
}, },
"core-recon": {
"access": "Access",
"service-api": "Service API",
"cell-type": "Reconcile each cell to an entity of one of these types",
"col-detail": "Also use relevant details from other columns",
"against-type": "Reconcile against type",
"no-type": "Reconcile against no particular type",
"auto-match": "Auto-match candidates with high confidence",
"warning-type-sugg": "Sorry, we can't suggest any type for your data. Please specify a type yourself below.",
"column": "Column",
"include": "Include",
"as-property": "As Property",
"contact-service": "Contacting reconciliation service",
"error-contact": "Error contacting recon service",
"fb-recon": "Freebase Query-based Reconciliation",
"recon-col": "Reconcile column",
"pick-service": "Pick a Service or Extension on Left",
"add-recon-srv": "Add Namespaced Reconciliation Service",
"namespace": "Namespace",
"ent-type": "Type of Entities (optional)",
"add-std-srv": "Add Standard Reconciliation Service",
"enter-url": "Enter the service's URL",
"specify-ns": "Please specify a namespace.",
"cell-contains": "Each cell contains:",
"fb-id": "a Freebase ID, e.g., /en/solar_system",
"fb-guid": "a Freebase GUID, e.g., #9202a8c04000641f80000000000354ae",
"fb-key": "a Freebase key in",
"fb-en-ns": "the Wikipedia English namespace",
"this-ns": "this namespace:"
},
"core-buttons": { "core-buttons": {
"cancel": "Cancel", "cancel": "Cancel",
"ok": "&nbsp;&nbsp;OK&nbsp;&nbsp;", "ok": "&nbsp;&nbsp;OK&nbsp;&nbsp;",
@ -351,6 +381,10 @@
"refresh": "Refresh", "refresh": "Refresh",
"reset-all": "Reset All", "reset-all": "Reset All",
"remove-all": "Remove All", "remove-all": "Remove All",
"perform-op": "Perform Operations" "perform-op": "Perform Operations",
"add-std-svc": "Add Standard Service",
"add-named-svc": "Add Namespaced Service",
"start-recon": "Start Reconciling",
"add-service": "Add Service"
} }
} }