Internationalization of the project part

This commit is contained in:
Blakko 2013-07-05 16:32:12 +02:00
parent 19b91bd282
commit 4492ca3bed
9 changed files with 111 additions and 50 deletions

View File

@ -96,20 +96,20 @@ BrowsingEngine.prototype._initializeUI = function() {
this._div.html(
'<div class="browsing-panel-help" bind="help">' +
'<h1>Using facets and filters</h1>' +
'<p>Use facets and filters to select subsets of your data to act on. Choose facet and filter methods from the menus at the top of each data column.</p>' +
'<p>Not sure how to get started?<br /><a href="http://code.google.com/p/google-refine/wiki/Screencasts" target="_blank"><b>Watch these screencasts</b></a></p>' +
'<h1>'+$.i18n._('core-project')["use-facets"]+'</h1>' +
'<p>'+$.i18n._('core-project')["use-to-select"]+'</p>' +
'<p>'+$.i18n._('core-project')["not-sure"]+'<br /><a href="http://code.google.com/p/google-refine/wiki/Screencasts" target="_blank"><b>'+$.i18n._('core-project')["watch-cast"]+'</b></a></p>' +
'</div>' +
'<div class="browsing-panel-header" bind="header">' +
'<div class="browsing-panel-indicator" bind="indicator">' +
'<img src="images/small-spinner.gif" /> Refreshing facets...' +
'<img src="images/small-spinner.gif" /> '+$.i18n._('core-project')["refreshing-facet"]+'' +
'</div>' +
'<div class="browsing-panel-controls" bind="controls">' +
'<div class="browsing-panel-controls-refresh">' +
'<a href="javascript:{}" bind="refreshLink" class="button" title="Update all facets">Refresh</a>' +
'<a href="javascript:{}" bind="refreshLink" class="button" title="'+$.i18n._('core-project')["update-facets"]+'">'+$.i18n._('core-buttons')["refresh"]+'</a>' +
'</div>' +
'<a href="javascript:{}" bind="resetLink" class="button button-pill-left" title="Clear selection in all facets">Reset All</a>' +
'<a href="javascript:{}" bind="removeLink" class="button button-pill-right" title="Remove all facets">Remove All</a>' +
'<a href="javascript:{}" bind="resetLink" class="button button-pill-left" title="'+$.i18n._('core-project')["clear-selection"]+'">'+$.i18n._('core-buttons')["reset-all"]+'</a>' +
'<a href="javascript:{}" bind="removeLink" class="button button-pill-right" title="'+$.i18n._('core-project')["remove-all"]+'">'+$.i18n._('core-buttons')["remove-all"]+'</a>' +
'</div>' +
'</div>' +
'<ul bind="facets" class="facets-container"></ul>'

View File

@ -41,55 +41,55 @@ ExporterManager.handlers = {};
ExporterManager.MenuItems = [
{
"id" : "core/export-project",
"label": "Export project",
"label": $.i18n._('core-project')["export-project"],
"click": function() { ExporterManager.handlers.exportProject(); }
},
{},
{
"id" : "core/export-tsv",
"label": "Tab-separated value",
"label": $.i18n._('core-project')["tab-value"],
"click": function() { ExporterManager.handlers.exportRows("tsv", "tsv"); }
},
{
"id" : "core/export-csv",
"label": "Comma-separated value",
"label": $.i18n._('core-project')["comma-sep"],
"click": function() { ExporterManager.handlers.exportRows("csv", "csv"); }
},
{
"id" : "core/export-html-table",
"label": "HTML table",
"label": $.i18n._('core-project')["html-table"],
"click": function() { ExporterManager.handlers.exportRows("html", "html"); }
},
{
"id" : "core/export-excel",
"label": "Excel",
"label": $.i18n._('core-project')["excel"],
"click": function() { ExporterManager.handlers.exportRows("xls", "xls"); }
},
{
"id" : "core/export-ods",
"label": "ODF spreadsheet",
"label": $.i18n._('core-project')["odf"],
"click": function() { ExporterManager.handlers.exportRows("ods", "ods"); }
},
{},
{
"id" : "core/export-tripleloader",
"label": "Triple loader",
"label": $.i18n._('core-project')["triple-loader"],
"click": function() { ExporterManager.handlers.exportTripleloader("tripleloader"); }
},
{
"id" : "core/export-mqlwrite",
"label": "MQLWrite",
"label": $.i18n._('core-project')["mqlwrite"],
"click": function() { ExporterManager.handlers.exportTripleloader("mqlwrite"); }
},
{},
{
"id" : "core/export-custom-tabular",
"label": "Custom tabular exporter...",
"label": $.i18n._('core-project')["custom-tabular"],
"click": function() { new CustomTabularExporterDialog(); }
},
{
"id" : "core/export-templating",
"label": "Templating...",
"label": $.i18n._('core-project')["templating"],
"click": function() { new TemplatingExporterDialog(); }
}
];
@ -109,10 +109,7 @@ ExporterManager.prototype._initializeUI = function() {
ExporterManager.handlers.exportTripleloader = function(format) {
if (!theProject.overlayModels.freebaseProtograph) {
alert(
"You haven't done any schema alignment yet,\nso there is no triple to export.\n\n" +
"Use the Freebase > Edit Schema Alignment Skeleton...\ncommand to align your data with Freebase schemas first."
);
alert($.i18n._('triple-loader')["warning-align"]);
} else {
ExporterManager.handlers.exportRows(format, "txt");
}

View File

@ -1,15 +1,13 @@
<div class="dialog-frame" style="width: 800px;">
<div class="dialog-border">
<div class="dialog-header" bind="dialogHeader">Apply Operation History</div>
<div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody">
<div class="dialog-instruction">
Paste an extracted JSON history of operations to perform:
</div>
<div class="dialog-instruction" bind="or_proj_pasteJson"></div>
<div class="input-container"><textarea wrap="off" bind="textarea" class="history-operation-json" /></div>
</div>
<div class="dialog-footer" bind="dialogFooter">
<button class="button" bind="applyButton">Perform Operations</button>
<button class="button" bind="cancelButton">Cancel</button>
<button class="button" bind="applyButton"></button>
<button class="button" bind="cancelButton"></button>
</div>
</div>
</div>

View File

@ -1,11 +1,11 @@
<div class="dialog-frame" style="width: 800px;">
<div class="dialog-border">
<div class="dialog-header" bind="dialogHeader">Extract Operation History</div>
<div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody">
<div class="grid-layout layout-normal layout-full"><table>
<tr>
<td colspan="2">
Extract and save parts of your operation history as JSON that you can apply to this or other projects in the future.
<td colspan="2" bind="or_proj_extractSave">
</td>
</tr>
<tr>
@ -16,14 +16,14 @@
</tr>
<tr>
<td>
<button class="button" bind="selectAllButton">Select All</button>
<button class="button" bind="unselectAllButton">Unselect All</button>
<button class="button" bind="selectAllButton"></button>
<button class="button" bind="unselectAllButton"></button>
</td>
</tr>
</table></div>
</div>
<div class="dialog-footer" bind="dialogFooter">
<button class="button" bind="closeButton">Close</button>
<button class="button" bind="closeButton"></button>
</div>
</div>
</div>

View File

@ -1,13 +1,13 @@
<div class="history-panel-help" bind="helpDiv">
<h1>Infinite undo history</h1>
<p>Don't worry about making mistakes. Every change you make will be shown here, and you can undo your changes anytime.</p>
<p><a href="http://code.google.com/p/google-refine/wiki/History" target="_blank"><b>Learn more &raquo;</b></a></p>
<h1 bind="or_proj_undo"></h1>
<p bind="or_proj_mistakes"></p>
<p><a href="http://code.google.com/p/google-refine/wiki/History" target="_blank"><b><span bind="or_proj_learnMore"></span></b></a></p>
</div>
<div class="history-panel-controls" bind="controlsDiv">
<a class="button button-pill-left" href="javascript:{}" bind="extractLink">Extract&hellip;</a><a class="button button-pill-right" href="javascript:{}" bind="applyLink">Apply&hellip;</a>
<a class="button button-pill-left" href="javascript:{}" bind="extractLink"></a><a class="button button-pill-right" href="javascript:{}" bind="applyLink"></a>
</div>
<div class="history-panel-filter" bind="bodyControlsDiv">
Filter: <input type="text" size="30" bind="filterInput" />
<span bind="or_proj_filter"> </span><input type="text" size="30" bind="filterInput" />
</div>
<div class="history-panel-body" bind="bodyDiv">
<div class="history-past" bind="pastDiv">

View File

@ -74,6 +74,14 @@ HistoryPanel.prototype._render = function() {
this._div.empty().unbind().html(DOM.loadHTML("core", "scripts/project/history-panel.html"));
var elmts = DOM.bind(this._div);
elmts.or_proj_undo.html($.i18n._('core-project')["undo-history"]);
elmts.or_proj_mistakes.html($.i18n._('core-project')["mistakes"]);
elmts.or_proj_learnMore.html($.i18n._('core-project')["learn-more"]);
elmts.applyLink.html($.i18n._('core-project')["apply"]);
elmts.extractLink.html($.i18n._('core-project')["extract"]);
elmts.or_proj_mistakes.html($.i18n._('core-project')["mistakes"]);
elmts.or_proj_filter.html($.i18n._('core-project')["filter"]);
var renderEntry = function(container, index, entry, lastDoneID, past) {
var a = $(DOM.loadHTML("core", "scripts/project/history-entry.html")).appendTo(container);
@ -187,6 +195,12 @@ HistoryPanel.prototype._showExtractOperationsDialog = function(json) {
var frame = $(DOM.loadHTML("core", "scripts/project/history-extract-dialog.html"));
var elmts = DOM.bind(frame);
elmts.dialogHeader.html($.i18n._('core-project')["extract-history"]);
elmts.or_proj_extractSave.html($.i18n._('core-project')["extract-save"]);
elmts.selectAllButton.html($.i18n._('core-buttons')["select-all"]);
elmts.unselectAllButton.html($.i18n._('core-buttons')["unselect-all"]);
elmts.closeButton.html($.i18n._('core-buttons')["close"]);
var entryTable = elmts.entryTable[0];
var createEntry = function(entry) {
var tr = entryTable.insertRow(entryTable.rows.length);
@ -250,6 +264,12 @@ HistoryPanel.prototype._showApplyOperationsDialog = function() {
var self = this;
var frame = $(DOM.loadHTML("core", "scripts/project/history-apply-dialog.html"));
var elmts = DOM.bind(frame);
elmts.dialogHeader.html($.i18n._('core-project')["apply-operation"]);
elmts.or_proj_pasteJson.html($.i18n._('core-project')["paste-json"]);
elmts.applyButton.html($.i18n._('core-buttons')["perform-op"]);
elmts.cancelButton.html($.i18n._('core-buttons')["cancel"]);
var fixJson = function(json) {
json = json.trim();
@ -271,7 +291,7 @@ HistoryPanel.prototype._showApplyOperationsDialog = function() {
json = fixJson(json);
json = JSON.parse(json);
} catch (e) {
alert("The JSON you pasted is invalid.");
alert($.i18n._('core-project')["json-invalid"]+".");
return;
}

View File

@ -43,6 +43,8 @@ function ProcessPanel(div) {
this._div.html(DOM.loadHTML("core", "scripts/project/progress-panel.html"));
this._elmts = DOM.bind(this._div);
this._elmts.undoLink.html($.i18n._('core-project')["undo"]);
var self = this;
$(window).keypress(function(evt) {
if (evt.charCode == 26 || (evt.charCode == 122 && (evt.ctrlKey || evt.metaKey))) { // ctrl-z or meta-z
@ -147,9 +149,9 @@ ProcessPanel.prototype._render = function(newData) {
for (var i = 0; i < processes.length; i++) {
var process = processes[i];
if (process.status != "pending") {
Refine.setTitle(process.progress + "% complete");
Refine.setTitle(process.progress + "% "+elmts.or_proj_undo.html($.i18n._('core-project')["complete"]));
this._elmts.progressDescription.text(process.description);
this._elmts.progressSpan.text(process.progress + '% complete');
this._elmts.progressSpan.text(process.progress + '% '+elmts.or_proj_undo.html($.i18n._('core-project')["complete"]));
}
if ("onDone" in process) {
newProcessMap[process.id] = process;
@ -158,16 +160,16 @@ ProcessPanel.prototype._render = function(newData) {
if (processes.length > 1) {
var pending = processes.length - 1;
this._elmts.countSpan.text('(' + pending + (pending > 1 ? ' other pending processes)' : ' other pending process)'));
this._elmts.countSpan.text('(' + pending + (pending > 1 ? ' '+$.i18n._('core-project')["other-processes"]+')' : ' '+$.i18n._('core-project')["other-process"]+')'));
} else {
this._elmts.countSpan.empty();
}
this._elmts.cancelLink
.unbind()
.text(processes.length > 1 ? "Cancel All" : "Cancel")
.text(processes.length > 1 ? $.i18n._('core-project')["cancel-all"] : $.i18n._('core-project')["cancel"])
.click(function() {
self._cancelAll();
$(this).text("Canceling...").unbind();
$(this).text($.i18n._('core-project')["canceling"]).unbind();
})
this._div.fadeIn(200);
@ -190,10 +192,10 @@ ProcessPanel.prototype._render = function(newData) {
}).join('\n');
if (this._data.processes.length == 0) {
window.alert('The last operation encountered some errors:\n' + messages);
window.alert($.i18n._('core-project')["last-op-er"]+':\n' + messages);
} else {
if (window.confirm('The last operation encountered some errors:\n' + messages +
'\n\nContinue with the remaining operations?')) {
if (window.confirm($.i18n._('core-project')["last-op-er"]+':\n' + messages +
'\n\n'+$.i18n._('core-project')["continue-remaining"]+'?')) {
$.post(
"command/core/apply-operations?" + $.param({ project: theProject.id }),
{ operations: '[]' },

View File

@ -10,6 +10,6 @@
</div>
<div bind="undoDiv">
<span bind="undoDescription"></span>
<span class="notification-action"><a href="javascript:{}" bind="undoLink">Undo</a></span>
<span class="notification-action"><a href="javascript:{}" bind="undoLink"></a></span>
</div>
</div>

View File

@ -278,7 +278,47 @@
"big-dot": "Big Dot Size",
"export-plot": "export plot",
"numeric": "Numeric"
},
"core-project": {
"use-facets": "Using facets and filters",
"use-to-select": "Use facets and filters to select subsets of your data to act on. Choose facet and filter methods from the menus at the top of each data column.",
"not-sure": "Not sure how to get started?",
"watch-cast": "Watch these screencasts",
"refreshing-facet": "Refreshing facets...",
"update-facets": "Update all facets",
"clear-selection": "Clear selection in all facets",
"remove-all": "Remove all facets",
"export-project": "Export project",
"tab-value": "Tab-separated value",
"comma-sep": "Comma-separated value",
"html-table": "HTML table",
"excel": "Excel",
"odf": "ODF spreadsheet",
"triple-loader": "Triple loader",
"mqlwrite": "MQLWrite",
"custom-tabular": "Custom tabular exporter...",
"templating": "Templating...",
"warning-align": "You haven't done any schema alignment yet,\n so there is no triple to export.\n\n Use the Freebase > Edit Schema Alignment Skeleton...\n command to align your data with Freebase schemas first.",
"json-invalid": "The JSON you pasted is invalid",
"undo-history": "Infinite undo history",
"mistakes": "Don't worry about making mistakes. Every change you make will be shown here, and you can undo your changes anytime.",
"learn-more": "Learn more &raquo;",
"apply": "Apply&hellip;",
"extract": "Extract&hellip;",
"filter": "Filter:",
"extract-history": "Extract Operation History",
"extract-save": "Extract and save parts of your operation history as JSON that you can apply to this or other projects in the future.",
"apply-operation": "Apply Operation History",
"paste-json": "Paste an extracted JSON history of operations to perform:",
"complete": "complete",
"other-processes": "other pending processes",
"other-process": "other pending process",
"cancel-all": "Cancel All",
"cancel": "Cancel",
"canceling": "Canceling...",
"last-op-er": "The last operation encountered some errors",
"continue-remaining": "Continue with the remaining operations",
"undo": "Undo"
},
"core-buttons": {
"cancel": "Cancel",
@ -307,6 +347,10 @@
"upload": "Upload",
"apply": "Apply",
"enter": "Enter",
"esc": "Esc"
"esc": "Esc",
"refresh": "Refresh",
"reset-all": "Reset All",
"remove-all": "Remove All",
"perform-op": "Perform Operations"
}
}