Freebase extension internationalized

Added IT translation
This commit is contained in:
Blakko 2013-06-27 12:03:51 +02:00
parent 817c6cc8d4
commit 3acc5291ce
15 changed files with 614 additions and 121 deletions

View File

@ -59,6 +59,7 @@ function init() {
RS.registerCommand(module, "import-qa-data", new Packages.com.google.refine.freebase.commands.ImportQADataCommand());
RS.registerCommand(module, "mqlread", new Packages.com.google.refine.freebase.commands.MQLReadCommand());
RS.registerCommand(module, "mqlwrite", new Packages.com.google.refine.freebase.commands.MQLWriteCommand());
RS.registerCommand(module, "load-language", new Packages.com.google.refine.freebase.commands.LoadLanguageCommand());
var OR = Packages.com.google.refine.operations.OperationRegistry;

View File

@ -0,0 +1,114 @@
{
"fb-schema-alignment": {
"close-confirm": "There are unsaved changes. Close anyway?",
"status-warning": "There are unsaved changes.",
"assert-link-found": "Assert link when 'true' is found in column",
"search-pick-property": "Search for a property or pick one below",
"search-property": "Search for a property",
"cell": "cell",
"cells": "cells",
"which-column": "Which column?",
"configure": "Configure...",
"which-topic": "Which topic?",
"what-value": "What value?",
"anonymous": "anonymous",
"add-property": "add property",
"anonymous-node": "Anonymous Node",
"freebase-topic": "Freebase Topic",
"value": "Value",
"skeleton-node": "Schema Alignment Skeleton Node",
"text": "text",
"int": "int",
"float": "float",
"double": "double",
"boolean": "boolean",
"date-time": "date/time",
"rawstring": "rawstring",
"set-to-cell": "Set to Cell in Column",
"cell-content-used": "The cell's content is used ...",
"specify-fb-topic": "to specify a Freebase topic, as reconciled",
"type-new-topics": "Type new topics as",
"literal-value": "as a literal value",
"literal-type": "Literal type",
"text-language": "Text language",
"key-namespace": "as a key in a namespace",
"namespace": "Namespace",
"generate-anonymous": "Generate an anonymous graph node",
"assign-type": "Assign a type to the node",
"use-existing-topic": "Use one existing Freebase topic",
"value-type": "Value type",
"language": "Language",
"use-literal-value": "Use a literal value",
"column-warning": "You must select at least one column",
"new-node-warning": "For creating a new graph node, you need to specify a type for it.",
"namespace-warning": "Please specify the namespace.",
"anonymous-node-warning": "For generating an anonymous graph node, you need to specify a type for it",
"specify-topic-warning": "Please specify which existing Freebase topic to use",
"specify-value-warning": "Please specify the value to use"
},
"fb-interface": {
"dialog-header": "Align to Freebase's Schemas",
"body-text": "The schema alignment skeleton below specifies how your grid-shaped data will be transformed into graph-shaped data in Freebase's schemas.",
"find-more": "Find out more ...",
"skeleton": "Skeleton",
"mql-preview": "MQL-like Preview",
"tripleloader-preview": "TripleLoader Preview"
},
"fb-dialogs": {
"sign-in": "Sign into Freebase",
"enable-loading": "to enable loading",
"error-new-topic": "Error creating new topic",
"error-loading-data": "Error loading data",
"add-info-source": "Click here to add a new information source",
"dialog-header": "Load Data into Freebase",
"no-triples-dataset": "This dataset has no triples",
"warning-aligned": "Have you aligned it with Freebase's schemas yet?",
"name-of-data": "Name of data load",
"source-id": "Source ID (optional)",
"bodytext-1": "Note: Your data will only be loaded into",
"bodytext-2": "Sandbox is where everyone can experiment with Freebase technologies without disruption to the official",
"bodytext-3": "Sandbox gets",
"sandbox-link": " Sandbox",
"freebase-link": " Freebase",
"refreshed-link": " refreshed periodically",
"bodytext-4": "In order to load your data into the official Freebase, you must first load it into Sandbox. Then it must pass a Quality Assurance (QA) process before it can be loaded into Freebase proper.",
"quality-assurance": "Quality assurance",
"bodytext-5": "After loaded into Sandbox, enlist other people's help to double-check this data load's quality so that it can be loaded into Freebase.",
"triple-schedule": "triples successfully scheduled for loading",
"follow-progress": "Follow the loading progress in the ",
"refinery-link": "Freebase Refinery",
"signed-as": "Signed in as:",
"sign-out": "Sign Out"
},
"fb-qa": {
"header": "QA Data Load?",
"bodytext-1": "Other people will be enlisted to help double-check your data load for quality assurance purposes. Their time and labor have a cost.",
"bodytext-2": "You yourself should have taken all reasonable measures to eliminate errors from your data load. Your prudence is greatly appreciated.",
"tell-more": "Tell me more ...",
"ok-button": "Yes, QA Data Load"
},
"fb-extend": {
"add-column": "Add Columns from Freebase Based on Column",
"warning-add-properties": "Please add some properties first.",
"querying-freebase": "Querying Freebase ...",
"remove-column": "Remove this column",
"add-constraints": "Add constraints to this column",
"mql-constraints": "Enter MQL query constraints as JSON",
"warning-valid-json": "Please ensure that the JSON you enter is valid.",
"warning-json-obj": "The JSON you enter must be an object, that is, it is of this form { ... }.",
"app-property": "Add Property",
"suggested-properties": "Suggested Properties"
},
"fb-buttons": {
"save": "Save",
"save-load": "Save & Load",
"close": "Close",
"reset": "Reset",
"cancel": "Cancel",
"align-now": "Align Now",
"settings": "Settings",
"preview": "Preview",
"load-sandbox": "Load to Sandbox",
"ok": "Ok"
}
}

View File

@ -0,0 +1,124 @@
{
"fb-schema-alignment": {
"close-confirm": "There are unsaved changes. Close anyway?",
"status-warning": "There are unsaved changes.",
"assert-link-found": "Assert link when 'true' is found in column",
"search-pick-property": "Search for a property or pick one below",
"search-property": "Search for a property",
"cell": "cell",
"cells": "cells",
"which-column": "Which column?",
"configure": "Configure...",
"which-topic": "Which topic?",
"what-value": "What value?",
"anonymous": "anonymous",
"add-property": "add property",
"anonymous-node": "Anonymous Node",
"freebase-topic": "Freebase Topic",
"value": "Value",
"skeleton-node": "Schema Alignment Skeleton Node",
"text": "text",
"int": "int",
"float": "float",
"double": "double",
"boolean": "boolean",
"date-time": "date/time",
"rawstring": "rawstring",
"set-to-cell": "Set to Cell in Column",
"cell-content-used": "The cell's content is used ...",
"specify-fb-topic": "to specify a Freebase topic, as reconciled",
"type-new-topics": "Type new topics as",
"literal-value": "as a literal value",
"literal-type": "Literal type",
"text-language": "Text language",
"key-namespace": "as a key in a namespace",
"namespace": "Namespace",
"generate-anonymous": "Generate an anonymous graph node",
"assign-type": "Assign a type to the node",
"use-existing-topic": "Use one existing Freebase topic",
"value-type": "Value type",
"language": "Language",
"use-literal-value": "Use a literal value",
"column-warning": "You must select at least one column",
"new-node-warning": "For creating a new graph node, you need to specify a type for it.",
"namespace-warning": "Please specify the namespace.",
"anonymous-node-warning": "For generating an anonymous graph node, you need to specify a type for it.",
"specify-topic-warning": "Please specify which existing Freebase topic to use",
"specify-value-warning": "Please specify the value to use"
},
"fb-interface": {
"dialog-header": "Align to Freebase's Schemas",
"body-text": "The schema alignment skeleton below specifies how your grid-shaped data will be transformed into graph-shaped data in Freebase's schemas.",
"find-more": "Find out more ...",
"skeleton": "Skeleton",
"mql-preview": "MQL-like Preview",
"tripleloader-preview": "TripleLoader Preview"
},
"fb-dialogs": {
"sign-in": "Sign into Freebase",
"enable-loading": "to enable loading",
"error-new-topic": "Error creating new topic",
"error-loading-data": "Error loading data",
"add-info-source": "Click here to add a new information source",
"dialog-header": "Load Data into Freebase",
"no-triples-dataset": "This dataset has no triples",
"warning-aligned": "Have you aligned it with Freebase's schemas yet?",
"name-of-data": "Name of data load",
"source-id": "Source ID (optional)",
"bodytext-1": "Note: Your data will only be loaded into",
"bodytext-2": "Sandbox is where everyone can experiment with Freebase technologies without disruption to the official",
"bodytext-3": "Sandbox gets",
"sandbox-link": " Sandbox",
"freebase-link": " Freebase",
"refreshed-link": " refreshed periodically",
"bodytext-4": "In order to load your data into the official Freebase, you must first load it into Sandbox. Then it must pass a Quality Assurance (QA) process before it can be loaded into Freebase proper.",
"quality-assurance": "Quality assurance",
"bodytext-5": "After loaded into Sandbox, enlist other people's help to double-check this data load's quality so that it can be loaded into Freebase.",
"triple-schedule": "triples successfully scheduled for loading",
"follow-progress": "Follow the loading progress in the ",
"refinery-link": "Freebase Refinery",
"signed-as": "Signed in as:",
"sign-out": "Sign Out"
},
"fb-qa": {
"header": "QA Data Load?",
"bodytext-1": "Other people will be enlisted to help double-check your data load for quality assurance purposes. Their time and labor have a cost.",
"bodytext-2": "You yourself should have taken all reasonable measures to eliminate errors from your data load. Your prudence is greatly appreciated.",
"tell-more": "Tell me more ...",
"ok-button": "Yes, QA Data Load"
},
"fb-extend": {
"add-column": "Add Columns from Freebase Based on Column",
"warning-add-properties": "Please add some properties first.",
"querying-freebase": "Querying Freebase ...",
"remove-column": "Remove this column",
"add-constraints": "Add constraints to this column",
"mql-constraints": "Enter MQL query constraints as JSON",
"warning-valid-json": "Please ensure that the JSON you enter is valid.",
"warning-json-obj": "The JSON you enter must be an object, that is, it is of this form { ... }.",
"app-property": "Add Property",
"suggested-properties": "Suggested Properties"
},
"fb-menu": {
"freebase": "Freebase",
"set-api-key": "Set Freebase API Key",
"align-schema": "Align to Freebase's schemas...",
"load": "Load into Freebase...",
"browse-data-load": "Browse data load details...",
"import-qa": "Import QA data",
"add-columns": "Add columns from Freebase ...",
"warning-load": "You have not tried to load the data in this project into Freebase yet."
},
"fb-buttons": {
"save": "Save",
"save-load": "Save & Load",
"close": "Close",
"reset": "Reset",
"cancel": "Cancel",
"align-now": "Align Now",
"settings": "Settings",
"preview": "Preview",
"load-sandbox": "Load to Sandbox",
"ok": "Ok"
}
}

View File

@ -0,0 +1,124 @@
{
"fb-schema-alignment": {
"close-confirm": "Ci sono cambiamenti non salvati. Chiudere comunque?",
"status-warning": "Ci sono cambiamenti non salvati.",
"assert-link-found": "Assert link when 'true' is found in column",
"search-pick-property": "Cerca una proprietà o scegline una dalle seguenti",
"search-property": "Cerca una proprietà",
"cell": "cella",
"cells": "celle",
"which-column": "Quale colonna?",
"configure": "Configura...",
"which-topic": "Quale topic?",
"what-value": "Quale valore?",
"anonymous": "anonimo",
"add-property": "aggiungi proprietà",
"anonymous-node": "Nodo Anonimo",
"freebase-topic": "Topic Freebase",
"value": "Valore",
"skeleton-node": "Schema Alignment Skeleton Node",
"text": "testo",
"int": "int",
"float": "float",
"double": "double",
"boolean": "boolean",
"date-time": "data/ora",
"rawstring": "rawstring",
"set-to-cell": "Set to Cell in Column",
"cell-content-used": "Il contenuto della cella è usato ...",
"specify-fb-topic": "per specificare un topic Freebase, come riconciliato",
"type-new-topics": "Inserisci il nuovo topic come",
"literal-value": "come un valore letterale",
"literal-type": "Tipo letterale",
"text-language": "Lingua di testo",
"key-namespace": "come una chiave nel namespace",
"namespace": "Namespace",
"generate-anonymous": "Genera un nodo anonimo nel grafo",
"assign-type": "Assegna un tipo al nodo",
"use-existing-topic": "Usa un topic Freebase esistente",
"value-type": "Tipo valore",
"language": "Lingua",
"use-literal-value": "Usa un valore letterale",
"column-warning": "Devi selezionare almeno una colonna",
"new-node-warning": "Per creare un nuovo nodo nel grafo, devi specificarne un tipo.",
"namespace-warning": "Specifica il namespace.",
"anonymous-node-warning": "Per generare un nodo anonimo nel grafo, devi specificarne un tipo.",
"specify-topic-warning": "Per favore specifica quale topic esistente di Freebase usare",
"specify-value-warning": "Per favore specifica il valore da usare"
},
"fb-interface": {
"dialog-header": "Allinea con gli schemi Freebase",
"body-text": "Lo scheletro per l'allineamento della schema specifica come i tuoi dati in formato tabellare saranno trasformati in un formato a grafo con lo schema di Freebase.",
"find-more": "Per saperne di più ...",
"skeleton": "Scheletro",
"mql-preview": "MQL-like Preview",
"tripleloader-preview": "TripleLoader Preview"
},
"fb-dialogs": {
"sign-in": "Accedi a Freebase",
"enable-loading": "per abilitare il caricamento",
"error-new-topic": "Errore nella creazione di un nuovo topic",
"error-loading-data": "Errore durante il caricamento dei dati",
"add-info-source": "Clicca qui per aggiungere una nuova sorgente di informazioni",
"dialog-header": "Carica i dati in Freebase",
"no-triples-dataset": "Questo dataset non ha triple",
"warning-aligned": "Hai già effettuato l'allineamento con lo schema Freebase?",
"name-of-data": "Nome del caricamento dati",
"source-id": "ID sorgente (opzionale)",
"bodytext-1": "Nota: i tuoi dati saranno caricati solamente in",
"bodytext-2": "Sandbox è dove chiunque può sperimentare le tecnologie Freebase senza creare danni all'ufficiale",
"bodytext-3": "Sandbox viene",
"sandbox-link": " Sandbox",
"freebase-link": " Freebase",
"refreshed-link": " aggiornata periodicamente",
"bodytext-4": "Per caricare i tuoi data su Freebase ufficiale, devi prima caricarli nel Sandbox. Successivamente, devono passare un processo di analisi qualitativa prima di essere caricati su Freebase.",
"quality-assurance": "Analisi qualitativa",
"bodytext-5": "Dopo essere caricati nella Sandbox, viene chiesto l'aiuto di altre persone per controllare due volte la qualità di questi dati in modo da poter poi essere caricati in Freebase.",
"triple-schedule": "triple pianificate con successo per il caricamento",
"follow-progress": "Segui il processo di caricamento nel ",
"refinery-link": "Freebase Refinery",
"signed-as": "Accesso effettuato come:",
"sign-out": "Esci"
},
"fb-qa": {
"header": "Caricamento dati con analisi qualitativa?",
"bodytext-1": "Alcune persone verranno incaricate per controllare i tuoi dati allo scopo di verificarne la qualità. Il loro tempo e lavoro ha un costo.",
"bodytext-2": "Tu stesso dovresti aver già effettuato la maggior parte dei controlli per assicurarti di aver rimosso errori dai dati. La tua prudenza è enormemente apprezzata.",
"tell-more": "Dimmi di più ...",
"ok-button": "Si, Caricamento dati con analisi qualitativa"
},
"fb-extend": {
"add-column": "Aggiungi colonne da Freebase basandoti sulla colonna",
"warning-add-properties": "Prima aggiungi delle proprietà.",
"querying-freebase": "Interrogando Freebase ...",
"remove-column": "Rimuovi questa colonna",
"add-constraints": "Aggiungi vincoli a questa colonna",
"mql-constraints": "Inserisci i vincoli per la query MQL come JSON",
"warning-valid-json": "Assicurati che l'oggetto JSON inserito sia valido.",
"warning-json-obj": "Il JSON che inserisci deve essere un oggetto, cioè in questa forma: { ... }.",
"app-property": "Aggiungi Proprietà",
"suggested-properties": "Proprietà suggerite"
},
"fb-menu": {
"freebase": "Freebase",
"set-api-key": "Imposta l'API Key Freebase",
"align-schema": "Allinea con lo schema Freebase...",
"load": "Carica in Freebase...",
"browse-data-load": "Vedi i dettagli per il caricamento dati...",
"import-qa": "Importa dati con controllo qualità",
"add-columns": "Aggiungi colonne da Freebase ...",
"warning-load": "Non hai ancora provato a caricare i dati di questo progetto in Freebase."
},
"fb-buttons": {
"save": "Salva",
"save-load": "Salva & Carica",
"close": "Chiudi",
"reset": "Reset",
"cancel": "cancella",
"align-now": "Allinea adesso",
"settings": "Settings",
"preview": "Preview",
"load-sandbox": "Carica nella Sandbox",
"ok": "Ok"
}
}

View File

@ -1,17 +1,12 @@
<div class="dialog-frame" style="width: 400px;">
<div class="dialog-header" bind="dialogHeader">QA Data Load?</div>
<div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody">
<p class="body-text">Other people will be enlisted to help double-check
your data load for quality assurance purposes. Their time and labor
have a cost.
</p>
<p class="body-text">You yourself should have taken all reasonable measures
to eliminate errors from your data load. Your prudence is greatly appreciated.
</p>
<p><a href="http://wiki.freebase.com/wiki/Refinery" target="_blank">Tell me more ...</a></p>
<p class="body-text" bind="bodytext1"></p>
<p class="body-text" bind="bodytext2"></p>
<p><a href="http://wiki.freebase.com/wiki/Refinery" target="_blank" bind="tellMore"></a></p>
</div>
<div class="dialog-footer" bind="dialogFooter">
<button class="button" bind="okButton">Yes, QA Data Load</button>
<button class="button" bind="cancelButton">Cancel</button>
<button class="button" bind="okButton"></button>
<button class="button" bind="cancelButton"></button>
</div>
</div>

View File

@ -3,16 +3,16 @@
<div class="dialog-body" bind="dialogBody">
<div class="grid-layout layout-normal layout-full"><table rows="4">
<tr>
<td width="300" height="1">Add Property</td>
<td width="300" height="1" bind="add_property"></td>
<td height="1">Preview</td>
<td height="1" width="1%"><button class="button" bind="resetButton">Reset</button></td>
<td height="1" width="1%"><button class="button" bind="resetButton"></button></td>
</tr>
<tr>
<td style="vertical-align: top;" height="1"><div class="input-container"><input bind="addPropertyInput" /></div></td>
<td style="vertical-align: top;" rowspan="3" colspan="2"><div class="preview-container" bind="previewContainer"></div></td>
</tr>
<tr>
<td height="1">Suggested Properties</td>
<td height="1" bind="suggested_properties"></td>
</tr>
<tr>
<td><div class="suggested-property-container" bind="suggestedPropertyContainer"></div></td>
@ -20,7 +20,7 @@
</table></div>
</div>
<div class="dialog-footer" bind="dialogFooter">
<button class="button" bind="okButton">&nbsp;&nbsp;OK&nbsp;&nbsp;</button>
<button class="button" bind="cancelButton">Cancel</button>
<button class="button" bind="okButton"></button>
<button class="button" bind="cancelButton"></button>
</div>
</div>

View File

@ -41,15 +41,23 @@ function ExtendDataPreviewDialog(column, columnIndex, rowIndices, onDone) {
var self = this;
this._dialog = $(DOM.loadHTML("freebase", "scripts/dialogs/extend-data-preview-dialog.html"));
this._elmts = DOM.bind(this._dialog);
this._elmts.dialogHeader.text("Add Columns from Freebase Based on Column " + column.name);
this._elmts.dialogHeader.text($.i18n._('fb-extend')["add-column"]);
this._elmts.add_property.text($.i18n._('fb-extend')["add-property"]);
this._elmts.suggested_properties.text($.i18n._('fb-extend')["suggested-properties"]);
this._elmts.resetButton.text($.i18n._('fb-buttons')["reset"]);
this._elmts.okButton.text('&nbsp;&nbsp;'+$.i18n._('fb-buttons')["ok"]+'&nbsp;&nbsp;');
this._elmts.cancelButton.text($.i18n._('fb-buttons')["cancel"]);
this._elmts.resetButton.click(function() {
self._extension.properties = [];
self._update();
});
this._elmts.okButton.click(function() {
if (self._extension.properties.length === 0) {
alert("Please add some properties first.");
alert($.i18n._('fb-extend')["warning-add-properties"]);
} else {
DialogSystem.dismissUntil(self._level - 1);
self._onDone(self._extension);
@ -157,7 +165,7 @@ ExtendDataPreviewDialog.prototype._show = function(properties) {
};
ExtendDataPreviewDialog.prototype._update = function() {
this._elmts.previewContainer.empty().text("Querying Freebase ...");
this._elmts.previewContainer.empty().text($.i18n._('fb-extend')["querying-freebase"]);
var self = this;
var params = {
@ -234,7 +242,7 @@ ExtendDataPreviewDialog.prototype._renderPreview = function(data) {
$('<a href="javascript:{}"></a>')
.text("remove")
.addClass("action")
.attr("title", "Remove this column")
.attr("title", $.i18n._('fb-extend')["remove-column"])
.click(function() {
self._removeProperty(column.path);
}).appendTo(th);
@ -242,7 +250,7 @@ ExtendDataPreviewDialog.prototype._renderPreview = function(data) {
$('<a href="javascript:{}"></a>')
.text("constrain")
.addClass("action")
.attr("title", "Add constraints to this column")
.attr("title", $.i18n._('fb-extend')["add-constraints"])
.click(function() {
self._constrainProperty(column.path);
}).appendTo(th);
@ -336,7 +344,7 @@ ExtendDataPreviewDialog.prototype._constrainProperty = function(path) {
body.html(
'<div class="grid-layout layout-normal layout-full"><table>' +
'<tr><td>' +
'Enter MQL query constraints as JSON' +
$.i18n._('fb-extend')["mql-constraints"] +
'</td></tr>' +
'<tr><td>' +
'<textarea style="width: 100%; height: 300px; font-family: monospace;" bind="textarea"></textarea>' +
@ -353,7 +361,7 @@ ExtendDataPreviewDialog.prototype._constrainProperty = function(path) {
footer.html(
'<button class="button" bind="okButton">&nbsp;&nbsp;OK&nbsp;&nbsp;</button>' +
'<button class="button" bind="cancelButton">Cancel</button>'
'<button class="button" bind="cancelButton">'+$.i18n._('fb-buttons')["cancel"]+'</button>'
);
var footerElmts = DOM.bind(footer);
@ -367,7 +375,7 @@ ExtendDataPreviewDialog.prototype._constrainProperty = function(path) {
try {
var o = JSON.parse(bodyElmts.textarea[0].value);
if (o === undefined) {
alert("Please ensure that the JSON you enter is valid.");
alert($.i18n._('fb-extend')["warning-valid-json"]);
return;
}
@ -375,7 +383,7 @@ ExtendDataPreviewDialog.prototype._constrainProperty = function(path) {
o = o[0];
}
if (!$.isPlainObject(o)) {
alert("The JSON you enter must be an object, that is, it is of this form { ... }.");
alert($.i18n._('fb-extend')["warning-json-obj"]);
return;
}

View File

@ -1,44 +1,40 @@
<div class="dialog-frame" style="width: 800px;">
<div class="dialog-header" bind="dialogHeader">Load Data into Freebase</div>
<div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody">
<div bind="unalignedCase" style="display: none;" class="freebase-loading-tripleloader-message">
<h2>This dataset has no triples</h2>
<p>Have you aligned it with Freebase's schemas yet? <button class="button" bind="alignButton">Align Now</button></p>
<h2 bind="no_triples_dataset"></h2>
<p bind="warning_aligned"><button class="button" bind="alignButton"></button></p>
</div>
<div bind="functionalCase" style="display: none;">
<div class="refine-tabs" bind="functionalTabs">
<ul>
<li><a href="#freebase-loading-dialog-functional-tabs-settings">Settings</a></li>
<li><a href="#freebase-loading-dialog-functional-tabs-preview">Preview</a></li>
<li><a href="#freebase-loading-dialog-functional-tabs-settings" bind="settingsBtn"></a></li>
<li><a href="#freebase-loading-dialog-functional-tabs-preview" bind="previewBtn"></a></li>
</ul>
<div id="freebase-loading-dialog-functional-tabs-settings"
class="freebase-loading-dialog-functional-tab-panel"><div class="grid-layout layout-normal"><table>
<tr><td width="20%">Name of data load</td>
<tr><td width="20%" bind="name_of_data"></td>
<td colspan="2"><input type="text" size="40" id="freebase-loading-source-name" bind="source_name" /></td>
</tr>
<tr><td>Source ID (optional)</td>
<tr><td bind="source_id_label"></td>
<td colspan="2"><input type="text" size="60" id="freebase-loading-source-id" bind="source_id" /></td>
</tr>
<tr>
<td colspan="3">
<p class="body-text">Note: Your data will only be loaded into
<a href="http://www.sandbox-freebase.com/" target="_blank">Sandbox</a>.
Sandbox is where everyone can experiment with Freebase technologies without disruption
to the official <a href="http://www.freebase.com/">Freebase</a>. Sandbox gets
<a href="http://wiki.freebase.com/wiki/Sandbox" target="_blank">refreshed periodically</a>.
<p class="body-text"><span bind="bodytext1"></span>
<a href="http://www.sandbox-freebase.com/" target="_blank" bind="sandbox_link"></a>.
<span bind="bodytext2"> </span><a href="http://www.freebase.com/" bind="freebase_link"></a>.
<span bind="bodytext3"></span><a href="http://wiki.freebase.com/wiki/Sandbox"
target="_blank" bind="refreshed_link"></a>.
</p>
<p class="body-text">In order to load your data into the official Freebase, you must first load it
into Sandbox. Then it must pass a Quality Assurance (QA) process before it can
be loaded into Freebase proper.
<a href="http://wiki.freebase.com/wiki/Refinery" target="_blank">Find out more ...</a>
<p class="body-text" bind="bodytext4">
<a href="http://wiki.freebase.com/wiki/Refinery" target="_blank" bind="findOutMore"></a>
</p>
</td>
</tr>
<tr><td>Quality assurance</td>
<tr><td bind="quality_assurance"></td>
<td><input bind="qaCheckbox" type="checkbox" name="qa" value="qa" /></td>
<td>After loaded into Sandbox, enlist other people's help to double-check
this data load's quality so that it can be loaded into Freebase.
</td>
<td bind="bodytext5"></td>
</tr>
</table></div></div>
<div id="freebase-loading-dialog-functional-tabs-preview"
@ -49,8 +45,8 @@
</div>
</div>
<div bind="loadedCase" style="display: none;" class="freebase-loading-tripleloader-message">
<h2><span bind="tripleCountSpan"></span> triples successfully scheduled for loading</h2>
<h4>Follow the loading progress in the <a bind="refineryLink" target="_new">Freebase Refinery</a>.</h4>
<h2><span bind="tripleCountSpan"></span> <span bind="triple_success_load"></span></h2>
<h4><span bind="follow_progress"></span> <a bind="refineryLink" target="_new"></a>.</h4>
</div>
<div bind="errorCase" style="display: none;" class="freebase-loading-tripleloader-message">
<h2 bind="errorMessage"></h2>
@ -59,13 +55,13 @@
</div>
<div class="dialog-footer" bind="dialogFooter"><div class="grid-layout layout-normal layout-full"><table><tr>
<td bind="left" style="text-align: left" width="60%" nowrap="true">
<button class="button" bind="cancelButton" id="freebase-loading-cancel">Cancel</button>
<button class="button" bind="cancelButton" id="freebase-loading-cancel"></button>
</td>
<td bind="center" style="text-align: right" width="20%" nowrap="true">
<div bind="authorization" class="freebase-loading-authorization"></div>
</td>
<td bind="right" style="text-align: right" width="20%" nowrap="true">
<button class="button button-primary button-disabled" bind="loadButton" id="freebase-loading-load" disabled>Load to Sandbox</button>
<button class="button button-primary button-disabled" bind="loadButton" id="freebase-loading-load" disabled></button>
</td>
</tr></table></div></div>
</div>

View File

@ -45,13 +45,37 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
var provider = "freebase.com";
var authorization = this._elmts.authorization;
var loadButton = this._elmts.loadButton;
this._elmts.dialogHeader.text($.i18n._('fb-dialogs')["dialog-header"]);
this._elmts.no_triples_dataset.text($.i18n._('fb-dialogs')["no-triples-dataset"]);
this._elmts.warning_aligned.text($.i18n._('fb-dialogs')["warning-aligned"]);
this._elmts.alignButton.text($.i18n._('fb-buttons')["align-now"]);
this._elmts.settingsBtn.text($.i18n._('fb-buttons')["settings"]);
this._elmts.previewBtn.text($.i18n._('fb-buttons')["preview"]);
this._elmts.name_of_data.text($.i18n._('fb-dialogs')["name-of-data"]);
this._elmts.source_id_label.text($.i18n._('fb-dialogs')["source-id"]);
this._elmts.bodytext1.text($.i18n._('fb-dialogs')["bodytext-1"]);
this._elmts.bodytext2.text($.i18n._('fb-dialogs')["bodytext-2"]);
this._elmts.bodytext3.text($.i18n._('fb-dialogs')["bodytext-3"]);
this._elmts.sandbox_link.text($.i18n._('fb-dialogs')["sandbox-link"]);
this._elmts.freebase_link.text($.i18n._('fb-dialogs')["freebase-link"]);
this._elmts.refreshed_link.text($.i18n._('fb-dialogs')["refreshed-link"]);
this._elmts.bodytext4.text($.i18n._('fb-dialogs')["bodytext-4"]);
this._elmts.findOutMore.text($.i18n._('fb-interface')["find-more"]);
this._elmts.quality_assurance.text($.i18n._('fb-dialogs')["quality-assurance"]);
this._elmts.bodytext5.text($.i18n._('fb-dialogs')["bodytext-5"]);
this._elmts.triple_success_load.text($.i18n._('fb-dialogs')["triple-schedule"]);
this._elmts.follow_progress.text($.i18n._('fb-dialogs')["follow-progress"]);
this._elmts.refineryLink.text($.i18n._('fb-dialogs')["refinery-link"]);
this._elmts.cancelButton.text($.i18n._('fb-buttons')["cancel"]);
this._elmts.loadButton.text($.i18n._('fb-buttons')["load-sandbox"]);
// TODO: Does this need to be redone for the new API / freebase.com site?
var check_authorization = function(cont) {
var check_authorization_url = "command/freebase/check-authorization/" + provider;
$.get(check_authorization_url, function(data) {
if ("status" in data && data.code == "/api/status/ok") {
authorization.html('Signed in as: <a target="_new" href="http://www.freebase.com/view/user/' + data.username + '">' + data.username + '</a> | <a href="javascript:{}" bind="signout">Sign Out</a>').show();
authorization.html($.i18n._('fb-dialogs')["signed-as"]+' <a target="_new" href="http://www.freebase.com/view/user/' + data.username + '">' + data.username + '</a> | <a href="javascript:{}" bind="signout">'+$.i18n._('fb-dialogs')["sign-out"]+'</a>').show();
DOM.bind(authorization).signout.click(function() {
self._signedin = false;
loadButton.attr("disabled","disabled");
@ -71,7 +95,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
if (typeof cont == "function") cont(data);
} else {
authorization.html('<a href="javascript:{}" bind="signin">Sign into Freebase</a> to enable loading').show();
authorization.html('<a href="javascript:{}" bind="signin">'+$.i18n._('fb-dialogs')["sign-in"]+'</a> '+$.i18n._('fb-dialogs')["enable-loading"]).show();
self._signedin = false;
$("#freebase-loading-source-name").keyup();
@ -104,7 +128,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
self._elmts.source_id.val(data.result[0].id);
if (typeof cont == "function") cont();
} else {
self._show_error("Error creating new topic", data);
self._show_error($.i18n._('fb-dialogs')["error-new-topic"], data);
}
},
"json"
@ -137,7 +161,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
self._elmts.source_id.suggest({
filter: "(all type:/dataworld/information_source)",
suggest_new: "Click here to add a new information source"
suggest_new: $.i18n._('fb-dialogs')["add-info-source"]
}).bind("fb-select", function(e, data) {
self._elmts.source_id.val(data.id);
}).bind("fb-select-new", function(e, val) {
@ -202,7 +226,7 @@ FreebaseLoadingDialog.prototype._load = function() {
self._elmts.loadedCase.show();
self._end();
} else {
self._show_error("Error loading data",data);
self._show_error($.i18n._('fb-dialogs')["error-loading-data"],data);
}
},
"json"
@ -216,6 +240,13 @@ FreebaseLoadingDialog.prototype._load = function() {
var dismiss = function() {
DialogSystem.dismissUntil(level - 1);
};
this._elmts.refineryLink.text($.i18n._('fb-qa')["header"]);
this._elmts.bodytext1.text($.i18n._('fb-qa')["bodytext-1"]);
this._elmts.bodytext2.text($.i18n._('fb-qa')["bodytext-2"]);
this._elmts.tellMore.text($.i18n._('fb-qa')["tell-more"]);
this._elmts.okButton.text($.i18n._('fb-qa')["ok-button"]);
this._elmts.cancelButton.text($.i18n._('fb-qa')["ok-button"]);
elmts.okButton.click(function() {
doLoad();

View File

@ -234,6 +234,17 @@ SchemaAlignmentDialog.prototype._createDialog = function() {
DialogSystem.dismissUntil(self._level - 1);
};
elmts.dialogHeader.text($.i18n._('fb-interface')["dialog-header"]);
elmts.body_text.text($.i18n._('fb-interface')["body-text"]);
elmts.find_more.text($.i18n._('fb-interface')["find-more"]);
elmts.skeleton.text($.i18n._('fb-interface')["skeleton"]);
elmts.skeleton.text($.i18n._('fb-interface')["mql-preview"]);
elmts.skeleton.text($.i18n._('fb-interface')["tripleloader-preview"]);
elmts.saveButton.text($.i18n._('fb-buttons')["save"]);
elmts.saveAndLoadButton.text($.i18n._('fb-buttons')["save-load"]);
elmts.closeButton.text($.i18n._('fb-buttons')["close"]);
elmts.resetButton.text($.i18n._('fb-buttons')["reset"]);
elmts.saveButton.click(function() {
self._save();
});
@ -247,7 +258,7 @@ SchemaAlignmentDialog.prototype._createDialog = function() {
self._reset(null);
});
elmts.closeButton.click(function() {
if (!self._hasUnsavedChanges || window.confirm("There are unsaved changes. Close anyway?")) {
if (!self._hasUnsavedChanges || window.confirm($.i18n._('fb-schema-alignment')["close-confirm"])) {
dismiss();
}
});
@ -281,7 +292,7 @@ SchemaAlignmentDialog.prototype.preview = function(initial) {
this._previewPanes.empty();
if (!(initial)) {
this._elmts.statusIndicator.show().text("There are unsaved changes.");
this._elmts.statusIndicator.show().text($.i18n._('fb-schema-alignment')["status-warning"]);
this._hasUnsavedChanges = true;
}

View File

@ -1,16 +1,14 @@
<div class="dialog-frame" style="width: 800px;">
<div class="dialog-header" bind="dialogHeader">Align to Freebase's Schemas</div>
<div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody">
<p class="body-text">
The schema alignment skeleton below specifies how your grid-shaped data will be
transformed into graph-shaped data in Freebase's schemas.
<a href="http://code.google.com/p/google-refine/wiki/SchemaAlignment" target="_blank">Find out more ...</a>
<p class="body-text" bind="body_text">
<a href="http://code.google.com/p/google-refine/wiki/SchemaAlignment" target="_blank" bind="find_more"></a>
</p>
<div id="schema-alignment-tabs" class="refine-tabs">
<ul>
<li><a href="#schema-alignment-tabs-protograph">Skeleton</a></li>
<li><a href="#schema-alignment-tabs-preview-mqllike">MQL-like Preview</a></li>
<li><a href="#schema-alignment-tabs-preview-tripleloader">TripleLoader Preview</a></li>
<li><a href="#schema-alignment-tabs-protograph" bind="skeleton"></a></li>
<li><a href="#schema-alignment-tabs-preview-mqllike" bind="mql_preview"></a></li>
<li><a href="#schema-alignment-tabs-preview-tripleloader" bind="tripleloader_preview"></a></li>
</ul>
<div id="schema-alignment-tabs-protograph">
<div class="schema-alignment-dialog-canvas"></div>
@ -25,17 +23,17 @@
</div>
<div class="dialog-footer" bind="dialogFooter"><div class="grid-layout layout-normal layout-full"><table><tr>
<td>
<button class="button" bind="resetButton">Reset</button>
<button class="button" bind="resetButton"></button>
</td>
<td style="text-align:right;">
<button class="button button-primary" bind="saveButton">Save</button>
<button class="button" bind="saveAndLoadButton">Save &amp; Load</button>
<button class="button button-primary" bind="saveButton"></button>
<button class="button" bind="saveAndLoadButton"></button>
</td>
<td style="text-align:center;" width="30%">
<span class="schema-alignment-status-indicator" bind="statusIndicator"></span>
</td>
<td style="text-align:right;" width="1%">
<button class="button" bind="closeButton">Close</button>
<button class="button" bind="closeButton"></button>
</td>
</tr></table></div></div>
</div>

View File

@ -239,7 +239,7 @@ SchemaAlignmentDialog.UILink.prototype._showPropertySuggestPopup = function(elmt
var divConditional = $('<div>')
.addClass("schema-alignment-link-menu-section")
.html("Assert link when 'true' is found in column<br/>").appendTo(menu);
.html($.i18n._('fb-schema-alignment')["assert-link-found"]+"<br/>").appendTo(menu);
var conditionalSelect = $('<select>').appendTo(divConditional);
$('<option>')
@ -266,7 +266,7 @@ SchemaAlignmentDialog.UILink.prototype._showPropertySuggestPopup = function(elmt
divSearch = $('<div>')
.addClass("schema-alignment-link-menu-section")
.css("margin-bottom", "2em")
.html('<div>Search for a property or pick one below</div>').appendTo(menu);
.html('<div>'+$.i18n._('fb-schema-alignment')["search-pick-property"]+'</div>').appendTo(menu);
var createSuggestion = function(suggestion) {
var menuItem = MenuSystem.createMenuItem().appendTo(menu);
@ -296,7 +296,7 @@ SchemaAlignmentDialog.UILink.prototype._showPropertySuggestPopup = function(elmt
} else {
divSearch = $('<div>')
.addClass("schema-alignment-link-menu-section-last")
.html('<div>Search for a property</div>').appendTo(menu);
.html('<div>'+$.i18n._('fb-schema-alignment')["search-property"]+'</div>').appendTo(menu);
}
var input = $('<input />').appendTo($('<div>').appendTo(divSearch));

View File

@ -124,9 +124,12 @@ SchemaAlignmentDialog.UINode.prototype._renderMain = function() {
.appendTo(a);
}
$('<span>').text(this._node.columnNames.length > 1 ? " cells" : " cell").appendTo(a);
$('<span>').text(
this._node.columnNames.length > 1 ? " "
+ $.i18n._('fb-schema-alignment')["cells"] : " "
+ $.i18n._('fb-schema-alignment')["cell"]).appendTo(a);
} else {
a.html(this._options.mustBeCellTopic ? "Which column?" : "Configure...");
a.html(this._options.mustBeCellTopic ? $.i18n._('fb-schema-alignment')["which-column"] : $.i18n._('fb-schema-alignment')["configure"]);
}
} else if (this._node.nodeType == "topic") {
if ("topic" in this._node) {
@ -134,16 +137,16 @@ SchemaAlignmentDialog.UINode.prototype._renderMain = function() {
} else if ("id" in this._node) {
a.html(this._node.topic.id);
} else {
a.html("Which topic?");
a.html($.i18n._('fb-schema-alignment')["which-topic"]);
}
} else if (this._node.nodeType == "value") {
if ("value" in this._node) {
a.html(this._node.value);
} else {
a.html("What value?");
a.html($.i18n._('fb-schema-alignment')["what-value"]);
}
} else if (this._node.nodeType == "anonymous") {
a.html("(anonymous)");
a.html("("+$.i18n._('fb-schema-alignment')["anonymous"]+")");
}
};
@ -212,7 +215,7 @@ SchemaAlignmentDialog.UINode.prototype._renderDetails = function() {
$('<a href="javascript:{}"></a>')
.addClass("action")
.text("add property")
.text($.i18n._('fb-schema-alignment')["add-property"])
.appendTo(divFooter)
.click(function() {
var newLink = {
@ -241,7 +244,7 @@ SchemaAlignmentDialog.UINode.prototype._showColumnPopupMenu = function(elmt) {
if (!this._options.mustBeCellTopic) {
menu.push({
label: "Anonymous Node",
label: $.i18n._('fb-schema-alignment')["anonymous-node"],
click: function() {
self._node.nodeType = "anonymous";
self._showExpandable();
@ -249,7 +252,7 @@ SchemaAlignmentDialog.UINode.prototype._showColumnPopupMenu = function(elmt) {
}
});
menu.push({
label: "Freebase Topic",
label: $.i18n._('fb-schema-alignment')["freebase-topic"],
click: function() {
self._node.nodeType = "topic";
self._hideExpandable();
@ -257,7 +260,7 @@ SchemaAlignmentDialog.UINode.prototype._showColumnPopupMenu = function(elmt) {
}
});
menu.push({
label: "Value",
label: $.i18n._('fb-schema-alignment')["value"],
click: function() {
self._node.nodeType = "value";
self._hideExpandable();
@ -292,7 +295,7 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
frame.width("750px");
var header = $('<div></div>').addClass("dialog-header").text("Schema Alignment Skeleton Node").appendTo(frame);
var header = $('<div></div>').addClass("dialog-header").text($.i18n._('fb-schema-alignment')["skeleton-node"]).appendTo(frame);
var body = $('<div></div>').addClass("dialog-body").appendTo(frame);
var footer = $('<div></div>').addClass("dialog-footer").appendTo(frame);
@ -301,13 +304,13 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
*--------------------------------------------------
*/
var literalTypeSelectHtml =
'<option value="/type/text" checked>text</option>' +
'<option value="/type/int">int</option>' +
'<option value="/type/float">float</option>' +
'<option value="/type/double">double</option>' +
'<option value="/type/boolean">boolean</option>' +
'<option value="/type/datetime">date/time</option>' +
'<option value="/type/rawstring">rawstring</option>';
'<option value="/type/text" checked>'+$.i18n._('fb-schema-alignment')["text"]+'</option>' +
'<option value="/type/int">'+$.i18n._('fb-schema-alignment')["int"]+'</option>' +
'<option value="/type/float">'+$.i18n._('fb-schema-alignment')["float"]+'</option>' +
'<option value="/type/double">'+$.i18n._('fb-schema-alignment')["double"]+'</option>' +
'<option value="/type/boolean">'+$.i18n._('fb-schema-alignment')["boolean"]+'</option>' +
'<option value="/type/datetime">'+$.i18n._('fb-schema-alignment')["date-time"]+'</option>' +
'<option value="/type/rawstring">'+$.i18n._('fb-schema-alignment')["rawstring"]+'</option>';
var html = $(
'<div class="grid-layout layout-looser layout-full"><table>' +
@ -317,7 +320,7 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
'<tr>' +
'<td>' +
'<div class="schema-align-node-dialog-node-type">' +
'<input type="radio" name="schema-align-node-dialog-node-type" value="cell-as" bind="radioNodeTypeCellAs" /> Set to Cell in Column' +
'<input type="radio" name="schema-align-node-dialog-node-type" value="cell-as" bind="radioNodeTypeCellAs" /> '+$.i18n._('fb-schema-alignment')["set-to-cell"]+'' +
'</div>' +
'</td>' +
'</tr>' +
@ -329,15 +332,15 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
'<td>' +
'<div class="grid-layout layout-tight"><table cols="4">' +
'<tr>' +
'<td colspan="4">The cell\'s content is used ...</td>' +
'<td colspan="4">'+$.i18n._('fb-schema-alignment')["cell-content-used"]+'</td>' +
'</tr>' +
'<tr>' +
'<td><input type="radio" name="schema-align-node-dialog-node-subtype" value="cell-as-topic" bind="radioNodeTypeCellAsTopic" /></td>' +
'<td colspan="3">to specify a Freebase topic, as reconciled</td>' +
'<td colspan="3">'+$.i18n._('fb-schema-alignment')["specify-fb-topic"]+'</td>' +
'</tr>' +
'<tr>' +
'<td></td>' +
'<td colspan="3">Type new topics as</td>' +
'<td colspan="3">'+$.i18n._('fb-schema-alignment')["type-new-topic"]+'</td>' +
'</tr>' +
'<tr>' +
'<td></td>' +
@ -345,26 +348,26 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
'</tr>' +
'<tr>' +
'<td><input type="radio" name="schema-align-node-dialog-node-subtype" value="cell-as-value" bind="radioNodeTypeCellAsValue" /></td>' +
'<td colspan="3">as a literal value</td>' +
'<td colspan="3">'+$.i18n._('fb-schema-alignment')["literal-value"]+'</td>' +
'</tr>' +
'<tr>' +
'<td></td>' +
'<td colspan="2">Literal type</td>' +
'<td colspan="2">'+$.i18n._('fb-schema-alignment')["literal-type"]+'</td>' +
'<td colspan="1"><select bind="cellAsValueTypeSelect">' + literalTypeSelectHtml + '</select></td>' +
'</tr>' +
'<tr>' +
'<td></td>' +
'<td colspan="2">Text language</td>' +
'<td colspan="2">'+$.i18n._('fb-schema-alignment')["text-language"]+'</td>' +
'<td colspan="1"><input bind="cellAsValueLanguageInput" /></td>' +
'</tr>' +
'<tr>' +
'<td><input type="radio" name="schema-align-node-dialog-node-subtype" value="cell-as-key" bind="radioNodeTypeCellAsKey" /></td>' +
'<td colspan="3">as a key in a namespace</td>' +
'<td colspan="3">'+$.i18n._('fb-schema-alignment')["key-namespace"]+'</td>' +
'</tr>' +
'<tr>' +
'<td></td>' +
'<td colspan="2">Namespace</td>' +
'<td colspan="2">'+$.i18n._('fb-schema-alignment')["namespace"]+'</td>' +
'<td colspan="1"><input bind="cellAsKeyInput" /></td>' +
'</tr>' +
'</table></div>' +
@ -381,20 +384,20 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
'<tr>' +
'<td colspan="3">' +
'<div class="schema-align-node-dialog-node-type">' +
'<input type="radio" name="schema-align-node-dialog-node-type" value="anonymous" bind="radioNodeTypeAnonymous" /> Generate an anonymous graph node' +
'<input type="radio" name="schema-align-node-dialog-node-type" value="anonymous" bind="radioNodeTypeAnonymous" /> '+$.i18n._('fb-schema-alignment')["generate-anonymous"]+'' +
'</div>' +
'</td>' +
'</tr>' +
'<tr>' +
'<td></td>' +
'<td>Assign a type to the node</td>' +
'<td>'+$.i18n._('fb-schema-alignment')["assign-type"]+'</td>' +
'<td>&nbsp;<input bind="anonymousNodeTypeInput" /></td>' +
'</tr>' +
'<tr>' +
'<td colspan="3">' +
'<div class="schema-align-node-dialog-node-type">' +
'<input type="radio" name="schema-align-node-dialog-node-type" value="topic" bind="radioNodeTypeTopic" /> Use one existing Freebase topic' +
'<input type="radio" name="schema-align-node-dialog-node-type" value="topic" bind="radioNodeTypeTopic" /> '+$.i18n._('fb-schema-alignment')["use-existing-topic"]+'' +
'</div>' +
'</td>' +
'</tr>' +
@ -407,23 +410,23 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
'<tr>' +
'<td colspan="3">' +
'<div class="schema-align-node-dialog-node-type">' +
'<input type="radio" name="schema-align-node-dialog-node-type" value="value" bind="radioNodeTypeValue" /> Use a literal value' +
'<input type="radio" name="schema-align-node-dialog-node-type" value="value" bind="radioNodeTypeValue" /> '+$.i18n._('fb-schema-alignment')["use-literal-value"]+
'</div>' +
'</td>' +
'</tr>' +
'<tr>' +
'<td></td>' +
'<td>Value</td>' +
'<td>'+$.i18n._('fb-schema-alignment')["value"]+'</td>' +
'<td><input bind="valueNodeTypeValueInput" /></td>' +
'</tr>' +
'<tr>' +
'<td></td>' +
'<td>Value type</td>' +
'<td>'+$.i18n._('fb-schema-alignment')["value-type"]+'</td>' +
'<td><select bind="valueNodeTypeValueTypeSelect">' + literalTypeSelectHtml + '</select></td>' +
'</tr>' +
'<tr>' +
'<td></td>' +
'<td>Language</td>' +
'<td>'+$.i18n._('fb-schema-alignment')["language"]+'</td>' +
'<td><input bind="valueNodeTypeLanguageInput" /></td>' +
'</tr>' +
'</table></div>' +
@ -581,14 +584,14 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
}).get();
if (node.columnNames.length == 0) {
alert("You must select at least one column.");
alert($.i18n._('fb-schema-alignment')["column-warning"]);
return null;
}
if (node.nodeType == "cell-as-topic") {
var t = elmts.cellAsTopicNodeTypeInput.data("data.suggest");
if (!(t)) {
alert("For creating a new graph node, you need to specify a type for it.");
alert($.i18n._('fb-schema-alignment')["new-node-warning"]);
elmts.cellAsTopicNodeTypeInput.focus();
return null;
}
@ -606,7 +609,7 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
} else if (node.nodeType == "cell-as-key") {
var t = elmts.cellAsKeyInput.data("data.suggest");
if (!(t)) {
alert("Please specify the namespace.");
alert($.i18n._('fb-schema-alignment')["namespace-warning"]);
return null;
}
node.namespace = {
@ -617,7 +620,7 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
} else if (node.nodeType == "anonymous") {
var t = elmts.anonymousNodeTypeInput.data("data.suggest");
if (!(t)) {
alert("For generating an anonymous graph node, you need to specify a type for it.");
alert($.i18n._('fb-schema-alignment')["anonymous-node-warning"]);
return null;
}
node.type = {
@ -627,7 +630,7 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
} else if (node.nodeType == "topic") {
var t = elmts.topicNodeTypeInput.data("data.suggest");
if (!(t)) {
alert("Please specify which existing Freebase topic to use.");
alert($.i18n._('fb-schema-alignment')["specify-topic-warning"]);
return null;
}
node.topic = {
@ -637,7 +640,7 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
} else if (node.nodeType == "value") {
node.value = $.trim(elmts.valueNodeTypeValueInput[0].value);
if (!node.value.length) {
alert("Please specify the value to use.");
alert($.i18n._('fb-schema-alignment')["specify-value-warning"]);
return null;
}
node.valueType = elmts.valueNodeTypeValueTypeSelect[0].value;
@ -662,7 +665,7 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
}
}).appendTo(footer);
$('<button class="button"></button>').text("Cancel").click(function() {
$('<button class="button"></button>').text($.i18n._('fb-buttons')["cancel"]).click(function() {
DialogSystem.dismissUntil(level - 1);
}).appendTo(footer);

View File

@ -33,6 +33,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var FreebaseExtension = { handlers: {} };
// Internationalization init
var lang = navigator.language.split("-")[0]
|| navigator.userLanguage.split("-")[0];
var dictionary = "";
$.ajax({
url : "/command/freebase/load-language?",
type : "POST",
async : false,
data : {
lng : lang
},
success : function(data) {
dictionary = data;
}
});
$.i18n.setDictionary(dictionary);
// End internationalization
FreebaseExtension.handlers.setFreebaseApiKey = function() {
var value = window.prompt("Set Freebase API Key:");
if (value !== null) {
@ -79,7 +98,7 @@ FreebaseExtension.handlers.browseToDataLoad = function() {
null,
function(data) {
if (data.value == null) {
alert("You have not tried to load the data in this project into Freebase yet.");
alert($.i18n._('fb-menu')["warning-load"]);
} else {
$(form).attr("action", "http://refinery.freebaseapps.com/load/" + data.value);
form.submit();
@ -101,33 +120,35 @@ FreebaseExtension.handlers.importQAData = function() {
};
ExtensionBar.addExtensionMenu({
"id" : "freebase",
"label" : "Freebase",
"label" : $.i18n._('fb-menu')["freebase"],
"submenu" : [
{
"id" : "freebase/set-api-key",
label: "Set Freebase API Key",
label: $.i18n._('fb-menu')["set-api-key"],
click: FreebaseExtension.handlers.setFreebaseApiKey
},
{
"id" : "freebase/schema-alignment",
label: "Align to Freebase's schemas...",
label: $.i18n._('fb-menu')["align-schema"],
click: function() { FreebaseExtension.handlers.editSchemaAlignment(false); }
},
{
"id" : "freebase/load-info-freebase",
label: "Load into Freebase...",
label: $.i18n._('fb-menu')["load"],
click: function() { FreebaseExtension.handlers.loadIntoFreebase(); }
},
{},
{
"id" : "freebase/browse-load",
label: "Browse data load details...",
label: $.i18n._('fb-menu')["browse-data-load"],
click: function() { FreebaseExtension.handlers.browseToDataLoad(); }
},
{
"id" : "freebase/import-qa-data",
label: "Import QA data",
label: $.i18n._('fb-menu')["import-qa"],
click: function() { FreebaseExtension.handlers.importQAData(); }
}
]
@ -163,7 +184,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
[ "core/edit-column", "core/add-column-by-fetching-urls" ],
{
id: "freebase/add-columns-from-freebase",
label: "Add columns from Freebase ...",
label: $.i18n._('fb-menu')["add-columns"],
click: doAddColumnFromFreebase
}
);

View File

@ -0,0 +1,67 @@
package com.google.refine.freebase.commands;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.refine.commands.Command;
public class LoadLanguageCommand extends Command {
public LoadLanguageCommand() {
// TODO Auto-generated constructor stub
}
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String rawDirectoryFile = request.getSession().getServletContext()
.getRealPath("extensions/freebase/module/langs/");
String cleanedDirectory = rawDirectoryFile.replace("main" + File.separator + "webapp" + File.separator, "");
BufferedReader reader = null;
String[] langs = request.getParameterValues("lng");
langs = langs[0].split(" ");
try {
String file = cleanedDirectory + File.separator + "translation-" + langs[0] + ".json";
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
} catch (FileNotFoundException e1) {
try {
String file = cleanedDirectory + File.separator + "translation-default.json";
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
} catch (FileNotFoundException e3) {
e3.printStackTrace();
}
}
String line = null;
String message = new String();
if (reader != null) {
while ((line = reader.readLine()) != null) {
// buffer.append(line);
message += line + System.getProperty("line.separator");
}
}
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
response.getWriter().println(message);
response.getWriter().flush();
response.getWriter().close();
}
}