Merge branch 'master' into issue/1819

This commit is contained in:
Jacky 2018-11-25 16:30:28 -05:00 committed by GitHub
commit 992a19f2dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
113 changed files with 2506 additions and 1313 deletions

View File

@ -39,10 +39,11 @@ $.ajax({
module : "database", module : "database",
}, },
success : function(data) { success : function(data) {
dictionary = data; dictionary = data['dictionary'];
lang = data['lang'];
} }
}); });
$.i18n.setDictionary(dictionary); $.i18n().load(dictionary, lang);
// End internationalization // End internationalization
Refine.DatabaseImportController = function(createProjectUI) { Refine.DatabaseImportController = function(createProjectUI) {
@ -60,7 +61,7 @@ Refine.DatabaseImportController = function(createProjectUI) {
Refine.CreateProjectUI.controllers.push(Refine.DatabaseImportController); Refine.CreateProjectUI.controllers.push(Refine.DatabaseImportController);
Refine.DatabaseImportController.prototype.startImportingDocument = function(queryInfo) { Refine.DatabaseImportController.prototype.startImportingDocument = function(queryInfo) {
var dismiss = DialogSystem.showBusy($.i18n._('database-import/preparing')); var dismiss = DialogSystem.showBusy($.i18n('database-import/preparing'));
//alert(queryInfo.query); //alert(queryInfo.query);
var self = this; var self = this;
@ -138,19 +139,19 @@ Refine.DatabaseImportController.prototype._showParsingPanel = function() {
this._parsingPanelElmts = DOM.bind(this._parsingPanel); this._parsingPanelElmts = DOM.bind(this._parsingPanel);
this._parsingPanelElmts.startOverButton.html($.i18n._('database-parsing/start-over')); this._parsingPanelElmts.startOverButton.html($.i18n('database-parsing/start-over'));
this._parsingPanelElmts.database_conf_pars.html($.i18n._('database-parsing/conf-pars')); this._parsingPanelElmts.database_conf_pars.html($.i18n('database-parsing/conf-pars'));
this._parsingPanelElmts.database_proj_name.html($.i18n._('database-parsing/proj-name')); this._parsingPanelElmts.database_proj_name.html($.i18n('database-parsing/proj-name'));
this._parsingPanelElmts.createProjectButton.html($.i18n._('database-parsing/create-proj')); this._parsingPanelElmts.createProjectButton.html($.i18n('database-parsing/create-proj'));
this._parsingPanelElmts.database_options.html($.i18n._('database-parsing/option')); this._parsingPanelElmts.database_options.html($.i18n('database-parsing/option'));
this._parsingPanelElmts.previewButton.html($.i18n._('database-parsing/preview-button')); this._parsingPanelElmts.previewButton.html($.i18n('database-parsing/preview-button'));
this._parsingPanelElmts.database_updating.html($.i18n._('database-parsing/updating-preview')); this._parsingPanelElmts.database_updating.html($.i18n('database-parsing/updating-preview'));
this._parsingPanelElmts.database_discard_next.html($.i18n._('database-parsing/discard-next')); this._parsingPanelElmts.database_discard_next.html($.i18n('database-parsing/discard-next'));
this._parsingPanelElmts.database_discard.html($.i18n._('database-parsing/discard')); this._parsingPanelElmts.database_discard.html($.i18n('database-parsing/discard'));
this._parsingPanelElmts.database_limit_next.html($.i18n._('database-parsing/limit-next')); this._parsingPanelElmts.database_limit_next.html($.i18n('database-parsing/limit-next'));
this._parsingPanelElmts.database_limit.html($.i18n._('database-parsing/limit')); this._parsingPanelElmts.database_limit.html($.i18n('database-parsing/limit'));
this._parsingPanelElmts.database_store_row.html($.i18n._('database-parsing/store-row')); this._parsingPanelElmts.database_store_row.html($.i18n('database-parsing/store-row'));
this._parsingPanelElmts.database_store_cell.html($.i18n._('database-parsing/store-cell')); this._parsingPanelElmts.database_store_cell.html($.i18n('database-parsing/store-cell'));
if (this._parsingPanelResizer) { if (this._parsingPanelResizer) {
$(window).unbind('resize', this._parsingPanelResizer); $(window).unbind('resize', this._parsingPanelResizer);
@ -362,7 +363,7 @@ Refine.DatabaseImportController.prototype._createProject = function() {
}, },
1000 1000
); );
self._createProjectUI.showImportProgressPanel($.i18n._('database-import/creating'), function() { self._createProjectUI.showImportProgressPanel($.i18n('database-import/creating'), function() {
// stop the timed polling // stop the timed polling
window.clearInterval(timerID); window.clearInterval(timerID);

View File

@ -4,7 +4,7 @@
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright notice, this * - Redistrihttps://github.com/OpenRefine/OpenRefine/pull/1862/conflict?name=extensions%252Fdatabase%252Fmodule%252Fscripts%252Findex%252Fdatabase-source-ui.js&ancestor_oid=d7b892f4d20ae2529e9bcc269502869eef9f1a31&base_oid=5b0d92bbb98c3603d39148470d319f1153e417ef&head_oid=997b6757adc87d5b9d4a9ef385eb6ec63e383739butions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer. * list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice, * - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
@ -64,20 +64,20 @@ Refine.DatabaseSourceUI.prototype.attachUI = function(body) {
this._elmts = DOM.bind(this._body); this._elmts = DOM.bind(this._body);
var self = this; var self = this;
$('#database-title').text($.i18n._('database-import/title')); $('#database-title').text($.i18n('database-import/title'));
$('#connectionNameLabel').html($.i18n._('database-source/connectionNameLabel')); $('#connectionNameLabel').html($.i18n('database-source/connectionNameLabel'));
$('#databaseTypeLabel').html($.i18n._('database-source/databaseTypeLabel')); $('#databaseTypeLabel').html($.i18n('database-source/databaseTypeLabel'));
$('#databaseHostLabel').text($.i18n._('database-source/databaseHostLabel')); $('#databaseHostLabel').text($.i18n('database-source/databaseHostLabel'));
$('#databasePortLabel').text($.i18n._('database-source/databasePortLabel')); $('#databasePortLabel').text($.i18n('database-source/databasePortLabel'));
$('#databaseUserLabel').text($.i18n._('database-source/databaseUserLabel')); $('#databaseUserLabel').text($.i18n('database-source/databaseUserLabel'));
$('#databasePasswordLabel').text($.i18n._('database-source/databasePasswordLabel')); $('#databasePasswordLabel').text($.i18n('database-source/databasePasswordLabel'));
$('#databaseNameLabel').text($.i18n._('database-source/databaseNameLabel')); $('#databaseNameLabel').text($.i18n('database-source/databaseNameLabel'));
$('#databaseSchemaLabel').text($.i18n._('database-source/databaseSchemaLabel')); $('#databaseSchemaLabel').text($.i18n('database-source/databaseSchemaLabel'));
$('#databaseTestButton').text($.i18n._('database-source/databaseTestButton')); $('#databaseTestButton').text($.i18n('database-source/databaseTestButton'));
$('#databaseSaveButton').text($.i18n._('database-source/databaseSaveButton')); $('#databaseSaveButton').text($.i18n('database-source/databaseSaveButton'));
$('#databaseConnectButton').text($.i18n._('database-source/databaseConnectButton')); $('#databaseConnectButton').text($.i18n('database-source/databaseConnectButton'));
$('#newConnectionButtonDiv').text($.i18n._('database-source/newConnectionButtonDiv')); $('#newConnectionButtonDiv').text($.i18n('database-source/newConnectionButtonDiv'));
$('#savedConnectionSpan').text($.i18n._('database-source/savedConnectionSpan')); $('#savedConnectionSpan').text($.i18n('database-source/savedConnectionSpan'));
this._elmts.newConnectionButton.click(function(evt) { this._elmts.newConnectionButton.click(function(evt) {
@ -129,7 +129,7 @@ Refine.DatabaseSourceUI.prototype.attachUI = function(body) {
if(self._validateNewConnectionForm() == true){ if(self._validateNewConnectionForm() == true){
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value); var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
if (connectionNameInput.length === 0) { if (connectionNameInput.length === 0) {
window.alert($.i18n._('database-source/alert-connection-name')); window.alert($.i18n('database-source/alert-connection-name'));
} else{ } else{
self._saveConnection(self._getConnectionInfo()); self._saveConnection(self._getConnectionInfo());
} }
@ -152,7 +152,7 @@ Refine.DatabaseSourceUI.prototype.attachUI = function(body) {
// if(jdbcQueryInfo.query && jdbcQueryInfo.query.length > 0 ) { // if(jdbcQueryInfo.query && jdbcQueryInfo.query.length > 0 ) {
// self._executeQuery(jdbcQueryInfo); // self._executeQuery(jdbcQueryInfo);
// }else{ // }else{
// window.alert($.i18n._('database-source/alert-query')); // window.alert($.i18n('database-source/alert-query'));
// } // }
if(self.validateQuery(jdbcQueryInfo.query)) { if(self.validateQuery(jdbcQueryInfo.query)) {
@ -171,7 +171,7 @@ Refine.DatabaseSourceUI.prototype.attachUI = function(body) {
if(self._validateNewConnectionForm() == true){ if(self._validateNewConnectionForm() == true){
var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value); var connectionNameInput = $.trim(self._elmts.connectionNameInput[0].value);
if (connectionNameInput.length === 0) { if (connectionNameInput.length === 0) {
window.alert($.i18n._('database-source/alert-connection-name')); window.alert($.i18n('database-source/alert-connection-name'));
} else{ } else{
self._editConnection(self._getConnectionInfo()); self._editConnection(self._getConnectionInfo());
} }
@ -198,40 +198,40 @@ Refine.DatabaseSourceUI.prototype.focus = function() {
Refine.DatabaseSourceUI.prototype.validateQuery = function(query) { Refine.DatabaseSourceUI.prototype.validateQuery = function(query) {
//alert("query::" + query); //alert("query::" + query);
if(!query || query.length <= 0 ) { if(!query || query.length <= 0 ) {
window.alert($.i18n._('database-source/alert-query')); window.alert($.i18n('database-source/alert-query'));
return false; return false;
} }
var allCapsQuery = query.toUpperCase(); var allCapsQuery = query.toUpperCase();
if(allCapsQuery.indexOf('DROP') > -1){ if(allCapsQuery.indexOf('DROP') > -1){
window.alert($.i18n._('database-source/alert-invalid-query-keyword') + " DROP"); window.alert($.i18n('database-source/alert-invalid-query-keyword') + " DROP");
return false; return false;
}else if(allCapsQuery.indexOf('TRUNCATE') > -1){ }else if(allCapsQuery.indexOf('TRUNCATE') > -1){
window.alert($.i18n._('database-source/alert-invalid-query-keyword') + " TRUNCATE"); window.alert($.i18n('database-source/alert-invalid-query-keyword') + " TRUNCATE");
return false; return false;
}else if(allCapsQuery.indexOf('DELETE') > -1){ }else if(allCapsQuery.indexOf('DELETE') > -1){
window.alert($.i18n._('database-source/alert-invalid-query-keyword') + " DELETE"); window.alert($.i18n('database-source/alert-invalid-query-keyword') + " DELETE");
return false; return false;
}else if(allCapsQuery.indexOf('ROLLBACK') > -1){ }else if(allCapsQuery.indexOf('ROLLBACK') > -1){
window.alert($.i18n._('database-source/alert-invalid-query-keyword') + " ROLLBACK"); window.alert($.i18n('database-source/alert-invalid-query-keyword') + " ROLLBACK");
return false; return false;
}else if(allCapsQuery.indexOf('SHUTDOWN') > -1){ }else if(allCapsQuery.indexOf('SHUTDOWN') > -1){
window.alert($.i18n._('database-source/alert-invalid-query-keyword') + " SHUTDOWN"); window.alert($.i18n('database-source/alert-invalid-query-keyword') + " SHUTDOWN");
return false; return false;
}else if(allCapsQuery.indexOf('INSERT') > -1){ }else if(allCapsQuery.indexOf('INSERT') > -1){
window.alert($.i18n._('database-source/alert-invalid-query-keyword') + " INSERT"); window.alert($.i18n('database-source/alert-invalid-query-keyword') + " INSERT");
return false; return false;
}else if(allCapsQuery.indexOf('ALTER') > -1){ }else if(allCapsQuery.indexOf('ALTER') > -1){
window.alert($.i18n._('database-source/alert-invalid-query-keyword') + " ALTER"); window.alert($.i18n('database-source/alert-invalid-query-keyword') + " ALTER");
return false; return false;
}else if(allCapsQuery.indexOf('UPDATE') > -1){ }else if(allCapsQuery.indexOf('UPDATE') > -1){
window.alert($.i18n._('database-source/alert-invalid-query-keyword') + " UPDATE"); window.alert($.i18n('database-source/alert-invalid-query-keyword') + " UPDATE");
return false; return false;
} }
if(!allCapsQuery.startsWith('SELECT')) { if(!allCapsQuery.startsWith('SELECT')) {
window.alert($.i18n._('database-source/alert-invalid-query-select')); window.alert($.i18n('database-source/alert-invalid-query-select'));
return false; return false;
} }
@ -261,7 +261,7 @@ Refine.DatabaseSourceUI.prototype._editConnection = function(connectionInfo) {
}) })
$( "#menuListUl" ).append(items.join('')); $( "#menuListUl" ).append(items.join(''));
window.alert($.i18n._('database-source/alert-connection-edit')); window.alert($.i18n('database-source/alert-connection-edit'));
} }
} }
}).fail(function( jqXhr, textStatus, errorThrown ){ }).fail(function( jqXhr, textStatus, errorThrown ){
@ -274,7 +274,7 @@ Refine.DatabaseSourceUI.prototype._executeQuery = function(jdbcQueryInfo) {
var self = this; var self = this;
//remove start line //remove start line
var dismiss = DialogSystem.showBusy($.i18n._('database-import/checking')); var dismiss = DialogSystem.showBusy($.i18n('database-import/checking'));
//$("#executeQueryBtn").text('Please wait ...').attr('disabled','disabled'); //$("#executeQueryBtn").text('Please wait ...').attr('disabled','disabled');
$.post( $.post(
@ -455,16 +455,16 @@ Refine.DatabaseSourceUI.prototype._validateNewConnectionForm = function() {
var initialSchemaInput = $.trim(self._elmts.initialSchemaInput[0].value); var initialSchemaInput = $.trim(self._elmts.initialSchemaInput[0].value);
if (databaseHostInput.length === 0) { if (databaseHostInput.length === 0) {
window.alert($.i18n._('database-source/alert-server')); window.alert($.i18n('database-source/alert-server'));
return false; return false;
}else if(databasePortInput.length === 0){ }else if(databasePortInput.length === 0){
window.alert($.i18n._('database-source/alert-port')); window.alert($.i18n('database-source/alert-port'));
return false; return false;
}else if(databaseUserInput.length === 0){ }else if(databaseUserInput.length === 0){
window.alert($.i18n._('database-source/alert-user')); window.alert($.i18n('database-source/alert-user'));
return false; return false;
}else if(initialDatabaseInput.length === 0){ }else if(initialDatabaseInput.length === 0){
window.alert($.i18n._('database-source/alert-initial-database')); window.alert($.i18n('database-source/alert-initial-database'));
return false; return false;
} }
else{ else{

View File

@ -37,10 +37,11 @@ $.ajax({
}, },
success : function(data) { success : function(data) {
dictionary = data; dictionary = data['dictionary'];
dictionary = data['lang'];
} }
}); });
$.i18n.setDictionary(dictionary); $.i18n().load(dictionary, lang);
// End internationalization // End internationalization
(function() { (function() {

View File

@ -41,17 +41,17 @@ Refine.GDataSourceUI.prototype.attachUI = function(body) {
this._body.html(DOM.loadHTML("gdata", "scripts/index/import-from-gdata-form.html")); this._body.html(DOM.loadHTML("gdata", "scripts/index/import-from-gdata-form.html"));
this._elmts = DOM.bind(this._body); this._elmts = DOM.bind(this._body);
$('#gdata-title').text($.i18n._('gdata-import/title')); $('#gdata-title').text($.i18n('gdata-import/title'));
$('#gdata-import').html($.i18n._('gdata-import/import-by-url')); $('#gdata-import').html($.i18n('gdata-import/import-by-url'));
$('#gdata-next').html($.i18n._("gdata-import")["next->"]); $('#gdata-next').html($.i18n('gdata-import')["next->"]);
$('#gdata-auth-doc').text($.i18n._('gdata-import/auth-doc')); $('#gdata-auth-doc').text($.i18n('gdata-import/auth-doc'));
$('#gdata-please').text($.i18n._('gdata-import/please')); $('#gdata-please').text($.i18n('gdata-import/please'));
$('#gdata-signin-btn').text($.i18n._('gdata-import/sign-in')); $('#gdata-signin-btn').text($.i18n('gdata-import/sign-in'));
$('#gdata-access-data').text($.i18n._('gdata-import/access-data')); $('#gdata-access-data').text($.i18n('gdata-import/access-data'));
$('#gdata-retrieving').text($.i18n._('gdata-import/retrieving')); $('#gdata-retrieving').text($.i18n('gdata-import/retrieving'));
$('#gdata-signout').text($.i18n._('gdata-import/sign-out')); $('#gdata-signout').text($.i18n('gdata-import/sign-out'));
$('#gdata-resignin').text($.i18n._('gdata-import/re-sign-in')); $('#gdata-resignin').text($.i18n('gdata-import/re-sign-in'));
$('#gdata-another-account').text($.i18n._('gdata-import/another-account')); $('#gdata-another-account').text($.i18n('gdata-import/another-account'));
var self = this; var self = this;
this._body.find('.gdata-signin.button').click(function() { this._body.find('.gdata-signin.button').click(function() {
@ -74,7 +74,7 @@ Refine.GDataSourceUI.prototype.attachUI = function(body) {
this._elmts.urlNextButton.click(function(evt) { this._elmts.urlNextButton.click(function(evt) {
var url = $.trim(self._elmts.urlInput[0].value); var url = $.trim(self._elmts.urlInput[0].value);
if (url.length === 0) { if (url.length === 0) {
window.alert($.i18n._('gdata-source/alert-url')); window.alert($.i18n('gdata-source/alert-url'));
} else { } else {
var doc = {}; var doc = {};
doc.docSelfLink = url; doc.docSelfLink = url;
@ -130,10 +130,10 @@ Refine.GDataSourceUI.prototype._renderDocuments = function(o) {
var table = $( var table = $(
'<table><tr>' + '<table><tr>' +
'<th></th>' + // starred '<th></th>' + // starred
'<th>'+$.i18n._('gdata-source/type')+'</th>' + '<th>'+$.i18n('gdata-source/type')+'</th>' +
'<th>'+$.i18n._('gdata-source/title')+'</th>' + '<th>'+$.i18n('gdata-source/title')+'</th>' +
'<th>'+$.i18n._('gdata-source/authors')+'</th>' + '<th>'+$.i18n('gdata-source/authors')+'</th>' +
'<th>'+$.i18n._('gdata-source/updated')+'</th>' + '<th>'+$.i18n('gdata-source/updated')+'</th>' +
'</tr></table>' '</tr></table>'
).appendTo(this._elmts.listingContainer)[0]; ).appendTo(this._elmts.listingContainer)[0];

View File

@ -44,10 +44,11 @@ $.ajax({
// lang : lang // lang : lang
}, },
success : function(data) { success : function(data) {
dictionary = data; dictionary = data['dictionary'];
lang = data['lang'];
} }
}); });
$.i18n.setDictionary(dictionary); $.i18n().load(dictionary, lang);
// End internationalization // End internationalization
Refine.GDataImportingController = function(createProjectUI) { Refine.GDataImportingController = function(createProjectUI) {
@ -61,13 +62,13 @@ Refine.GDataImportingController = function(createProjectUI) {
ui: new Refine.GDataSourceUI(this) ui: new Refine.GDataSourceUI(this)
}); });
$('#gdata-authorize').text($.i18n._('gdata-auth/authorize-label')); $('#gdata-authorize').text($.i18n('gdata-auth/authorize-label'));
$('#gdata-authorized').text($.i18n._('gdata-auth/authorized-label')); $('#gdata-authorized').text($.i18n('gdata-auth/authorized-label'));
}; };
Refine.CreateProjectUI.controllers.push(Refine.GDataImportingController); Refine.CreateProjectUI.controllers.push(Refine.GDataImportingController);
Refine.GDataImportingController.prototype.startImportingDocument = function(doc) { Refine.GDataImportingController.prototype.startImportingDocument = function(doc) {
var dismiss = DialogSystem.showBusy($.i18n._('gdata-import/preparing')); var dismiss = DialogSystem.showBusy($.i18n('gdata-import/preparing'));
var self = this; var self = this;
$.post( $.post(
@ -166,25 +167,25 @@ Refine.GDataImportingController.prototype._showParsingPanel = function() {
this._parsingPanelElmts = DOM.bind(this._parsingPanel); this._parsingPanelElmts = DOM.bind(this._parsingPanel);
if(this._doc.type != 'table'){ if(this._doc.type != 'table'){
this._parsingPanelElmts.gdata_worksheet.html($.i18n._('gdata-parsing/worksheet')); this._parsingPanelElmts.gdata_worksheet.html($.i18n('gdata-parsing/worksheet'));
this._parsingPanelElmts.gdata_ignore_first.html($.i18n._('gdata-parsing/ignore-first')); this._parsingPanelElmts.gdata_ignore_first.html($.i18n('gdata-parsing/ignore-first'));
this._parsingPanelElmts.gdata_ignore.html($.i18n._('gdata-parsing/ignore')); this._parsingPanelElmts.gdata_ignore.html($.i18n('gdata-parsing/ignore'));
this._parsingPanelElmts.gdata_parse_next.html($.i18n._('gdata-parsing/parse-next')); this._parsingPanelElmts.gdata_parse_next.html($.i18n('gdata-parsing/parse-next'));
this._parsingPanelElmts.gdata_parse.html($.i18n._('gdata-parsing/parse')); this._parsingPanelElmts.gdata_parse.html($.i18n('gdata-parsing/parse'));
} }
this._parsingPanelElmts.startOverButton.html($.i18n._('gdata-parsing/start-over')); this._parsingPanelElmts.startOverButton.html($.i18n('gdata-parsing/start-over'));
this._parsingPanelElmts.gdata_conf_pars.html($.i18n._('gdata-parsing/conf-pars')); this._parsingPanelElmts.gdata_conf_pars.html($.i18n('gdata-parsing/conf-pars'));
this._parsingPanelElmts.gdata_proj_name.html($.i18n._('gdata-parsing/proj-name')); this._parsingPanelElmts.gdata_proj_name.html($.i18n('gdata-parsing/proj-name'));
this._parsingPanelElmts.createProjectButton.html($.i18n._('gdata-parsing/create-proj')); this._parsingPanelElmts.createProjectButton.html($.i18n('gdata-parsing/create-proj'));
this._parsingPanelElmts.gdata_options.html($.i18n._('gdata-parsing/option')); this._parsingPanelElmts.gdata_options.html($.i18n('gdata-parsing/option'));
this._parsingPanelElmts.previewButton.html($.i18n._('gdata-parsing/preview-button')); this._parsingPanelElmts.previewButton.html($.i18n('gdata-parsing/preview-button'));
this._parsingPanelElmts.gdata_updating.html($.i18n._('gdata-parsing/updating-preview')); this._parsingPanelElmts.gdata_updating.html($.i18n('gdata-parsing/updating-preview'));
this._parsingPanelElmts.gdata_discard_next.html($.i18n._('gdata-parsing/discard-next')); this._parsingPanelElmts.gdata_discard_next.html($.i18n('gdata-parsing/discard-next'));
this._parsingPanelElmts.gdata_discard.html($.i18n._('gdata-parsing/discard')); this._parsingPanelElmts.gdata_discard.html($.i18n('gdata-parsing/discard'));
this._parsingPanelElmts.gdata_limit_next.html($.i18n._('gdata-parsing/limit-next')); this._parsingPanelElmts.gdata_limit_next.html($.i18n('gdata-parsing/limit-next'));
this._parsingPanelElmts.gdata_limit.html($.i18n._('gdata-parsing/limit')); this._parsingPanelElmts.gdata_limit.html($.i18n('gdata-parsing/limit'));
this._parsingPanelElmts.gdata_store_row.html($.i18n._('gdata-parsing/store-row')); this._parsingPanelElmts.gdata_store_row.html($.i18n('gdata-parsing/store-row'));
this._parsingPanelElmts.gdata_store_cell.html($.i18n._('gdata-parsing/store-cell')); this._parsingPanelElmts.gdata_store_cell.html($.i18n('gdata-parsing/store-cell'));
if (this._parsingPanelResizer) { if (this._parsingPanelResizer) {
$(window).unbind('resize', this._parsingPanelResizer); $(window).unbind('resize', this._parsingPanelResizer);
@ -419,7 +420,7 @@ Refine.GDataImportingController.prototype._createProject = function() {
}, },
1000 1000
); );
self._createProjectUI.showImportProgressPanel($.i18n._('gdata-import/creating'), function() { self._createProjectUI.showImportProgressPanel($.i18n('gdata-import/creating'), function() {
// stop the timed polling // stop the timed polling
window.clearInterval(timerID); window.clearInterval(timerID);

View File

@ -41,10 +41,11 @@ $.ajax({
// lang : lang // lang : lang
}, },
success : function(data) { success : function(data) {
dictionary = data; dictionary = data['dictionary'];
lang = data['lang'];
} }
}); });
$.i18n.setDictionary(dictionary); $.i18n().load(dictionary, lang);
// End internationalization // End internationalization
(function() { (function() {
@ -52,7 +53,7 @@ $.i18n.setDictionary(dictionary);
var doUpload = function() { var doUpload = function() {
var name = window.prompt(prompt, theProject.metadata.name); var name = window.prompt(prompt, theProject.metadata.name);
if (name) { if (name) {
var dismiss = DialogSystem.showBusy($.i18n._('gdata-exporter/uploading')); var dismiss = DialogSystem.showBusy($.i18n('gdata-exporter/uploading'));
$.post( $.post(
"command/gdata/upload", "command/gdata/upload",
{ {
@ -68,7 +69,7 @@ $.i18n.setDictionary(dictionary);
if (o.url) { if (o.url) {
window.open(o.url, '_blank'); window.open(o.url, '_blank');
} else { } else {
alert($.i18n._('gdata-exporter/upload-error') + o.message) alert($.i18n('gdata-exporter/upload-error') + o.message)
} }
onDone(); onDone();
}, },
@ -86,16 +87,16 @@ $.i18n.setDictionary(dictionary);
CustomTabularExporterDialog.uploadTargets.push({ CustomTabularExporterDialog.uploadTargets.push({
id: 'gdata/google-spreadsheet', id: 'gdata/google-spreadsheet',
label: $.i18n._('gdata-exporter/new-spreadsheet'), label: $.i18n('gdata-exporter/new-spreadsheet'),
handler: function(options, exportAllRows, onDone) { handler: function(options, exportAllRows, onDone) {
handleUpload(options, exportAllRows, onDone, $.i18n._('gdata-exporter/enter-spreadsheet')); handleUpload(options, exportAllRows, onDone, $.i18n('gdata-exporter/enter-spreadsheet'));
} }
}); });
CustomTabularExporterDialog.uploadTargets.push({ CustomTabularExporterDialog.uploadTargets.push({
id: 'gdata/fusion-table', id: 'gdata/fusion-table',
label: $.i18n._('gdata-exporter/new-fusion'), label: $.i18n('gdata-exporter/new-fusion'),
handler: function(options, exportAllRows, onDone) { handler: function(options, exportAllRows, onDone) {
handleUpload(options, exportAllRows, onDone, $.i18n._('gdata-exporter/enter-fusion')); handleUpload(options, exportAllRows, onDone, $.i18n('gdata-exporter/enter-fusion'));
} }
}); });
})(); })();

View File

@ -5,11 +5,11 @@ ImportSchemaDialog.launch = function() {
var frame = $(DOM.loadHTML("wikidata", "scripts/dialogs/import-schema-dialog.html")); var frame = $(DOM.loadHTML("wikidata", "scripts/dialogs/import-schema-dialog.html"));
var elmts = this._elmts = DOM.bind(frame); var elmts = this._elmts = DOM.bind(frame);
this._elmts.dialogHeader.text($.i18n._('import-wikibase-schema/dialog-header')); this._elmts.dialogHeader.text($.i18n('import-wikibase-schema/dialog-header'));
this._elmts.fileLabel.html($.i18n._('import-wikibase-schema/file-label')); this._elmts.fileLabel.html($.i18n('import-wikibase-schema/file-label'));
this._elmts.schemaLabel.text($.i18n._('import-wikibase-schema/schema-label')); this._elmts.schemaLabel.text($.i18n('import-wikibase-schema/schema-label'));
this._elmts.cancelButton.text($.i18n._('core-project/cancel')); this._elmts.cancelButton.text($.i18n('core-project/cancel'));
this._elmts.importButton.text($.i18n._('import-wikibase-schema/import')); this._elmts.importButton.text($.i18n('import-wikibase-schema/import'));
this._level = DialogSystem.showDialog(frame); this._level = DialogSystem.showDialog(frame);
@ -38,7 +38,7 @@ ImportSchemaDialog.launch = function() {
try { try {
schema = JSON.parse(elmts.schemaTextarea.val()); schema = JSON.parse(elmts.schemaTextarea.val());
} catch(e) { } catch(e) {
elmts.invalidSchema.text($.i18n._('import-wikibase-schema/invalid-schema')); elmts.invalidSchema.text($.i18n('import-wikibase-schema/invalid-schema'));
return; return;
} }
@ -55,7 +55,7 @@ ImportSchemaDialog.launch = function() {
dismiss(); dismiss();
}, },
onError: function(e) { onError: function(e) {
elmts.invalidSchema.text($.i18n._('import-wikibase-schema/invalid-schema')); elmts.invalidSchema.text($.i18n('import-wikibase-schema/invalid-schema'));
}, },
} }
); );

View File

@ -19,19 +19,19 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca
var elmts = this._elmts = DOM.bind(frame); var elmts = this._elmts = DOM.bind(frame);
ManageAccountDialog.firstLaunch = false; ManageAccountDialog.firstLaunch = false;
this._elmts.dialogHeader.text($.i18n._('wikidata-account/dialog-header')); this._elmts.dialogHeader.text($.i18n('wikidata-account/dialog-header'));
this._elmts.explainLogIn.html($.i18n._('wikidata-account/explain-log-in')); this._elmts.explainLogIn.html($.i18n('wikidata-account/explain-log-in'));
this._elmts.usernameLabel.text($.i18n._('wikidata-account/username-label')); this._elmts.usernameLabel.text($.i18n('wikidata-account/username-label'));
this._elmts.usernameInput.attr("placeholder", $.i18n._('wikidata-account/username-placeholder')); this._elmts.usernameInput.attr("placeholder", $.i18n('wikidata-account/username-placeholder'));
this._elmts.passwordLabel.text($.i18n._('wikidata-account/password-label')); this._elmts.passwordLabel.text($.i18n('wikidata-account/password-label'));
this._elmts.passwordInput.attr("placeholder", $.i18n._('wikidata-account/password-placeholder')); this._elmts.passwordInput.attr("placeholder", $.i18n('wikidata-account/password-placeholder'));
this._elmts.rememberCredentialsLabel.text($.i18n._('wikidata-account/remember-credentials-label')); this._elmts.rememberCredentialsLabel.text($.i18n('wikidata-account/remember-credentials-label'));
this._elmts.dialogHeader.text($.i18n._('wikidata-account/dialog-header')); this._elmts.dialogHeader.text($.i18n('wikidata-account/dialog-header'));
this._elmts.cancelButton1.text($.i18n._('wikidata-account/close')); this._elmts.cancelButton1.text($.i18n('wikidata-account/close'));
this._elmts.cancelButton2.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.loggedInAs.text($.i18n('wikidata-account/logged-in-as'));
this._elmts.logoutButton.text($.i18n._('wikidata-account/log-out')); this._elmts.logoutButton.text($.i18n('wikidata-account/log-out'));
this._elmts.loginButton.text($.i18n._('wikidata-account/log-in')); this._elmts.loginButton.text($.i18n('wikidata-account/log-in'));
this._level = DialogSystem.showDialog(frame); this._level = DialogSystem.showDialog(frame);
@ -86,7 +86,7 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca
ManageAccountDialog.isLoggedIn = function(callback) { ManageAccountDialog.isLoggedIn = function(callback) {
var discardWaiter = function() { }; var discardWaiter = function() { };
if(ManageAccountDialog.firstLogin) { if(ManageAccountDialog.firstLogin) {
discardWaiter = DialogSystem.showBusy($.i18n._('wikidata-account/connecting-to-wikidata')); discardWaiter = DialogSystem.showBusy($.i18n('wikidata-account/connecting-to-wikidata'));
} }
$.get( $.get(
"command/wikidata/login", "command/wikidata/login",

View File

@ -11,12 +11,12 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
this._level = DialogSystem.showDialog(frame); this._level = DialogSystem.showDialog(frame);
this._elmts.dialogHeader.text($.i18n._('perform-wikidata-edits/dialog-header')); this._elmts.dialogHeader.text($.i18n('perform-wikidata-edits/dialog-header'));
this._elmts.loggedInAs.text($.i18n._('perform-wikidata-edits/logged-in-as')); this._elmts.loggedInAs.text($.i18n('perform-wikidata-edits/logged-in-as'));
this._elmts.editSummaryLabel.text($.i18n._('perform-wikidata-edits/edit-summary-label')); this._elmts.editSummaryLabel.text($.i18n('perform-wikidata-edits/edit-summary-label'));
this._elmts.editSummary.attr('placeholder', $.i18n._('perform-wikidata-edits/edit-summary-placeholder')); this._elmts.editSummary.attr('placeholder', $.i18n('perform-wikidata-edits/edit-summary-placeholder'));
this._elmts.performEditsButton.text($.i18n._('perform-wikidata-edits/perform-edits')); this._elmts.performEditsButton.text($.i18n('perform-wikidata-edits/perform-edits'));
this._elmts.cancelButton.text($.i18n._('perform-wikidata-edits/cancel')); this._elmts.cancelButton.text($.i18n('perform-wikidata-edits/cancel'));
var dismiss = function() { var dismiss = function() {
DialogSystem.dismissUntil(self._level - 1); DialogSystem.dismissUntil(self._level - 1);
@ -65,7 +65,7 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
PerformEditsDialog.updateEditCount = function(edit_count) { PerformEditsDialog.updateEditCount = function(edit_count) {
this._elmts.reviewYourEdits.html( this._elmts.reviewYourEdits.html(
$.i18n._('perform-wikidata-edits/review-your-edits') $.i18n('perform-wikidata-edits/review-your-edits')
.replace('{nb_edits}', edit_count)); .replace('{nb_edits}', edit_count));
} }
@ -93,7 +93,7 @@ PerformEditsDialog.checkAndLaunch = function () {
var onSaved = function() { var onSaved = function() {
ManageAccountDialog.ensureLoggedIn(function(logged_in_username) { ManageAccountDialog.ensureLoggedIn(function(logged_in_username) {
if (logged_in_username) { if (logged_in_username) {
var discardWaiter = DialogSystem.showBusy($.i18n._('perform-wikidata-edits/analyzing-edits')); var discardWaiter = DialogSystem.showBusy($.i18n('perform-wikidata-edits/analyzing-edits'));
$.post( $.post(
"command/wikidata/preview-wikibase-schema?" + $.param({ project: theProject.id }), "command/wikidata/preview-wikibase-schema?" + $.param({ project: theProject.id }),
{ engine: JSON.stringify(ui.browsingEngine.getJSON()) }, { engine: JSON.stringify(ui.browsingEngine.getJSON()) },

View File

@ -66,12 +66,12 @@ SchemaAlignmentDialog.setUpTabs = function() {
var schemaButton = $('<div></div>') var schemaButton = $('<div></div>')
.addClass('main-view-panel-tab-header') .addClass('main-view-panel-tab-header')
.attr('href', '#wikidata-schema-panel') .attr('href', '#wikidata-schema-panel')
.text($.i18n._('wikidata-schema/schema-tab-header')) .text($.i18n('wikidata-schema/schema-tab-header'))
.appendTo(this._toolPanel); .appendTo(this._toolPanel);
var issuesButton = $('<div></div>') var issuesButton = $('<div></div>')
.addClass('main-view-panel-tab-header') .addClass('main-view-panel-tab-header')
.attr('href', '#wikidata-issues-panel') .attr('href', '#wikidata-issues-panel')
.text($.i18n._('wikidata-schema/warnings-tab-header')+' ') .text($.i18n('wikidata-schema/warnings-tab-header')+' ')
.appendTo(this._toolPanel); .appendTo(this._toolPanel);
this.issuesTabCount = $('<span></span>') this.issuesTabCount = $('<span></span>')
.addClass('schema-alignment-total-warning-count') .addClass('schema-alignment-total-warning-count')
@ -84,7 +84,7 @@ SchemaAlignmentDialog.setUpTabs = function() {
var previewButton = $('<div></div>') var previewButton = $('<div></div>')
.addClass('main-view-panel-tab-header') .addClass('main-view-panel-tab-header')
.attr('href', '#wikidata-preview-panel') .attr('href', '#wikidata-preview-panel')
.text($.i18n._('wikidata-schema/edits-preview-tab-header')) .text($.i18n('wikidata-schema/edits-preview-tab-header'))
.appendTo(this._toolPanel); .appendTo(this._toolPanel);
this.previewSpinner = $('<img />') this.previewSpinner = $('<img />')
.attr('src', 'images/large-spinner.gif') .attr('src', 'images/large-spinner.gif')
@ -93,7 +93,7 @@ SchemaAlignmentDialog.setUpTabs = function() {
this._unsavedIndicator = $('<span></span>') this._unsavedIndicator = $('<span></span>')
.html('&nbsp;*') .html('&nbsp;*')
.attr('title', $.i18n._('wikidata-schema/unsaved-changes-alt')) .attr('title', $.i18n('wikidata-schema/unsaved-changes-alt'))
.hide() .hide()
.appendTo(schemaButton); .appendTo(schemaButton);
@ -108,22 +108,22 @@ SchemaAlignmentDialog.setUpTabs = function() {
*/ */
var schemaTab = $(DOM.loadHTML("wikidata", "scripts/schema-alignment-tab.html")).appendTo(this._schemaPanel); var schemaTab = $(DOM.loadHTML("wikidata", "scripts/schema-alignment-tab.html")).appendTo(this._schemaPanel);
var schemaElmts = this._schemaElmts = DOM.bind(schemaTab); var schemaElmts = this._schemaElmts = DOM.bind(schemaTab);
schemaElmts.dialogExplanation.text($.i18n._('wikidata-schema/dialog-explanation')); schemaElmts.dialogExplanation.text($.i18n('wikidata-schema/dialog-explanation'));
this._plusButton($.i18n._('wikidata-schema/add-item-button'), schemaElmts.addItemButton); this._plusButton($.i18n('wikidata-schema/add-item-button'), schemaElmts.addItemButton);
schemaElmts.addItemButton.click(function(e) { schemaElmts.addItemButton.click(function(e) {
self._addItem(); self._addItem();
SchemaAlignmentDialog._hasChanged(); SchemaAlignmentDialog._hasChanged();
e.preventDefault(); e.preventDefault();
}); });
schemaElmts.saveButton schemaElmts.saveButton
.text($.i18n._('wikidata-schema/save-button')) .text($.i18n('wikidata-schema/save-button'))
.attr('title', $.i18n._('wikidata-schema/save-schema-alt')) .attr('title', $.i18n('wikidata-schema/save-schema-alt'))
.prop('disabled', true) .prop('disabled', true)
.addClass('disabled') .addClass('disabled')
.click(function() { SchemaAlignmentDialog._save(); }); .click(function() { SchemaAlignmentDialog._save(); });
schemaElmts.discardButton schemaElmts.discardButton
.text($.i18n._('wikidata-schema/discard-button')) .text($.i18n('wikidata-schema/discard-button'))
.attr('title', $.i18n._('wikidata-schema/discard-schema-changes-alt')) .attr('title', $.i18n('wikidata-schema/discard-schema-changes-alt'))
.prop('disabled', true) .prop('disabled', true)
.addClass('disabled') .addClass('disabled')
.click(function() { SchemaAlignmentDialog._discardChanges(); }); .click(function() { SchemaAlignmentDialog._discardChanges(); });
@ -141,7 +141,7 @@ SchemaAlignmentDialog.setUpTabs = function() {
*/ */
var issuesTab = $(DOM.loadHTML("wikidata", "scripts/issues-tab.html")).appendTo(this._issuesPanel); var issuesTab = $(DOM.loadHTML("wikidata", "scripts/issues-tab.html")).appendTo(this._issuesPanel);
var issuesElmts = this._issuesElmts = DOM.bind(issuesTab); var issuesElmts = this._issuesElmts = DOM.bind(issuesTab);
issuesElmts.invalidSchemaWarningIssues.text($.i18n._('wikidata-schema/invalid-schema-warning-issues')); issuesElmts.invalidSchemaWarningIssues.text($.i18n('wikidata-schema/invalid-schema-warning-issues'));
/** /**
* Init the preview tab * Init the preview tab
@ -149,7 +149,7 @@ SchemaAlignmentDialog.setUpTabs = function() {
var previewTab = $(DOM.loadHTML("wikidata", "scripts/preview-tab.html")).appendTo(this._previewPanel); var previewTab = $(DOM.loadHTML("wikidata", "scripts/preview-tab.html")).appendTo(this._previewPanel);
var previewElmts = this._previewElmts = DOM.bind(previewTab); var previewElmts = this._previewElmts = DOM.bind(previewTab);
SchemaAlignmentDialog.updateNbEdits(0); SchemaAlignmentDialog.updateNbEdits(0);
previewElmts.invalidSchemaWarningPreview.text($.i18n._('wikidata-schema/invalid-schema-warning-preview')); previewElmts.invalidSchemaWarningPreview.text($.i18n('wikidata-schema/invalid-schema-warning-preview'));
this._previewPanes = $(".schema-alignment-dialog-preview"); this._previewPanes = $(".schema-alignment-dialog-preview");
@ -223,7 +223,7 @@ SchemaAlignmentDialog.launch = function(onDone) {
var beforeUnload = function(e) { var beforeUnload = function(e) {
if (SchemaAlignmentDialog.isSetUp() && SchemaAlignmentDialog._hasUnsavedChanges === true) { if (SchemaAlignmentDialog.isSetUp() && SchemaAlignmentDialog._hasUnsavedChanges === true) {
return (e = $.i18n._('wikidata-schema/unsaved-warning')); return (e = $.i18n('wikidata-schema/unsaved-warning'));
} }
}; };
@ -266,7 +266,7 @@ SchemaAlignmentDialog._save = function(onDone) {
if (onDone) onDone(); if (onDone) onDone();
}, },
onError: function(e) { onError: function(e) {
alert($.i18n._('wikidata-schema/incomplete-schema-could-not-be-saved')); alert($.i18n('wikidata-schema/incomplete-schema-could-not-be-saved'));
}, },
} }
); );
@ -310,7 +310,7 @@ SchemaAlignmentDialog._makeDeleteButton = function (noText) {
); );
if(noText === undefined) { if(noText === undefined) {
button.append( button.append(
$('<span></span>').text($.i18n._('wikidata-schema/remove'))); $('<span></span>').text($.i18n('wikidata-schema/remove')));
} }
return button; return button;
} }
@ -347,9 +347,9 @@ SchemaAlignmentDialog._addItem = function(json) {
// Terms // Terms
$('<span></span>').addClass('wbs-namedesc-header') $('<span></span>').addClass('wbs-namedesc-header')
.text($.i18n._('wikidata-schema/terms-header')).appendTo(right); .text($.i18n('wikidata-schema/terms-header')).appendTo(right);
$('<div></div>').addClass('wbs-namedesc-container') $('<div></div>').addClass('wbs-namedesc-container')
.attr('data-emptyplaceholder', $.i18n._('wikidata-schema/empty-terms')) .attr('data-emptyplaceholder', $.i18n('wikidata-schema/empty-terms'))
.appendTo(right); .appendTo(right);
var termToolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(right); var termToolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(right);
var addNamedescButton = $('<a></a>').addClass('wbs-add-namedesc') var addNamedescButton = $('<a></a>').addClass('wbs-add-namedesc')
@ -358,16 +358,16 @@ SchemaAlignmentDialog._addItem = function(json) {
e.preventDefault(); e.preventDefault();
}).appendTo(termToolbar); }).appendTo(termToolbar);
SchemaAlignmentDialog._plusButton( SchemaAlignmentDialog._plusButton(
$.i18n._('wikidata-schema/add-term'), addNamedescButton); $.i18n('wikidata-schema/add-term'), addNamedescButton);
// Clear the float // Clear the float
$('<div></div>').attr('style', 'clear: right').appendTo(right); $('<div></div>').attr('style', 'clear: right').appendTo(right);
// Statements // Statements
$('<div></div>').addClass('wbs-statements-header') $('<div></div>').addClass('wbs-statements-header')
.text($.i18n._('wikidata-schema/statements-header')).appendTo(right); .text($.i18n('wikidata-schema/statements-header')).appendTo(right);
$('<div></div>').addClass('wbs-statement-group-container') $('<div></div>').addClass('wbs-statement-group-container')
.attr('data-emptyplaceholder', $.i18n._('wikidata-schema/empty-statements')) .attr('data-emptyplaceholder', $.i18n('wikidata-schema/empty-statements'))
.appendTo(right); .appendTo(right);
var statementToolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(right); var statementToolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(right);
var addStatementButton = $('<a></a>').addClass('wbs-add-statement-group') var addStatementButton = $('<a></a>').addClass('wbs-add-statement-group')
@ -377,7 +377,7 @@ SchemaAlignmentDialog._addItem = function(json) {
}).appendTo(statementToolbar); }).appendTo(statementToolbar);
SchemaAlignmentDialog._plusButton( SchemaAlignmentDialog._plusButton(
$.i18n._('wikidata-schema/add-statement'), addStatementButton); $.i18n('wikidata-schema/add-statement'), addStatementButton);
if (statementGroups) { if (statementGroups) {
for(var i = 0; i != statementGroups.length; i++) { for(var i = 0; i != statementGroups.length; i++) {
@ -425,15 +425,15 @@ 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($.i18n._('wikidata-schema/label')) .text($.i18n('wikidata-schema/label'))
.appendTo(type_input); .appendTo(type_input);
$('<option></option>') $('<option></option>')
.attr('value', 'DESCRIPTION') .attr('value', 'DESCRIPTION')
.text($.i18n._('wikidata-schema/description')) .text($.i18n('wikidata-schema/description'))
.appendTo(type_input); .appendTo(type_input);
$('<option></option>') $('<option></option>')
.attr('value', 'ALIAS') .attr('value', 'ALIAS')
.text($.i18n._('wikidata-schema/alias')) .text($.i18n('wikidata-schema/alias'))
.appendTo(type_input); .appendTo(type_input);
type_input.val(type); type_input.val(type);
type_input.on('change', function(e) { type_input.on('change', function(e) {
@ -488,7 +488,7 @@ SchemaAlignmentDialog._addStatementGroup = function(item, json) {
SchemaAlignmentDialog._addStatement(statementContainer, datatype, null); SchemaAlignmentDialog._addStatement(statementContainer, datatype, null);
e.preventDefault(); e.preventDefault();
}).appendTo(toolbar).hide(); }).appendTo(toolbar).hide();
SchemaAlignmentDialog._plusButton($.i18n._('wikidata-schema/add-value'), addValueButton); SchemaAlignmentDialog._plusButton($.i18n('wikidata-schema/add-value'), addValueButton);
var removeButton = SchemaAlignmentDialog._makeDeleteButton() var removeButton = SchemaAlignmentDialog._makeDeleteButton()
.addClass('wbs-remove-statement-group') .addClass('wbs-remove-statement-group')
.appendTo(toolbar) .appendTo(toolbar)
@ -561,7 +561,7 @@ SchemaAlignmentDialog._addStatement = function(container, datatype, json) {
SchemaAlignmentDialog._addQualifier(qualifierContainer, null); SchemaAlignmentDialog._addQualifier(qualifierContainer, null);
e.preventDefault(); e.preventDefault();
}).appendTo(toolbar2); }).appendTo(toolbar2);
SchemaAlignmentDialog._plusButton($.i18n._('wikidata-schema/add-qualifier'), addQualifierButton); SchemaAlignmentDialog._plusButton($.i18n('wikidata-schema/add-qualifier'), addQualifierButton);
if (qualifiers) { if (qualifiers) {
for (var i = 0; i != qualifiers.length; i++) { for (var i = 0; i != qualifiers.length; i++) {
@ -592,7 +592,7 @@ SchemaAlignmentDialog._addStatement = function(container, datatype, json) {
SchemaAlignmentDialog._updateReferencesNumber(referenceContainer); SchemaAlignmentDialog._updateReferencesNumber(referenceContainer);
e.preventDefault(); e.preventDefault();
}).appendTo(toolbar3); }).appendTo(toolbar3);
SchemaAlignmentDialog._plusButton($.i18n._('wikidata-schema/add-reference'), addReferenceButton); SchemaAlignmentDialog._plusButton($.i18n('wikidata-schema/add-reference'), addReferenceButton);
if (references) { if (references) {
for (var i = 0; i != references.length; i++) { for (var i = 0; i != references.length; i++) {
SchemaAlignmentDialog._addReference(referenceContainer, references[i]); SchemaAlignmentDialog._addReference(referenceContainer, references[i]);
@ -688,7 +688,7 @@ SchemaAlignmentDialog._addReference = function(container, json) {
SchemaAlignmentDialog._addQualifier(qualifierContainer, null); SchemaAlignmentDialog._addQualifier(qualifierContainer, null);
e.preventDefault(); e.preventDefault();
}).appendTo(toolbar2); }).appendTo(toolbar2);
SchemaAlignmentDialog._plusButton($.i18n._('wikidata-schema/add-reference-snak'), addSnakButton); SchemaAlignmentDialog._plusButton($.i18n('wikidata-schema/add-reference-snak'), addSnakButton);
if (snaks) { if (snaks) {
for (var i = 0; i != snaks.length; i++) { for (var i = 0; i != snaks.length; i++) {
@ -712,7 +712,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+$.i18n._('wikidata-schema/nb-references')); a.html(childrenCount+$.i18n('wikidata-schema/nb-references'));
} }
/************************ /************************
@ -736,7 +736,7 @@ SchemaAlignmentDialog._getPropertyType = function(pid, callback) {
SchemaAlignmentDialog._initPropertyField = function(inputContainer, targetContainer, initialValue) { SchemaAlignmentDialog._initPropertyField = function(inputContainer, targetContainer, initialValue) {
var input = $('<input></input>').appendTo(inputContainer); var input = $('<input></input>').appendTo(inputContainer);
input.attr("placeholder", $.i18n._('wikidata-schema/property-placeholder')); input.attr("placeholder", $.i18n('wikidata-schema/property-placeholder'));
if (this._reconService !== null) { if (this._reconService !== null) {
endpoint = this._reconService.suggest.property; endpoint = this._reconService.suggest.property;
@ -793,9 +793,9 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
if (this._reconService !== null && (mode === "wikibase-item" || mode === "unit")) { if (this._reconService !== null && (mode === "wikibase-item" || mode === "unit")) {
if (mode === "wikibase-item") { if (mode === "wikibase-item") {
input.attr("placeholder", $.i18n._('wikidata-schema/item-or-reconciled-column')); input.attr("placeholder", $.i18n('wikidata-schema/item-or-reconciled-column'));
} else { } else {
input.attr("placeholder", $.i18n._('wikidata-schema/unit')); input.attr("placeholder", $.i18n('wikidata-schema/unit'));
} }
var endpoint = null; var endpoint = null;
endpoint = this._reconService.suggest.entity; endpoint = this._reconService.suggest.entity;
@ -951,20 +951,20 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
changedCallback(); changedCallback();
}); });
if (mode === "amount") { if (mode === "amount") {
input.attr("placeholder", $.i18n._('wikidata-schema/amount')); input.attr("placeholder", $.i18n('wikidata-schema/amount'));
SchemaAlignmentDialog.setupStringInputValidation(input, /^[\-+]?\d+(\.\d*)?(E[\-+]\d+)?$/); SchemaAlignmentDialog.setupStringInputValidation(input, /^[\-+]?\d+(\.\d*)?(E[\-+]\d+)?$/);
} else if (mode === "url") { } else if (mode === "url") {
input.attr("placeholder", $.i18n._('wikidata-schema/full-url')); input.attr("placeholder", $.i18n('wikidata-schema/full-url'));
SchemaAlignmentDialog.setupStringInputValidation(input, /^https?:\/\/.+$/); SchemaAlignmentDialog.setupStringInputValidation(input, /^https?:\/\/.+$/);
} else if (mode === "tabular-data") { } else if (mode === "tabular-data") {
input.attr("placeholder", $.i18n._('wikidata-schema/tabular-data-with-prefix')); input.attr("placeholder", $.i18n('wikidata-schema/tabular-data-with-prefix'));
SchemaAlignmentDialog.setupStringInputValidation(input, /^Data:.+$/); SchemaAlignmentDialog.setupStringInputValidation(input, /^Data:.+$/);
} else if (mode === "commonsMedia") { } else if (mode === "commonsMedia") {
input.attr("placeholder", $.i18n._('wikidata-schema/commons-media')); input.attr("placeholder", $.i18n('wikidata-schema/commons-media'));
} else if (mode === "math") { } else if (mode === "math") {
input.attr("placeholder", $.i18n._('wikidata-schema/math-expression')); input.attr("placeholder", $.i18n('wikidata-schema/math-expression'));
} else if (mode === "geo-shape") { } else if (mode === "geo-shape") {
input.attr("placeholder", $.i18n._('wikidata-schema/geoshape-with-prefix')); input.attr("placeholder", $.i18n('wikidata-schema/geoshape-with-prefix'));
SchemaAlignmentDialog.setupStringInputValidation(input, /^Data:.+$/); SchemaAlignmentDialog.setupStringInputValidation(input, /^Data:.+$/);
} else { } else {
SchemaAlignmentDialog.setupStringInputValidation(input, /^.+$/); SchemaAlignmentDialog.setupStringInputValidation(input, /^.+$/);
@ -977,7 +977,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
mode !== "commonsMedia" && mode !== "commonsMedia" &&
mode !== "geo-shape" && mode !== "geo-shape" &&
mode !== "math") { mode !== "math") {
alert($.i18n._('wikidata-schema/datatype-not-supported-yet')); alert($.i18n('wikidata-schema/datatype-not-supported-yet'));
} }
} }
@ -990,7 +990,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
column.text(""); column.text("");
column.append($('<div></div>').addClass('wbs-restricted-column-name').text(origText)); column.append($('<div></div>').addClass('wbs-restricted-column-name').text(origText));
var deleteButton = SchemaAlignmentDialog._makeDeleteButton(true).appendTo(column); var deleteButton = SchemaAlignmentDialog._makeDeleteButton(true).appendTo(column);
deleteButton.attr('alt', $.i18n._('wikidata-schema/remove-column')); deleteButton.attr('alt', $.i18n('wikidata-schema/remove-column'));
deleteButton.click(function (e) { deleteButton.click(function (e) {
columnDiv.remove(); columnDiv.remove();
input.show(); input.show();
@ -1118,7 +1118,7 @@ SchemaAlignmentDialog._hasChanged = function() {
SchemaAlignmentDialog.updateNbEdits = function(nb_edits) { SchemaAlignmentDialog.updateNbEdits = function(nb_edits) {
this._previewElmts.previewExplanation.text( this._previewElmts.previewExplanation.text(
$.i18n._('wikidata-schema/preview-explanation').replace('{nb_edits}',nb_edits)); $.i18n('wikidata-schema/preview-explanation').replace('{nb_edits}',nb_edits));
} }
SchemaAlignmentDialog.preview = function() { SchemaAlignmentDialog.preview = function() {

View File

@ -9,10 +9,11 @@ $.ajax({
// lang : lang // lang : lang
}, },
success : function(data) { success : function(data) {
dictionary = data; dictionary = data['dictionary'];
lang = data['lang'];
} }
}); });
$.i18n.setDictionary(dictionary); $.i18n().load(dictionary, lang);
@ -20,19 +21,19 @@ ExporterManager.MenuItems.push({});
ExporterManager.MenuItems.push( ExporterManager.MenuItems.push(
{ {
id:"performWikibaseEdits", id:"performWikibaseEdits",
label: $.i18n._('wikidata-extension/perform-edits-on-wikidata'), label: $.i18n('wikidata-extension/perform-edits-on-wikidata'),
click: function() { PerformEditsDialog.checkAndLaunch(); } click: function() { PerformEditsDialog.checkAndLaunch(); }
}); });
ExporterManager.MenuItems.push( ExporterManager.MenuItems.push(
{ {
id:"exportQuickStatements", id:"exportQuickStatements",
label: $.i18n._('wikidata-extension/export-to-qs'), label: $.i18n('wikidata-extension/export-to-qs'),
click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("quickstatements"); } click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("quickstatements"); }
}); });
ExporterManager.MenuItems.push( ExporterManager.MenuItems.push(
{ {
id:"exportWikibaseSchema", id:"exportWikibaseSchema",
label: $.i18n._('wikidata-extension/export-schema'), label: $.i18n('wikidata-extension/export-schema'),
click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("wikibase-schema"); } click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("wikibase-schema"); }
} }
); );
@ -91,38 +92,38 @@ $(function(){
ExtensionBar.MenuItems.push( ExtensionBar.MenuItems.push(
{ {
"id":"reconcile", "id":"reconcile",
"label": $.i18n._('wikidata-extension/menu-label'), "label": $.i18n('wikidata-extension/menu-label'),
"submenu" : [ "submenu" : [
{ {
id: "wikidata/edit-schema", id: "wikidata/edit-schema",
label: $.i18n._('wikidata-extension/edit-wikidata-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: $.i18n._('wikidata-extension/manage-wikidata-account'), label: $.i18n('wikidata-extension/manage-wikidata-account'),
click: function() { ManageAccountDialog.checkAndLaunch(); } click: function() { ManageAccountDialog.checkAndLaunch(); }
}, },
{}, {},
{ {
id: "wikidata/import-schema", id: "wikidata/import-schema",
label: $.i18n._('wikidata-extension/import-wikidata-schema'), label: $.i18n('wikidata-extension/import-wikidata-schema'),
click: function() { ImportSchemaDialog.launch(); } click: function() { ImportSchemaDialog.launch(); }
}, },
{ {
id:"wikidata/export-schema", id:"wikidata/export-schema",
label: $.i18n._('wikidata-extension/export-schema'), label: $.i18n('wikidata-extension/export-schema'),
click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("wikibase-schema"); } click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("wikibase-schema"); }
}, },
{}, {},
{ {
id:"wikidata/perform-edits", id:"wikidata/perform-edits",
label: $.i18n._('wikidata-extension/perform-edits-on-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: $.i18n._('wikidata-extension/export-to-qs'), label: $.i18n('wikidata-extension/export-to-qs'),
click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("quickstatements"); } click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("quickstatements"); }
}, },

View File

@ -53,7 +53,7 @@ EditRenderer._renderItem = function(json, container) {
// Statements // Statements
if (json.addedStatementGroups && json.addedStatementGroups.length) { if (json.addedStatementGroups && json.addedStatementGroups.length) {
// $('<div></div>').addClass('wbs-statements-header') // $('<div></div>').addClass('wbs-statements-header')
// .text($.i18n._('wikidata-schema/statements-header')).appendTo(right); // .text($.i18n('wikidata-schema/statements-header')).appendTo(right);
var statementsGroupContainer = $('<div></div>').addClass('wbs-statement-group-container') var statementsGroupContainer = $('<div></div>').addClass('wbs-statement-group-container')
.appendTo(right); .appendTo(right);
for(var i = 0; i != json.addedStatementGroups.length; i++) { for(var i = 0; i != json.addedStatementGroups.length; i++) {
@ -82,7 +82,7 @@ EditRenderer._renderTerm = function(termType, json, container) {
var namedesc = $('<div></div>').addClass('wbs-namedesc').appendTo(container); var namedesc = $('<div></div>').addClass('wbs-namedesc').appendTo(container);
var type_container = $('<div></div>').addClass('wbs-namedesc-type').appendTo(namedesc); var type_container = $('<div></div>').addClass('wbs-namedesc-type').appendTo(namedesc);
var type_span = $('<span></span>').appendTo(type_container) var type_span = $('<span></span>').appendTo(type_container)
.text($.i18n._('wikidata-schema')[termType]); .text($.i18n('wikidata-schema')[termType]);
var right = $('<div></div>').addClass('wbs-right').appendTo(namedesc); var right = $('<div></div>').addClass('wbs-right').appendTo(namedesc);
var value_container = $('<div></div>').addClass('wbs-namedesc-value').appendTo(namedesc); var value_container = $('<div></div>').addClass('wbs-namedesc-value').appendTo(namedesc);
@ -202,7 +202,7 @@ EditRenderer._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+$.i18n._('wikidata-schema/nb-references')); a.html(childrenCount+$.i18n('wikidata-schema/nb-references'));
} }
/******************* /*******************
@ -231,7 +231,7 @@ EditRenderer._renderValue = function(json, container) {
action: 'wbformatvalue', action: 'wbformatvalue',
generate: 'text/html', generate: 'text/html',
datavalue: jsonValue, datavalue: jsonValue,
options: '{"lang":"'+$.i18n._('core-recon/wd-recon-lang')+'"}', options: '{"lang":"'+$.i18n('core-recon/wd-recon-lang')+'"}',
format: 'json' format: 'json'
}; };
if ('property' in json) { if ('property' in json) {

View File

@ -8,7 +8,7 @@ WarningsRenderer._renderEntity = function(entity) {
var id = entity.id; var id = entity.id;
var is_new = entity.siteIri == "http://localhost/entity/"; var is_new = entity.siteIri == "http://localhost/entity/";
if (is_new) { if (is_new) {
id = $.i18n._('wikidata-preview/new-id'); id = $.i18n('wikidata-preview/new-id');
} }
var fullLabel = id; var fullLabel = id;
if (entity.label) { if (entity.label) {
@ -46,7 +46,7 @@ WarningsRenderer._replaceIssueProperties = function(template, properties) {
} }
WarningsRenderer._renderWarning = function(warning) { WarningsRenderer._renderWarning = function(warning) {
var localized = $.i18n._('warnings-messages')[warning.type]; var localized = $.i18n('warnings-messages')[warning.type];
var title = warning.type; var title = warning.type;
var body = ""; var body = "";
if (localized) { if (localized) {

View File

@ -0,0 +1,21 @@
Copyright (c) 2012-2013 Santhosh Thottingal and other
contributors. See CREDITS for a list.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,19 +0,0 @@
Copyright (c) 2010 Dave Perrett, http://recursive-design.com/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -262,6 +262,32 @@
</filesets> </filesets>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<prefix>git</prefix>
<verbose>false</verbose>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
<format>json</format>
<gitDescribe>
<skip>false</skip>
<always>false</always>
<dirty>-dirty</dirty>
</gitDescribe>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
@ -345,7 +371,7 @@
<dependency> <dependency>
<groupId>org.jsoup</groupId> <groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId> <artifactId>jsoup</artifactId>
<version>1.4.1</version> <version>1.11.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.sf.opencsv</groupId> <groupId>net.sf.opencsv</groupId>

View File

@ -35,6 +35,7 @@ package com.google.refine;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.ArrayList; import java.util.ArrayList;
@ -52,9 +53,12 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.refine.commands.Command; import com.google.refine.commands.Command;
import com.google.refine.importing.ImportingManager; import com.google.refine.importing.ImportingManager;
import com.google.refine.io.FileProjectManager; import com.google.refine.io.FileProjectManager;
import com.google.refine.util.ParsingUtilities;
import edu.mit.simile.butterfly.Butterfly; import edu.mit.simile.butterfly.Butterfly;
import edu.mit.simile.butterfly.ButterflyModule; import edu.mit.simile.butterfly.ButterflyModule;
@ -107,7 +111,15 @@ public class RefineServlet extends Butterfly {
VERSION = ASSIGNED_VERSION; VERSION = ASSIGNED_VERSION;
} }
if (REVISION.equals("$REVISION")) { if (REVISION.equals("$REVISION")) {
REVISION = "TRUNK"; ClassLoader classLoader = getClass().getClassLoader();
try {
InputStream gitStats = classLoader.getResourceAsStream("git.properties");
ObjectMapper mapper = new ObjectMapper();
ObjectNode parsedGit = mapper.readValue(gitStats, ObjectNode.class);
REVISION = parsedGit.get("git.commit.id.abbrev").asText("TRUNK");
} catch (IOException e) {
REVISION = "TRUNK";
}
} }
FULL_VERSION = VERSION + " [" + REVISION + "]"; FULL_VERSION = VERSION + " [" + REVISION + "]";

View File

@ -74,6 +74,9 @@ public class ListFacet implements Facet {
public boolean omitError; public boolean omitError;
public List<DecoratedValue> selection = new LinkedList<>(); public List<DecoratedValue> selection = new LinkedList<>();
public boolean selectNumber;
public boolean selectDateTime;
public boolean selectBoolean;
public boolean selectBlank; public boolean selectBlank;
public boolean selectError; public boolean selectError;
@ -94,6 +97,9 @@ public class ListFacet implements Facet {
writer.endObject(); writer.endObject();
} }
writer.endArray(); writer.endArray();
writer.key("selectNumber"); writer.value(selectNumber);
writer.key("selectDateTime"); writer.value(selectDateTime);
writer.key("selectBoolean"); writer.value(selectBoolean);
writer.key("omitBlank"); writer.value(omitBlank); writer.key("omitBlank"); writer.value(omitBlank);
writer.key("selectBlank"); writer.value(selectBlank); writer.key("selectBlank"); writer.value(selectBlank);
writer.key("omitError"); writer.value(omitError); writer.key("omitError"); writer.value(omitError);
@ -124,6 +130,9 @@ public class ListFacet implements Facet {
omitBlank = JSONUtilities.getBoolean(o, "omitBlank", false); omitBlank = JSONUtilities.getBoolean(o, "omitBlank", false);
omitError = JSONUtilities.getBoolean(o, "omitError", false); omitError = JSONUtilities.getBoolean(o, "omitError", false);
selectNumber = JSONUtilities.getBoolean(o, "selectNumber", false);
selectDateTime = JSONUtilities.getBoolean(o, "selectDateTime", false);
selectBoolean = JSONUtilities.getBoolean(o, "selectBoolean", false);
selectBlank = JSONUtilities.getBoolean(o, "selectBlank", false); selectBlank = JSONUtilities.getBoolean(o, "selectBlank", false);
selectError = JSONUtilities.getBoolean(o, "selectError", false); selectError = JSONUtilities.getBoolean(o, "selectError", false);
} }
@ -149,6 +158,9 @@ public class ListFacet implements Facet {
* Computed results * Computed results
*/ */
protected List<NominalFacetChoice> _choices = new LinkedList<NominalFacetChoice>(); protected List<NominalFacetChoice> _choices = new LinkedList<NominalFacetChoice>();
protected int _numberCount;
protected int _datetimeCount;
protected int _booleanCount;
protected int _blankCount; protected int _blankCount;
protected int _errorCount; protected int _errorCount;
@ -176,7 +188,27 @@ public class ListFacet implements Facet {
choice.write(writer, options); choice.write(writer, options);
} }
writer.endArray(); writer.endArray();
if (_config.selectNumber || _numberCount > 0) {
writer.key("numberChoice");
writer.object();
writer.key("s"); writer.value(_config.selectNumber);
writer.key("c"); writer.value(_numberCount);
writer.endObject();
}
if (_config.selectDateTime || _datetimeCount > 0) {
writer.key("datetimeChoice");
writer.object();
writer.key("s"); writer.value(_config.selectDateTime);
writer.key("c"); writer.value(_datetimeCount);
writer.endObject();
}
if (_config.selectBoolean || _booleanCount > 0) {
writer.key("booleanChoice");
writer.object();
writer.key("s"); writer.value(_config.selectBoolean);
writer.key("c"); writer.value(_booleanCount);
writer.endObject();
}
if (!_config.omitBlank && (_config.selectBlank || _blankCount > 0)) { if (!_config.omitBlank && (_config.selectBlank || _blankCount > 0)) {
writer.key("blankChoice"); writer.key("blankChoice");
writer.object(); writer.object();
@ -238,13 +270,16 @@ public class ListFacet implements Facet {
return return
_eval == null || _eval == null ||
_errorMessage != null || _errorMessage != null ||
(_config.selection.size() == 0 && !_config.selectBlank && !_config.selectError) ? (_config.selection.size() == 0 && !_config.selectBlank && !_config.selectError && !_config.selectNumber && !_config.selectDateTime && !_config.selectBoolean) ?
null : null :
new ExpressionEqualRowFilter( new ExpressionEqualRowFilter(
_eval, _eval,
_config.columnName, _config.columnName,
_cellIndex, _cellIndex,
createMatches(), createMatches(),
_config.selectNumber,
_config.selectDateTime,
_config.selectBoolean,
_config.selectBlank, _config.selectBlank,
_config.selectError, _config.selectError,
_config.invert); _config.invert);
@ -310,6 +345,9 @@ public class ListFacet implements Facet {
} }
} }
_numberCount = grouper.numberCount;
_datetimeCount = grouper.datetimeCount;
_booleanCount = grouper.booleanCount;
_blankCount = grouper.blankCount; _blankCount = grouper.blankCount;
_errorCount = grouper.errorCount; _errorCount = grouper.errorCount;
} }
@ -321,4 +359,4 @@ public class ListFacet implements Facet {
} }
return a; return a;
} }
} }

View File

@ -33,6 +33,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.refine.browsing.filters; package com.google.refine.browsing.filters;
import java.time.OffsetDateTime;
import java.util.Collection; import java.util.Collection;
import java.util.Properties; import java.util.Properties;
@ -58,8 +60,10 @@ public class ExpressionEqualRowFilter implements RowFilter {
final protected int _cellIndex; // the expression is based on this column; final protected int _cellIndex; // the expression is based on this column;
// -1 if based on no column in particular, // -1 if based on no column in particular,
// for expression such as "row.starred". // for expression such as "row.starred".
final protected Object[] _matches; final protected Object[] _matches;
final protected boolean _selectNumber;
final protected boolean _selectDateTime;
final protected boolean _selectBoolean;
final protected boolean _selectBlank; final protected boolean _selectBlank;
final protected boolean _selectError; final protected boolean _selectError;
final protected boolean _invert; final protected boolean _invert;
@ -69,6 +73,9 @@ public class ExpressionEqualRowFilter implements RowFilter {
String columnName, String columnName,
int cellIndex, int cellIndex,
Object[] matches, Object[] matches,
boolean selectNumber,
boolean selectDateTime,
boolean selectBoolean,
boolean selectBlank, boolean selectBlank,
boolean selectError, boolean selectError,
boolean invert boolean invert
@ -77,6 +84,9 @@ public class ExpressionEqualRowFilter implements RowFilter {
_columnName = columnName; _columnName = columnName;
_cellIndex = cellIndex; _cellIndex = cellIndex;
_matches = matches; _matches = matches;
_selectNumber = selectNumber;
_selectDateTime = selectDateTime;
_selectBoolean = selectBoolean;
_selectBlank = selectBlank; _selectBlank = selectBlank;
_selectError = selectError; _selectError = selectError;
_invert = invert; _invert = invert;
@ -178,6 +188,12 @@ public class ExpressionEqualRowFilter implements RowFilter {
protected boolean testValue(Object v) { protected boolean testValue(Object v) {
if (ExpressionUtils.isError(v)) { if (ExpressionUtils.isError(v)) {
return _selectError; return _selectError;
} else if (v instanceof Number) {
return _selectNumber;
} else if (v instanceof OffsetDateTime) {
return _selectDateTime;
} else if (v instanceof Boolean) {
return _selectBoolean;
} else if (ExpressionUtils.isNonBlankData(v)) { } else if (ExpressionUtils.isNonBlankData(v)) {
for (Object match : _matches) { for (Object match : _matches) {
if (testValue(v, match)) { if (testValue(v, match)) {

View File

@ -57,15 +57,6 @@ import com.google.refine.util.StringUtils;
* from a given expression. * from a given expression.
*/ */
public class ExpressionNominalValueGrouper implements RowVisitor, RecordVisitor { public class ExpressionNominalValueGrouper implements RowVisitor, RecordVisitor {
static public class IndexedNominalFacetChoice extends NominalFacetChoice {
int _latestIndex;
public IndexedNominalFacetChoice(DecoratedValue decoratedValue, int latestIndex) {
super(decoratedValue);
_latestIndex = latestIndex;
}
}
/* /*
* Configuration * Configuration
*/ */
@ -77,14 +68,29 @@ public class ExpressionNominalValueGrouper implements RowVisitor, RecordVisitor
* Computed results * Computed results
*/ */
final public Map<Object, IndexedNominalFacetChoice> choices = new HashMap<Object, IndexedNominalFacetChoice>(); final public Map<Object, IndexedNominalFacetChoice> choices = new HashMap<Object, IndexedNominalFacetChoice>();
public int numberCount = 0;
public int datetimeCount = 0;
public int booleanCount = 0;
public int blankCount = 0; public int blankCount = 0;
public int errorCount = 0; public int errorCount = 0;
/* /*
* Scratch pad variables * Scratch pad variables
*/ */
protected boolean hasNumber;
protected boolean hasDateTime;
protected boolean hasBoolean;
protected boolean hasBlank; protected boolean hasBlank;
protected boolean hasError; protected boolean hasError;
static public class IndexedNominalFacetChoice extends NominalFacetChoice {
int _latestIndex;
public IndexedNominalFacetChoice(DecoratedValue decoratedValue, int latestIndex) {
super(decoratedValue);
_latestIndex = latestIndex;
}
}
public ExpressionNominalValueGrouper(Evaluable evaluable, String columnName, int cellIndex) { public ExpressionNominalValueGrouper(Evaluable evaluable, String columnName, int cellIndex) {
_evaluable = evaluable; _evaluable = evaluable;
@ -104,13 +110,25 @@ public class ExpressionNominalValueGrouper implements RowVisitor, RecordVisitor
@Override @Override
public boolean visit(Project project, int rowIndex, Row row) { public boolean visit(Project project, int rowIndex, Row row) {
hasNumber = false;
hasDateTime = false;
hasBoolean = false;
hasError = false; hasError = false;
hasBlank = false; hasBlank = false;
Properties bindings = ExpressionUtils.createBindings(project); Properties bindings = ExpressionUtils.createBindings(project);
visitRow(project, rowIndex, row, bindings, rowIndex); visitRow(project, rowIndex, row, bindings, rowIndex);
if (hasNumber) {
numberCount++;
}
if (hasDateTime) {
datetimeCount++;
}
if (hasBoolean) {
booleanCount++;
}
if (hasError) { if (hasError) {
errorCount++; errorCount++;
} }
@ -123,6 +141,9 @@ public class ExpressionNominalValueGrouper implements RowVisitor, RecordVisitor
@Override @Override
public boolean visit(Project project, Record record) { public boolean visit(Project project, Record record) {
hasNumber = false;
hasDateTime = false;
hasBoolean = false;
hasError = false; hasError = false;
hasBlank = false; hasBlank = false;
@ -133,6 +154,15 @@ public class ExpressionNominalValueGrouper implements RowVisitor, RecordVisitor
visitRow(project, r, row, bindings, record.recordIndex); visitRow(project, r, row, bindings, record.recordIndex);
} }
if (hasNumber) {
numberCount++;
}
if (hasDateTime) {
datetimeCount++;
}
if (hasBoolean) {
booleanCount++;
}
if (hasError) { if (hasError) {
errorCount++; errorCount++;
} }
@ -174,6 +204,12 @@ public class ExpressionNominalValueGrouper implements RowVisitor, RecordVisitor
protected void processValue(Object value, int index) { protected void processValue(Object value, int index) {
if (ExpressionUtils.isError(value)) { if (ExpressionUtils.isError(value)) {
hasError = true; hasError = true;
} else if (ExpressionUtils.isNumber(value)) {
hasNumber = true;
} else if (ExpressionUtils.isDateTime(value)) {
hasDateTime = true;
} else if (ExpressionUtils.isBoolean(value)) {
hasBoolean = true;
} else if (ExpressionUtils.isNonBlankData(value)) { } else if (ExpressionUtils.isNonBlankData(value)) {
String valueString = StringUtils.toString(value); String valueString = StringUtils.toString(value);
IndexedNominalFacetChoice facetChoice = choices.get(valueString); IndexedNominalFacetChoice facetChoice = choices.get(valueString);
@ -236,6 +272,12 @@ public class ExpressionNominalValueGrouper implements RowVisitor, RecordVisitor
public Integer getChoiceValueCount(Object choiceValue) { public Integer getChoiceValueCount(Object choiceValue) {
if (ExpressionUtils.isError(choiceValue)) { if (ExpressionUtils.isError(choiceValue)) {
return errorCount; return errorCount;
} else if (ExpressionUtils.isNumber(choiceValue)) {
return numberCount;
} else if (ExpressionUtils.isDateTime(choiceValue)) {
return datetimeCount;
} else if (ExpressionUtils.isBoolean(choiceValue)) {
return booleanCount;
} else if (ExpressionUtils.isNonBlankData(choiceValue)) { } else if (ExpressionUtils.isNonBlankData(choiceValue)) {
IndexedNominalFacetChoice choice = choices.get(StringUtils.toString(choiceValue)); IndexedNominalFacetChoice choice = choices.get(StringUtils.toString(choiceValue));
return choice != null ? choice.count : 0; return choice != null ? choice.count : 0;

View File

@ -69,7 +69,10 @@ public class LoadLanguageCommand extends Command {
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.setContentType("application/json"); response.setContentType("application/json");
try { try {
json.write(response.getWriter()); JSONObject fullJson = new JSONObject();
fullJson.put("dictionary", json);
fullJson.put("lang", lang);
fullJson.write(response.getWriter());
} catch (JSONException e) { } catch (JSONException e) {
logger.error("Error writing language labels to response stream"); logger.error("Error writing language labels to response stream");
} }

View File

@ -106,7 +106,7 @@ public class CreateProjectCommand extends Command {
} }
JSONObject optionObj = null; JSONObject optionObj = null;
String optionsString = request.getParameter("options"); String optionsString = parameters.getProperty("options");
if (optionsString != null && !optionsString.isEmpty()) { if (optionsString != null && !optionsString.isEmpty()) {
optionObj = ParsingUtilities.evaluateJsonStringToObject(optionsString); optionObj = ParsingUtilities.evaluateJsonStringToObject(optionsString);
} else { } else {

View File

@ -103,11 +103,19 @@ public class ExpressionUtils {
static public boolean isError(Object o) { static public boolean isError(Object o) {
return o instanceof EvalError; return o instanceof EvalError;
} }
/*
static public boolean isBlank(Object o) { static public boolean isNumber(Object v) {
return o == null || (o instanceof String && ((String) o).length() == 0); return v != null && (v instanceof Number);
} }
*/
static public boolean isBoolean(Object v) {
return v != null && v instanceof Boolean;
}
static public boolean isDateTime(Object v) {
return v != null && v instanceof OffsetDateTime;
}
static public boolean isNonBlankData(Object o) { static public boolean isNonBlankData(Object o) {
return return
o != null && o != null &&

View File

@ -67,10 +67,11 @@ public class Cross implements Function {
(String) toProjectName, (String) toProjectName,
(String) toColumnName (String) toColumnName
); );
if(v instanceof String) {
String srcValue = v instanceof String ? (String)v : (String)((WrappedCell) v).cell.value; return join.getRows(v);
} else {
return join.getRows(srcValue); return join.getRows(((WrappedCell) v).cell.value);
}
} }
} }
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a string or cell, a project name to join with, and a column name in that project"); return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a string or cell, a project name to join with, and a column name in that project");

View File

@ -40,6 +40,7 @@ import org.json.JSONWriter;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import com.google.refine.expr.EvalError; import com.google.refine.expr.EvalError;
import com.google.refine.expr.functions.xml.InnerXml;
import com.google.refine.grel.ControlFunctionRegistry; import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function; import com.google.refine.grel.Function;
@ -47,17 +48,15 @@ public class InnerHtml implements Function {
@Override @Override
public Object call(Properties bindings, Object[] args) { public Object call(Properties bindings, Object[] args) {
if (args.length >= 1) { if (args.length == 1) {
Object o1 = args[0]; Object o1 = args[0];
if (o1 != null && o1 instanceof Element) { if (o1 != null && o1 instanceof Element) {
Element e1 = (Element)o1; return new InnerXml().call(bindings, args, "html");
return e1.html();
}else{ }else{
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an HTML Element. Please first use parseHtml(string) and select(query) prior to using this function"); return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an HTML Element. Please first use parseHtml(string) and select(query) prior to using this function");
} }
} }
return null; return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a single String as an argument");
} }

View File

@ -37,21 +37,23 @@ import java.util.Properties;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONWriter; import org.json.JSONWriter;
import org.jsoup.Jsoup;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.functions.xml.ParseXml;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function; import com.google.refine.grel.Function;
public class ParseHtml implements Function { public class ParseHtml implements Function {
@Override @Override
public Object call(Properties bindings, Object[] args) { public Object call(Properties bindings, Object[] args) {
if (args.length >= 1) { if (args.length == 1) {
Object o1 = args[0]; Object o1 = args[0];
if (o1 != null && o1 instanceof String) { if (o1 != null && o1 instanceof String) {
return Jsoup.parse(o1.toString()); return new ParseXml().call(bindings,args,"html");
} }
} }
return null; return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a single String as an argument");
} }

View File

@ -0,0 +1,84 @@
/*
Copyright 2010, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.google.refine.expr.functions.xml;
import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import org.jsoup.nodes.Element;
import com.google.refine.expr.EvalError;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class InnerXml implements Function {
@Override
public Object call(Properties bindings, Object[] args) {
return call(bindings,args,"xml");
}
public Object call(Properties bindings, Object[] args, String mode) {
if (args.length == 1) {
Object o1 = args[0];
if (o1 != null && o1 instanceof Element) {
Element e1 = (Element)o1;
if(mode == "xml") {
return e1.children().toString();
} else if (mode == "html") {
return e1.html();
} else {
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " unable to determine whether XML or HTML is being used.");
}
}else{
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an XML or HTML Element. Please first use parseXml() or parseHtml() and select(query) prior to using this function");
}
}
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a single XML or HTML element as an argument");
}
@Override
public void write(JSONWriter writer, Properties options)
throws JSONException {
writer.object();
writer.key("description"); writer.value("The innerXml/innerHtml of an XML/HTML element");
writer.key("params"); writer.value("Element e");
writer.key("returns"); writer.value("String innerXml/innerHtml");
writer.endObject();
}
}

View File

@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.google.refine.expr.functions.html; package com.google.refine.expr.functions.xml;
import java.util.Properties; import java.util.Properties;
@ -47,17 +47,17 @@ public class OwnText implements Function {
@Override @Override
public Object call(Properties bindings, Object[] args) { public Object call(Properties bindings, Object[] args) {
if (args.length >= 1) { if (args.length == 1) {
Object o1 = args[0]; Object o1 = args[0];
if (o1 != null && o1 instanceof Element) { if (o1 != null && o1 instanceof Element) {
Element e1 = (Element)o1; Element e1 = (Element)o1;
return e1.ownText(); return e1.ownText();
}else{ }else{
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an HTML Element. Please first use parseHtml(string) and select(query) prior to using this function"); return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an XML or HTML Element. Please first use parseHtml(string) and select(query) prior to using this function");
} }
} }
return null; return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a single XML or HTML element as an argument");
} }
@ -66,7 +66,7 @@ public class OwnText implements Function {
throws JSONException { throws JSONException {
writer.object(); writer.object();
writer.key("description"); writer.value("Gets the text owned by this HTML element only; does not get the combined text of all children."); writer.key("description"); writer.value("Gets the text owned by this XML/HTML element only; does not get the combined text of all children.");
writer.key("params"); writer.value("Element e"); writer.key("params"); writer.value("Element e");
writer.key("returns"); writer.value("String ownText"); writer.key("returns"); writer.value("String ownText");
writer.endObject(); writer.endObject();

View File

@ -0,0 +1,82 @@
/*
Copyright 2010, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.google.refine.expr.functions.xml;
import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import org.jsoup.Jsoup;
import org.jsoup.parser.Parser;
import com.google.refine.expr.EvalError;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class ParseXml implements Function {
@Override
public Object call(Properties bindings, Object[] args) {
return call(bindings,args,"xml");
}
public Object call(Properties bindings, Object[] args, String mode) {
if (args.length == 1) {
Object o1 = args[0];
if (o1 != null && o1 instanceof String) {
if (mode == "html") {
return Jsoup.parse(o1.toString());
} else if (mode == "xml") {
return Jsoup.parse(o1.toString(), "",Parser.xmlParser());
} else {
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " unable to identify which parser to use");
}
}
}
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a single String as an argument");
}
@Override
public void write(JSONWriter writer, Properties options)
throws JSONException {
writer.object();
writer.key("description"); writer.value("Parses a string as XML");
writer.key("params"); writer.value("string s");
writer.key("returns"); writer.value("XML object");
writer.endObject();
}
}

View File

@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.google.refine.expr.functions.html; package com.google.refine.expr.functions.xml;
import java.util.Properties; import java.util.Properties;
@ -43,11 +43,11 @@ import com.google.refine.expr.EvalError;
import com.google.refine.grel.ControlFunctionRegistry; import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function; import com.google.refine.grel.Function;
public class SelectHtml implements Function { public class SelectXml implements Function {
@Override @Override
public Object call(Properties bindings, Object[] args) { public Object call(Properties bindings, Object[] args) {
if (args.length >= 2) { if (args.length == 2) {
Object o1 = args[0]; Object o1 = args[0];
Object o2 = args[1]; Object o2 = args[1];
if (o1 != null && o1 instanceof Element) { if (o1 != null && o1 instanceof Element) {
@ -56,10 +56,10 @@ public class SelectHtml implements Function {
return e1.select(o2.toString()); return e1.select(o2.toString());
} }
}else{ }else{
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an HTML Element. Please first use parseHtml(string)"); return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an XML or HTML Element. Please first use parseXml() or parseHtml()");
} }
} }
return null; return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects two arguments");
} }
@ -68,9 +68,9 @@ public class SelectHtml implements Function {
throws JSONException { throws JSONException {
writer.object(); writer.object();
writer.key("description"); writer.value("Selects an element from an HTML elementn using selector syntax"); writer.key("description"); writer.value("Selects an element from an XML or HTML element using selector syntax.");
writer.key("params"); writer.value("Element e, String s"); writer.key("params"); writer.value("Element e, String s");
writer.key("returns"); writer.value("HTML Elements"); writer.key("returns"); writer.value("XML/HTML Elements");
writer.endObject(); writer.endObject();
} }
} }

View File

@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.google.refine.expr.functions.html; package com.google.refine.expr.functions.xml;
import java.util.Properties; import java.util.Properties;
@ -43,11 +43,11 @@ import com.google.refine.expr.EvalError;
import com.google.refine.grel.ControlFunctionRegistry; import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function; import com.google.refine.grel.Function;
public class HtmlAttr implements Function { public class XmlAttr implements Function {
@Override @Override
public Object call(Properties bindings, Object[] args) { public Object call(Properties bindings, Object[] args) {
if (args.length >= 2) { if (args.length == 2) {
Object o1 = args[0]; Object o1 = args[0];
Object o2 = args[1]; Object o2 = args[1];
if (o1 != null && o1 instanceof Element) { if (o1 != null && o1 instanceof Element) {
@ -56,10 +56,10 @@ public class HtmlAttr implements Function {
return e1.attr(o2.toString()); return e1.attr(o2.toString());
} }
}else{ }else{
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an HTML Element. Please first use parseHtml(string) and select(query) prior to using this function"); return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an XML or HTML Element. Please first use parseXml() or parseHtml() and select() prior to using this function");
} }
} }
return null; return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects two arguments");
} }
@ -68,7 +68,7 @@ public class HtmlAttr implements Function {
throws JSONException { throws JSONException {
writer.object(); writer.object();
writer.key("description"); writer.value("Selects a value from an attribute on an Html Element"); writer.key("description"); writer.value("Selects a value from an attribute on an xml or html Element.");
writer.key("params"); writer.value("Element e, String s"); writer.key("params"); writer.value("Element e, String s");
writer.key("returns"); writer.value("String attribute Value"); writer.key("returns"); writer.value("String attribute Value");
writer.endObject(); writer.endObject();

View File

@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package com.google.refine.expr.functions.html; package com.google.refine.expr.functions.xml;
import java.util.Properties; import java.util.Properties;
@ -43,21 +43,21 @@ import com.google.refine.expr.EvalError;
import com.google.refine.grel.ControlFunctionRegistry; import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function; import com.google.refine.grel.Function;
public class HtmlText implements Function { public class XmlText implements Function {
@Override @Override
public Object call(Properties bindings, Object[] args) { public Object call(Properties bindings, Object[] args) {
if (args.length >= 1) { if (args.length == 1) {
Object o1 = args[0]; Object o1 = args[0];
if (o1 != null && o1 instanceof Element) { if (o1 != null && o1 instanceof Element) {
Element e1 = (Element)o1; Element e1 = (Element)o1;
return e1.text(); return e1.text();
}else{ }else{
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an HTML Element. Please first use parseHtml(string) and select(query) prior to using this function"); return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an XML or HTML Element. Please first use parseXml() or parseHtml() and select(query) prior to using this function");
} }
} }
return null; return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a single XML or HTML element as an argument");
} }

View File

@ -61,12 +61,14 @@ import com.google.refine.expr.functions.booleans.Xor;
import com.google.refine.expr.functions.date.DatePart; import com.google.refine.expr.functions.date.DatePart;
import com.google.refine.expr.functions.date.Inc; import com.google.refine.expr.functions.date.Inc;
import com.google.refine.expr.functions.date.Now; import com.google.refine.expr.functions.date.Now;
import com.google.refine.expr.functions.html.HtmlAttr;
import com.google.refine.expr.functions.html.HtmlText;
import com.google.refine.expr.functions.html.InnerHtml; import com.google.refine.expr.functions.html.InnerHtml;
import com.google.refine.expr.functions.html.OwnText;
import com.google.refine.expr.functions.html.ParseHtml; import com.google.refine.expr.functions.html.ParseHtml;
import com.google.refine.expr.functions.html.SelectHtml; import com.google.refine.expr.functions.xml.XmlAttr;
import com.google.refine.expr.functions.xml.XmlText;
import com.google.refine.expr.functions.xml.InnerXml;
import com.google.refine.expr.functions.xml.OwnText;
import com.google.refine.expr.functions.xml.ParseXml;
import com.google.refine.expr.functions.xml.SelectXml;
import com.google.refine.expr.functions.math.ACos; import com.google.refine.expr.functions.math.ACos;
import com.google.refine.expr.functions.math.ASin; import com.google.refine.expr.functions.math.ASin;
import com.google.refine.expr.functions.math.ATan; import com.google.refine.expr.functions.math.ATan;
@ -234,11 +236,15 @@ public class ControlFunctionRegistry {
registerFunction("match", new Match()); registerFunction("match", new Match());
registerFunction("find", new Find()); registerFunction("find", new Find());
// HTML functions from JSoup // XML and HTML functions from JSoup
registerFunction("parseXml", new ParseXml());
registerFunction("parseHtml", new ParseHtml()); registerFunction("parseHtml", new ParseHtml());
registerFunction("select", new SelectHtml()); registerFunction("select", new SelectXml());
registerFunction("htmlAttr", new HtmlAttr()); registerFunction("xmlAttr", new XmlAttr());
registerFunction("htmlText", new HtmlText()); registerFunction("htmlAttr", new XmlAttr());
registerFunction("xmlText", new XmlText());
registerFunction("htmlText", new XmlText());
registerFunction("innerXml", new InnerXml());
registerFunction("innerHtml", new InnerHtml()); registerFunction("innerHtml", new InnerHtml());
registerFunction("ownText", new OwnText()); registerFunction("ownText", new OwnText());

View File

@ -15,11 +15,14 @@ public class ListFacetTests extends RefineTest {
private static String jsonConfig = "{" private static String jsonConfig = "{"
+ "\"type\":\"list\"," + "\"type\":\"list\","
+ "\"name\":\"facet A\"," + "\"name\":\"facet A\","
+ "\"columnName\":\"Column A\","
+ "\"expression\":\"value+\\\"bar\\\"\"," + "\"expression\":\"value+\\\"bar\\\"\","
+ "\"columnName\":\"Column A\","
+ "\"omitBlank\":false," + "\"omitBlank\":false,"
+ "\"omitError\":false," + "\"omitError\":false,"
+ "\"selection\":[{\"v\":{\"v\":\"foobar\",\"l\":\"true\"}}]," + "\"selection\":[{\"v\":{\"v\":\"foobar\",\"l\":\"true\"}}],"
+ "\"selectNumber\":false,"
+ "\"selectDateTime\":false,"
+ "\"selectBoolean\":false,"
+ "\"selectBlank\":false," + "\"selectBlank\":false,"
+ "\"selectError\":false," + "\"selectError\":false,"
+ "\"invert\":false" + "\"invert\":false"

View File

@ -0,0 +1,441 @@
/*
Copyright 2018, Owen Stephens
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.google.refine.tests.browsing.facets;
import com.google.refine.model.Cell;
import com.google.refine.model.Row;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.google.refine.model.ModelException;
import com.google.refine.model.Project;
import com.google.refine.browsing.RowFilter;
import com.google.refine.browsing.facets.Facet;
import com.google.refine.browsing.facets.ListFacet.ListFacetConfig;
import com.google.refine.tests.RefineTest;
public class TextListFacetTests extends RefineTest {
// dependencies
private Project project;
private RowFilter rowfilter;
// Variables
private static OffsetDateTime dateTimeValue = OffsetDateTime.parse("2017-05-12T05:45:00+00:00", DateTimeFormatter.ISO_OFFSET_DATE_TIME);
private static int integerValue = 1;
private static String stringValue = "a";
private static String emptyStringValue = "";
private static Boolean booleanValue = true;
private static final String projectName = "TextListFacet";
private static final String columnName = "Col1";
private static final int numberOfRows = 5;
@Override
@BeforeTest
public void init() {
logger = LoggerFactory.getLogger(this.getClass());
}
@BeforeMethod
public void setUp() throws JSONException, IOException, ModelException {
project = createProjectWithColumns(projectName, columnName);
for (int i = 0; i < numberOfRows; i++) {
Row row = new Row(1);
row.setCell(0, new Cell(stringValue, null));
project.rows.add(row);
}
for (int i = 0; i < numberOfRows; i++) {
Row row = new Row(1);
row.setCell(0, new Cell(dateTimeValue, null));
project.rows.add(row);
}
for (int i = 0; i < numberOfRows; i++) {
Row row = new Row(1);
row.setCell(0, new Cell(integerValue, null));
project.rows.add(row);
}
for (int i = 0; i < numberOfRows; i++) {
Row row = new Row(1);
row.setCell(0, new Cell(booleanValue, null));
project.rows.add(row);
}
for (int i = 0; i < numberOfRows; i++) {
Row row = new Row(1);
row.setCell(0, new Cell(null, null));
project.rows.add(row);
}
for (int i = 0; i < numberOfRows; i++) {
Row row = new Row(1);
row.setCell(0, new Cell(emptyStringValue, null));
project.rows.add(row);
}
}
@Test
public void testTextSelection() throws Exception {
//Need to work out the correct facet config for these tests to work
//Also need all rows in all tests so can check that rows aren't being selected when they shouldn't be
String jsonConfig = "{"
+ "\"type\": \"list\","
+ "\"name\": \"Value\","
+ "\"columnName\": \"" + columnName + "\","
+ "\"expression\": \"value\","
+ "\"omitBlank\": false,"
+ "\"omitError\": false,"
+ "\"selection\": ["
+ " {"
+ "\"v\": {"
+ "\"v\": \"a\","
+ "\"l\": \"a\""
+ "}"
+ "}"
+ "],"
+ "\"selectNumber\": false,"
+ "\"selectDateTime\": false,"
+ "\"selectBoolean\": false,"
+ "\"selectBlank\": false,"
+ "\"selectError\": false,"
+ "\"invert\": false"
+ "}";
//Add the facet to the project and create a row filter
ListFacetConfig facetConfig = new ListFacetConfig();
facetConfig.initializeFromJSON(new JSONObject(jsonConfig));
Facet facet = facetConfig.apply(project);
rowfilter = facet.getRowFilter(project);
//Check each row in the project against the filter
//Rows 1-5 are strings
Assert.assertEquals(rowfilter.filterRow(project, 0, project.rows.get(0)),true);
Assert.assertEquals(rowfilter.filterRow(project, 1, project.rows.get(1)),true);
Assert.assertEquals(rowfilter.filterRow(project, 2, project.rows.get(2)),true);
Assert.assertEquals(rowfilter.filterRow(project, 3, project.rows.get(3)),true);
Assert.assertEquals(rowfilter.filterRow(project, 4, project.rows.get(4)),true);
//Rows 6-10 are DateTimes
Assert.assertEquals(rowfilter.filterRow(project, 5, project.rows.get(5)),false);
Assert.assertEquals(rowfilter.filterRow(project, 6, project.rows.get(6)),false);
Assert.assertEquals(rowfilter.filterRow(project, 7, project.rows.get(7)),false);
Assert.assertEquals(rowfilter.filterRow(project, 8, project.rows.get(8)),false);
Assert.assertEquals(rowfilter.filterRow(project, 9, project.rows.get(9)),false);
//Rows 11-15 are integers
Assert.assertEquals(rowfilter.filterRow(project, 10, project.rows.get(10)),false);
Assert.assertEquals(rowfilter.filterRow(project, 11, project.rows.get(11)),false);
Assert.assertEquals(rowfilter.filterRow(project, 12, project.rows.get(12)),false);
Assert.assertEquals(rowfilter.filterRow(project, 13, project.rows.get(13)),false);
Assert.assertEquals(rowfilter.filterRow(project, 14, project.rows.get(14)),false);
//Rows 16-20 are booleans
Assert.assertEquals(rowfilter.filterRow(project, 15, project.rows.get(15)),false);
Assert.assertEquals(rowfilter.filterRow(project, 16, project.rows.get(16)),false);
Assert.assertEquals(rowfilter.filterRow(project, 17, project.rows.get(17)),false);
Assert.assertEquals(rowfilter.filterRow(project, 18, project.rows.get(18)),false);
Assert.assertEquals(rowfilter.filterRow(project, 19, project.rows.get(19)),false);
//Rows 21-25 are nulls
Assert.assertEquals(rowfilter.filterRow(project, 20, project.rows.get(20)),false);
Assert.assertEquals(rowfilter.filterRow(project, 21, project.rows.get(21)),false);
Assert.assertEquals(rowfilter.filterRow(project, 22, project.rows.get(22)),false);
Assert.assertEquals(rowfilter.filterRow(project, 23, project.rows.get(23)),false);
Assert.assertEquals(rowfilter.filterRow(project, 24, project.rows.get(24)),false);
//Rows 26-30 are empty strings
Assert.assertEquals(rowfilter.filterRow(project, 25, project.rows.get(25)),false);
Assert.assertEquals(rowfilter.filterRow(project, 26, project.rows.get(26)),false);
Assert.assertEquals(rowfilter.filterRow(project, 27, project.rows.get(27)),false);
Assert.assertEquals(rowfilter.filterRow(project, 28, project.rows.get(28)),false);
Assert.assertEquals(rowfilter.filterRow(project, 29, project.rows.get(29)),false);
}
@Test
public void testDateSelection() throws Exception {
String jsonConfig = "{"
+ "\"type\": \"list\","
+ "\"name\": \"Value\","
+ "\"columnName\": \"" + columnName + "\","
+ "\"expression\": \"value\","
+ "\"omitBlank\": false,"
+ "\"omitError\": false,"
+ "\"selection\": [],"
+ "\"selectNumber\": false,"
+ "\"selectDateTime\": true,"
+ "\"selectBoolean\": false,"
+ "\"selectBlank\": false,"
+ "\"selectError\": false,"
+ "\"invert\": false"
+ "}";
//Add the facet to the project and create a row filter
ListFacetConfig facetConfig = new ListFacetConfig();
facetConfig.initializeFromJSON(new JSONObject(jsonConfig));
Facet facet = facetConfig.apply(project);
rowfilter = facet.getRowFilter(project);
//Check each row in the project against the filter
//Rows 1-5 are strings
Assert.assertEquals(rowfilter.filterRow(project, 0, project.rows.get(0)),false);
Assert.assertEquals(rowfilter.filterRow(project, 1, project.rows.get(1)),false);
Assert.assertEquals(rowfilter.filterRow(project, 2, project.rows.get(2)),false);
Assert.assertEquals(rowfilter.filterRow(project, 3, project.rows.get(3)),false);
Assert.assertEquals(rowfilter.filterRow(project, 4, project.rows.get(4)),false);
//Rows 6-10 are DateTimes
Assert.assertEquals(rowfilter.filterRow(project, 5, project.rows.get(5)),true);
Assert.assertEquals(rowfilter.filterRow(project, 6, project.rows.get(6)),true);
Assert.assertEquals(rowfilter.filterRow(project, 7, project.rows.get(7)),true);
Assert.assertEquals(rowfilter.filterRow(project, 8, project.rows.get(8)),true);
Assert.assertEquals(rowfilter.filterRow(project, 9, project.rows.get(9)),true);
//Rows 11-15 are integers
Assert.assertEquals(rowfilter.filterRow(project, 10, project.rows.get(10)),false);
Assert.assertEquals(rowfilter.filterRow(project, 11, project.rows.get(11)),false);
Assert.assertEquals(rowfilter.filterRow(project, 12, project.rows.get(12)),false);
Assert.assertEquals(rowfilter.filterRow(project, 13, project.rows.get(13)),false);
Assert.assertEquals(rowfilter.filterRow(project, 14, project.rows.get(14)),false);
//Rows 16-20 are booleans
Assert.assertEquals(rowfilter.filterRow(project, 15, project.rows.get(15)),false);
Assert.assertEquals(rowfilter.filterRow(project, 16, project.rows.get(16)),false);
Assert.assertEquals(rowfilter.filterRow(project, 17, project.rows.get(17)),false);
Assert.assertEquals(rowfilter.filterRow(project, 18, project.rows.get(18)),false);
Assert.assertEquals(rowfilter.filterRow(project, 19, project.rows.get(19)),false);
//Rows 21-25 are nulls
Assert.assertEquals(rowfilter.filterRow(project, 20, project.rows.get(20)),false);
Assert.assertEquals(rowfilter.filterRow(project, 21, project.rows.get(21)),false);
Assert.assertEquals(rowfilter.filterRow(project, 22, project.rows.get(22)),false);
Assert.assertEquals(rowfilter.filterRow(project, 23, project.rows.get(23)),false);
Assert.assertEquals(rowfilter.filterRow(project, 24, project.rows.get(24)),false);
//Rows 26-30 are empty strings
Assert.assertEquals(rowfilter.filterRow(project, 25, project.rows.get(25)),false);
Assert.assertEquals(rowfilter.filterRow(project, 26, project.rows.get(26)),false);
Assert.assertEquals(rowfilter.filterRow(project, 27, project.rows.get(27)),false);
Assert.assertEquals(rowfilter.filterRow(project, 28, project.rows.get(28)),false);
Assert.assertEquals(rowfilter.filterRow(project, 29, project.rows.get(29)),false);
}
@Test
public void testIntegerSelection() throws Exception {
String jsonConfig = "{"
+ "\"type\": \"list\","
+ "\"name\": \"Value\","
+ "\"columnName\": \"" + columnName + "\","
+ "\"expression\": \"value\","
+ "\"omitBlank\": false,"
+ "\"omitError\": false,"
+ "\"selection\": [],"
+ "\"selectNumber\": true,"
+ "\"selectDateTime\": false,"
+ "\"selectBoolean\": false,"
+ "\"selectBlank\": false,"
+ "\"selectError\": false,"
+ "\"invert\": false"
+ "}";
//Add the facet to the project and create a row filter
ListFacetConfig facetConfig = new ListFacetConfig();
facetConfig.initializeFromJSON(new JSONObject(jsonConfig));
Facet facet = facetConfig.apply(project);
rowfilter = facet.getRowFilter(project);
//Check each row in the project against the filter
//Rows 1-5 are strings
Assert.assertEquals(rowfilter.filterRow(project, 0, project.rows.get(0)),false);
Assert.assertEquals(rowfilter.filterRow(project, 1, project.rows.get(1)),false);
Assert.assertEquals(rowfilter.filterRow(project, 2, project.rows.get(2)),false);
Assert.assertEquals(rowfilter.filterRow(project, 3, project.rows.get(3)),false);
Assert.assertEquals(rowfilter.filterRow(project, 4, project.rows.get(4)),false);
//Rows 6-10 are DateTimes
Assert.assertEquals(rowfilter.filterRow(project, 5, project.rows.get(5)),false);
Assert.assertEquals(rowfilter.filterRow(project, 6, project.rows.get(6)),false);
Assert.assertEquals(rowfilter.filterRow(project, 7, project.rows.get(7)),false);
Assert.assertEquals(rowfilter.filterRow(project, 8, project.rows.get(8)),false);
Assert.assertEquals(rowfilter.filterRow(project, 9, project.rows.get(9)),false);
//Rows 11-15 are integers
Assert.assertEquals(rowfilter.filterRow(project, 10, project.rows.get(10)),true);
Assert.assertEquals(rowfilter.filterRow(project, 11, project.rows.get(11)),true);
Assert.assertEquals(rowfilter.filterRow(project, 12, project.rows.get(12)),true);
Assert.assertEquals(rowfilter.filterRow(project, 13, project.rows.get(13)),true);
Assert.assertEquals(rowfilter.filterRow(project, 14, project.rows.get(14)),true);
//Rows 16-20 are booleans
Assert.assertEquals(rowfilter.filterRow(project, 15, project.rows.get(15)),false);
Assert.assertEquals(rowfilter.filterRow(project, 16, project.rows.get(16)),false);
Assert.assertEquals(rowfilter.filterRow(project, 17, project.rows.get(17)),false);
Assert.assertEquals(rowfilter.filterRow(project, 18, project.rows.get(18)),false);
Assert.assertEquals(rowfilter.filterRow(project, 19, project.rows.get(19)),false);
//Rows 21-25 are nulls
Assert.assertEquals(rowfilter.filterRow(project, 20, project.rows.get(20)),false);
Assert.assertEquals(rowfilter.filterRow(project, 21, project.rows.get(21)),false);
Assert.assertEquals(rowfilter.filterRow(project, 22, project.rows.get(22)),false);
Assert.assertEquals(rowfilter.filterRow(project, 23, project.rows.get(23)),false);
Assert.assertEquals(rowfilter.filterRow(project, 24, project.rows.get(24)),false);
//Rows 26-30 are empty strings
Assert.assertEquals(rowfilter.filterRow(project, 25, project.rows.get(25)),false);
Assert.assertEquals(rowfilter.filterRow(project, 26, project.rows.get(26)),false);
Assert.assertEquals(rowfilter.filterRow(project, 27, project.rows.get(27)),false);
Assert.assertEquals(rowfilter.filterRow(project, 28, project.rows.get(28)),false);
Assert.assertEquals(rowfilter.filterRow(project, 29, project.rows.get(29)),false);
}
@Test
public void testBooleanSelection() throws Exception {
String jsonConfig = "{"
+ "\"type\": \"list\","
+ "\"name\": \"Value\","
+ "\"columnName\": \"" + columnName + "\","
+ "\"expression\": \"value\","
+ "\"omitBlank\": false,"
+ "\"omitError\": false,"
+ "\"selection\": [],"
+ "\"selectNumber\": false,"
+ "\"selectDateTime\": false,"
+ "\"selectBoolean\": true,"
+ "\"selectBlank\": false,"
+ "\"selectError\": false,"
+ "\"invert\": false"
+ "}";
//Add the facet to the project and create a row filter
ListFacetConfig facetConfig = new ListFacetConfig();
facetConfig.initializeFromJSON(new JSONObject(jsonConfig));
Facet facet = facetConfig.apply(project);
rowfilter = facet.getRowFilter(project);
//Check each row in the project against the filter
//Rows 1-5 are strings
Assert.assertEquals(rowfilter.filterRow(project, 0, project.rows.get(0)),false);
Assert.assertEquals(rowfilter.filterRow(project, 1, project.rows.get(1)),false);
Assert.assertEquals(rowfilter.filterRow(project, 2, project.rows.get(2)),false);
Assert.assertEquals(rowfilter.filterRow(project, 3, project.rows.get(3)),false);
Assert.assertEquals(rowfilter.filterRow(project, 4, project.rows.get(4)),false);
//Rows 6-10 are DateTimes
Assert.assertEquals(rowfilter.filterRow(project, 5, project.rows.get(5)),false);
Assert.assertEquals(rowfilter.filterRow(project, 6, project.rows.get(6)),false);
Assert.assertEquals(rowfilter.filterRow(project, 7, project.rows.get(7)),false);
Assert.assertEquals(rowfilter.filterRow(project, 8, project.rows.get(8)),false);
Assert.assertEquals(rowfilter.filterRow(project, 9, project.rows.get(9)),false);
//Rows 11-15 are integers
Assert.assertEquals(rowfilter.filterRow(project, 10, project.rows.get(10)),false);
Assert.assertEquals(rowfilter.filterRow(project, 11, project.rows.get(11)),false);
Assert.assertEquals(rowfilter.filterRow(project, 12, project.rows.get(12)),false);
Assert.assertEquals(rowfilter.filterRow(project, 13, project.rows.get(13)),false);
Assert.assertEquals(rowfilter.filterRow(project, 14, project.rows.get(14)),false);
//Rows 16-20 are booleans
Assert.assertEquals(rowfilter.filterRow(project, 15, project.rows.get(15)),true);
Assert.assertEquals(rowfilter.filterRow(project, 16, project.rows.get(16)),true);
Assert.assertEquals(rowfilter.filterRow(project, 17, project.rows.get(17)),true);
Assert.assertEquals(rowfilter.filterRow(project, 18, project.rows.get(18)),true);
Assert.assertEquals(rowfilter.filterRow(project, 19, project.rows.get(19)),true);
//Rows 21-25 are nulls
Assert.assertEquals(rowfilter.filterRow(project, 20, project.rows.get(20)),false);
Assert.assertEquals(rowfilter.filterRow(project, 21, project.rows.get(21)),false);
Assert.assertEquals(rowfilter.filterRow(project, 22, project.rows.get(22)),false);
Assert.assertEquals(rowfilter.filterRow(project, 23, project.rows.get(23)),false);
Assert.assertEquals(rowfilter.filterRow(project, 24, project.rows.get(24)),false);
//Rows 26-30 are empty strings
Assert.assertEquals(rowfilter.filterRow(project, 25, project.rows.get(25)),false);
Assert.assertEquals(rowfilter.filterRow(project, 26, project.rows.get(26)),false);
Assert.assertEquals(rowfilter.filterRow(project, 27, project.rows.get(27)),false);
Assert.assertEquals(rowfilter.filterRow(project, 28, project.rows.get(28)),false);
Assert.assertEquals(rowfilter.filterRow(project, 29, project.rows.get(29)),false);
}
@Test
public void testBlankSelection() throws Exception {
String jsonConfig = "{"
+ "\"type\": \"list\","
+ "\"name\": \"Value\","
+ "\"columnName\": \"" + columnName + "\","
+ "\"expression\": \"value\","
+ "\"omitBlank\": false,"
+ "\"omitError\": false,"
+ "\"selection\": [],"
+ "\"selectNumber\": false,"
+ "\"selectDateTime\": false,"
+ "\"selectBoolean\": false,"
+ "\"selectBlank\": true,"
+ "\"selectError\": false,"
+ "\"invert\": false"
+ "}";
//Add the facet to the project and create a row filter
ListFacetConfig facetConfig = new ListFacetConfig();
facetConfig.initializeFromJSON(new JSONObject(jsonConfig));
Facet facet = facetConfig.apply(project);
rowfilter = facet.getRowFilter(project);
//Check each row in the project against the filter
//Rows 1-5 are strings
Assert.assertEquals(rowfilter.filterRow(project, 0, project.rows.get(0)),false);
Assert.assertEquals(rowfilter.filterRow(project, 1, project.rows.get(1)),false);
Assert.assertEquals(rowfilter.filterRow(project, 2, project.rows.get(2)),false);
Assert.assertEquals(rowfilter.filterRow(project, 3, project.rows.get(3)),false);
Assert.assertEquals(rowfilter.filterRow(project, 4, project.rows.get(4)),false);
//Rows 6-10 are DateTimes
Assert.assertEquals(rowfilter.filterRow(project, 5, project.rows.get(5)),false);
Assert.assertEquals(rowfilter.filterRow(project, 6, project.rows.get(6)),false);
Assert.assertEquals(rowfilter.filterRow(project, 7, project.rows.get(7)),false);
Assert.assertEquals(rowfilter.filterRow(project, 8, project.rows.get(8)),false);
Assert.assertEquals(rowfilter.filterRow(project, 9, project.rows.get(9)),false);
//Rows 11-15 are integers
Assert.assertEquals(rowfilter.filterRow(project, 10, project.rows.get(10)),false);
Assert.assertEquals(rowfilter.filterRow(project, 11, project.rows.get(11)),false);
Assert.assertEquals(rowfilter.filterRow(project, 12, project.rows.get(12)),false);
Assert.assertEquals(rowfilter.filterRow(project, 13, project.rows.get(13)),false);
Assert.assertEquals(rowfilter.filterRow(project, 14, project.rows.get(14)),false);
//Rows 16-20 are booleans
Assert.assertEquals(rowfilter.filterRow(project, 15, project.rows.get(15)),false);
Assert.assertEquals(rowfilter.filterRow(project, 16, project.rows.get(16)),false);
Assert.assertEquals(rowfilter.filterRow(project, 17, project.rows.get(17)),false);
Assert.assertEquals(rowfilter.filterRow(project, 18, project.rows.get(18)),false);
Assert.assertEquals(rowfilter.filterRow(project, 19, project.rows.get(19)),false);
//Rows 21-25 are nulls
Assert.assertEquals(rowfilter.filterRow(project, 20, project.rows.get(20)),true);
Assert.assertEquals(rowfilter.filterRow(project, 21, project.rows.get(21)),true);
Assert.assertEquals(rowfilter.filterRow(project, 22, project.rows.get(22)),true);
Assert.assertEquals(rowfilter.filterRow(project, 23, project.rows.get(23)),true);
Assert.assertEquals(rowfilter.filterRow(project, 24, project.rows.get(24)),true);
//Rows 26-30 are empty strings
Assert.assertEquals(rowfilter.filterRow(project, 25, project.rows.get(25)),true);
Assert.assertEquals(rowfilter.filterRow(project, 26, project.rows.get(26)),true);
Assert.assertEquals(rowfilter.filterRow(project, 27, project.rows.get(27)),true);
Assert.assertEquals(rowfilter.filterRow(project, 28, project.rows.get(28)),true);
Assert.assertEquals(rowfilter.filterRow(project, 29, project.rows.get(29)),true);
}
// should add tests for errors as well
}

View File

@ -62,10 +62,9 @@ public class ExpressionNominalValueGrouperTests extends RefineTest {
private static Properties bindings; private static Properties bindings;
private static OffsetDateTime dateTimeValue = OffsetDateTime.parse("2017-05-12T05:45:00+00:00", DateTimeFormatter.ISO_OFFSET_DATE_TIME); private static OffsetDateTime dateTimeValue = OffsetDateTime.parse("2017-05-12T05:45:00+00:00", DateTimeFormatter.ISO_OFFSET_DATE_TIME);
private static String dateTimeStringValue = "2017-05-12T05:45:00Z";
private static int integerValue = 1; private static int integerValue = 1;
private static String integerStringValue = "1";
private static String stringStringValue = "a"; private static String stringStringValue = "a";
private static Boolean booleanValue = true;
private static ExpressionNominalValueGrouper grouper; private static ExpressionNominalValueGrouper grouper;
private static Evaluable eval; private static Evaluable eval;
@ -143,11 +142,7 @@ public class ExpressionNominalValueGrouperTests extends RefineTest {
grouper.end(project); grouper.end(project);
} }
Assert.assertEquals(grouper.choices.size(),1); Assert.assertEquals(grouper.choices.size(),0);
Assert.assertTrue(grouper.choices.containsKey(integerStringValue));
Assert.assertEquals(grouper.choices.get(integerStringValue).decoratedValue.label,integerStringValue);
Assert.assertEquals(grouper.choices.get(integerStringValue).decoratedValue.value.toString(),integerStringValue);
} }
@Test @Test
@ -171,10 +166,30 @@ public class ExpressionNominalValueGrouperTests extends RefineTest {
grouper.end(project); grouper.end(project);
} }
Assert.assertEquals(grouper.choices.size(),1); Assert.assertEquals(grouper.choices.size(),0);
}
@Test
public void expressionNominalValueGrouperBooleans() throws Exception {
//populate project
for (int i = 0; i < numberOfRows; i++) {
Row row = new Row(1);
row.setCell(0, new Cell(booleanValue, null));
project.rows.add(row);
}
//create grouper
eval = MetaParser.parse("value");
grouper = new ExpressionNominalValueGrouper(eval, columnName, cellIndex);
try {
grouper.start(project);
for (int rowIndex = 0; rowIndex < numberOfRows; rowIndex++) {
Row row = project.rows.get(rowIndex);
grouper.visit(project, rowIndex, row);
}
} finally {
grouper.end(project);
}
Assert.assertTrue(grouper.choices.containsKey(dateTimeStringValue)); Assert.assertEquals(grouper.choices.size(),0);
Assert.assertEquals(grouper.choices.get(dateTimeStringValue).decoratedValue.label,dateTimeStringValue);
Assert.assertEquals(grouper.choices.get(dateTimeStringValue).decoratedValue.value.toString(),dateTimeStringValue);
} }
} }

View File

@ -1,6 +1,8 @@
package com.google.refine.tests.expr.functions; package com.google.refine.tests.expr.functions;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar; import java.util.Calendar;
import java.util.Properties; import java.util.Properties;
@ -13,10 +15,12 @@ import org.testng.annotations.Test;
import com.google.refine.expr.EvalError; import com.google.refine.expr.EvalError;
import com.google.refine.expr.HasFieldsListImpl; import com.google.refine.expr.HasFieldsListImpl;
import com.google.refine.expr.WrappedRow; import com.google.refine.expr.WrappedRow;
import com.google.refine.expr.WrappedCell;
import com.google.refine.grel.ControlFunctionRegistry; import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function; import com.google.refine.grel.Function;
import com.google.refine.model.Project; import com.google.refine.model.Project;
import com.google.refine.model.Row; import com.google.refine.model.Row;
import com.google.refine.model.Cell;
import com.google.refine.tests.RefineTest; import com.google.refine.tests.RefineTest;
/** /**
@ -24,6 +28,7 @@ import com.google.refine.tests.RefineTest;
*/ */
public class CrossFunctionTests extends RefineTest { public class CrossFunctionTests extends RefineTest {
static Properties bindings; static Properties bindings;
private static OffsetDateTime dateTimeValue = OffsetDateTime.parse("2017-05-12T05:45:00+00:00", DateTimeFormatter.ISO_OFFSET_DATE_TIME);
@Override @Override
@BeforeTest @BeforeTest
@ -45,16 +50,31 @@ public class CrossFunctionTests extends RefineTest {
+ "john,120 Main St.\n" + "john,120 Main St.\n"
+ "mary,50 Broadway Ave.\n" + "mary,50 Broadway Ave.\n"
+ "john,999 XXXXXX St.\n" // john's 2nd address + "john,999 XXXXXX St.\n" // john's 2nd address
+ "anne,17 Morning Crescent\n"; + "anne,17 Morning Crescent\n"
+ "2017-05-12T05:45:00Z,dateTime\n"
+ "1600,integer\n"
+ "true,boolean\n";
projectAddress = createCSVProject(projectName, input); projectAddress = createCSVProject(projectName, input);
projectName = "Christmas Gifts"; projectName = "Christmas Gifts";
input = "gift,recipient\n" input = "gift,recipient\n"
+ "lamp,mary\n" + "lamp,mary\n"
+ "clock,john\n"; + "clock,john\n"
+ "dateTime,2017-05-12T05:45:00Z\n"
+ "integer,1600\n"
+ "boolean,true\n";
projectGift = createCSVProject(projectName, input); projectGift = createCSVProject(projectName, input);
bindings.put("project", projectGift); bindings.put("project", projectGift);
//Add some non-string value cells to each project
projectAddress.rows.get(4).cells.set(0, new Cell(dateTimeValue, null));
projectAddress.rows.get(5).cells.set(0, new Cell(1600, null));
projectAddress.rows.get(6).cells.set(0, new Cell(true, null));
projectGift.rows.get(2).cells.set(1, new Cell(dateTimeValue, null));
projectGift.rows.get(3).cells.set(1, new Cell(1600, null));
projectGift.rows.get(4).cells.set(1, new Cell(true, null));
// add a column address based on column recipient // add a column address based on column recipient
bindings.put("columnName", "recipient"); bindings.put("columnName", "recipient");
} }
@ -82,6 +102,37 @@ public class CrossFunctionTests extends RefineTest {
Assert.assertNull(invoke("cross", "Anne", "My Address Book", "friend")); Assert.assertNull(invoke("cross", "Anne", "My Address Book", "friend"));
} }
@Test
public void crossFunctionDateTimeTest() throws Exception {
Project project = (Project) bindings.get("project");
Cell c = project.rows.get(2).cells.get(1);
WrappedCell lookup = new WrappedCell(project, "recipient", c);
Row row = ((Row)((WrappedRow) ((HasFieldsListImpl) invoke("cross", lookup, "My Address Book", "friend")).get(0)).row);
String address = row.getCell(1).value.toString();
Assert.assertEquals(address, "dateTime");
}
@Test
public void crossFunctionIntegerTest() throws Exception {
Project project = (Project) bindings.get("project");
Cell c = project.rows.get(3).cells.get(1);
WrappedCell lookup = new WrappedCell(project, "recipient", c);
Row row = ((Row)((WrappedRow) ((HasFieldsListImpl) invoke("cross", lookup, "My Address Book", "friend")).get(0)).row);
String address = row.getCell(1).value.toString();
Assert.assertEquals(address, "integer");
}
@Test
public void crossFunctionBooleanTest() throws Exception {
Project project = (Project) bindings.get("project");
Cell c = project.rows.get(4).cells.get(1);
WrappedCell lookup = new WrappedCell(project, "recipient", c);
Row row = ((Row)((WrappedRow) ((HasFieldsListImpl) invoke("cross", lookup, "My Address Book", "friend")).get(0)).row);
String address = row.getCell(1).value.toString();
Assert.assertEquals(address, "boolean");
}
/** /**
* If no match, return null. * If no match, return null.
* *

View File

@ -1,15 +0,0 @@
package com.google.refine.tests.expr.functions.html;
import org.testng.annotations.Test;
import com.google.refine.expr.functions.html.HtmlAttr;
import com.google.refine.tests.util.TestUtils;
public class HtmlAttrTests {
@Test
public void serializeHtmlAttr() {
String json = "{\"description\":\"Selects a value from an attribute on an Html Element\",\"params\":\"Element e, String s\",\"returns\":\"String attribute Value\"}";
TestUtils.isSerializedTo(new HtmlAttr(), json);
}
}

View File

@ -1,15 +1,86 @@
package com.google.refine.tests.expr.functions.html; package com.google.refine.tests.expr.functions.html;
import org.jsoup.Jsoup;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.util.Properties;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.functions.html.ParseHtml; import com.google.refine.expr.functions.html.ParseHtml;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
import com.google.refine.tests.RefineTest;
import com.google.refine.tests.util.TestUtils; import com.google.refine.tests.util.TestUtils;
public class ParseHtmlTests { public class ParseHtmlTests extends RefineTest {
static Properties bindings;
static String h = "<html>\n" +
"<head>\n" +
"</head>\n" +
" <body>\n" +
" <h1>head1</h1>\n" +
" <div class=\"class1\">\n" +
" <p>para1 <strong>strong text</strong></p>\n" +
" <p>para2</p>\n" +
" </div>\n" +
" </body>\n" +
"</html>";
@Override
@BeforeTest
public void init() {
logger = LoggerFactory.getLogger(this.getClass());
}
@BeforeMethod
public void SetUp() {
bindings = new Properties();
}
@AfterMethod
public void TearDown() {
bindings = null;
}
/**
* Lookup a control function by name and invoke it with a variable number of args
*/
private static Object invoke(String name,Object... args) {
// registry uses static initializer, so no need to set it up
Function function = ControlFunctionRegistry.getFunction(name);
if (function == null) {
throw new IllegalArgumentException("Unknown function "+name);
}
if (args == null) {
return function.call(bindings,new Object[0]);
} else {
return function.call(bindings,args);
}
}
@Test @Test
public void serializeParseHtml() { public void serializeParseHtml() {
String json = "{\"description\":\"Parses a string as HTML\",\"params\":\"string s\",\"returns\":\"HTML object\"}"; String json = "{\"description\":\"Parses a string as HTML\",\"params\":\"string s\",\"returns\":\"HTML object\"}";
TestUtils.isSerializedTo(new ParseHtml(), json); TestUtils.isSerializedTo(new ParseHtml(), json);
} }
@Test
public void testParseHtml() {
Assert.assertTrue(invoke("parseHtml") instanceof EvalError);
Assert.assertTrue(invoke("parseHtml","h") instanceof org.jsoup.nodes.Document);
Assert.assertTrue(invoke("select",Jsoup.parse(h),"p") instanceof org.jsoup.select.Elements);
Assert.assertTrue(invoke("innerHtml",Jsoup.parse(h).select("p").first()) instanceof String);
Assert.assertEquals(invoke("innerHtml",Jsoup.parse(h).select("p").first()),"para1 <strong>strong text</strong>");
Assert.assertEquals(invoke("htmlAttr",Jsoup.parse(h).select("div").first(),"class"),"class1");
Assert.assertEquals(invoke("htmlText",Jsoup.parse(h).select("div").first()),"para1 strong text para2");
Assert.assertEquals(invoke("ownText",Jsoup.parse(h).select("p").first()),"para1");
}
} }

View File

@ -1,15 +0,0 @@
package com.google.refine.tests.expr.functions.html;
import org.testng.annotations.Test;
import com.google.refine.expr.functions.html.SelectHtml;
import com.google.refine.tests.util.TestUtils;
public class SelectHtmlTests {
@Test
public void serializeSelectHtml() {
String json = "{\"description\":\"Selects an element from an HTML elementn using selector syntax\",\"params\":\"Element e, String s\",\"returns\":\"HTML Elements\"}";
TestUtils.isSerializedTo(new SelectHtml(), json);
}
}

View File

@ -0,0 +1,15 @@
package com.google.refine.tests.expr.functions.xml;
import org.testng.annotations.Test;
import com.google.refine.expr.functions.xml.InnerXml;
import com.google.refine.tests.util.TestUtils;
public class InnerXmlTests {
@Test
public void serializeInnerXml() {
String json = "{\"description\":\"The innerXml/innerHtml of an XML/HTML element\",\"params\":\"Element e\",\"returns\":\"String innerXml/innerHtml\"}";
TestUtils.isSerializedTo(new InnerXml(), json);
}
}

View File

@ -1,14 +1,14 @@
package com.google.refine.tests.expr.functions.html; package com.google.refine.tests.expr.functions.xml;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.refine.expr.functions.html.OwnText; import com.google.refine.expr.functions.xml.OwnText;
import com.google.refine.tests.util.TestUtils; import com.google.refine.tests.util.TestUtils;
public class OwnTextTests { public class OwnTextTests {
@Test @Test
public void serializeOwnText() { public void serializeOwnText() {
String json = "{\"description\":\"Gets the text owned by this HTML element only; does not get the combined text of all children.\",\"params\":\"Element e\",\"returns\":\"String ownText\"}"; String json = "{\"description\":\"Gets the text owned by this XML/HTML element only; does not get the combined text of all children.\",\"params\":\"Element e\",\"returns\":\"String ownText\"}";
TestUtils.isSerializedTo(new OwnText(), json); TestUtils.isSerializedTo(new OwnText(), json);
} }
} }

View File

@ -0,0 +1,92 @@
package com.google.refine.tests.expr.functions.xml;
import org.jsoup.parser.Parser;
import org.jsoup.Jsoup;
import org.testng.annotations.Test;
import java.util.Properties;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.functions.xml.ParseXml;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
import com.google.refine.tests.RefineTest;
import com.google.refine.tests.util.TestUtils;
public class ParseXmlTests extends RefineTest {
static Properties bindings;
static String x = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<root xmlns:foaf=\"http://xmlns.com/foaf/0.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n" +
" <foaf:Person>\n" +
" <foaf:name>John Doe</foaf:name>\n" +
" <head>head1</head>\n" +
" <head>head2</head>\n" +
" <BODY>body1</BODY>\n" +
" <foaf:homepage rdf:resource=\"http://www.example.com\"/>\n" +
" </foaf:Person>\n" +
" <foaf:Person>\n" +
" <foaf:name>Héloïse Dupont</foaf:name>\n" +
" <head>head3</head>\n" +
" <BODY>body2</BODY>\n" +
" <foaf:title/>\n" +
" </foaf:Person>\n" +
"</root>";
@Override
@BeforeTest
public void init() {
logger = LoggerFactory.getLogger(this.getClass());
}
@BeforeMethod
public void SetUp() {
bindings = new Properties();
}
@AfterMethod
public void TearDown() {
bindings = null;
}
/**
* Lookup a control function by name and invoke it with a variable number of args
*/
private static Object invoke(String name,Object... args) {
// registry uses static initializer, so no need to set it up
Function function = ControlFunctionRegistry.getFunction(name);
if (function == null) {
throw new IllegalArgumentException("Unknown function "+name);
}
if (args == null) {
return function.call(bindings,new Object[0]);
} else {
return function.call(bindings,args);
}
}
@Test
public void serializeParseXml() {
String json = "{\"description\":\"Parses a string as XML\",\"params\":\"string s\",\"returns\":\"XML object\"}";
TestUtils.isSerializedTo(new ParseXml(), json);
}
@Test
public void testParseXml() {
Assert.assertTrue(invoke("parseXml") instanceof EvalError);
Assert.assertTrue(invoke("parseXml","x") instanceof org.jsoup.nodes.Document);
Assert.assertTrue(invoke("select",Jsoup.parse(x,"",Parser.xmlParser()),"foaf|Person") instanceof org.jsoup.select.Elements);
Assert.assertEquals(invoke("innerXml",Jsoup.parse(x,"",Parser.xmlParser()).select("foaf|Person").first()),"<foaf:name>\n John Doe\n</foaf:name>\n<head>\n head1\n</head>\n<head>\n head2\n</head>\n<BODY>\n body1\n</BODY>\n<foaf:homepage rdf:resource=\"http://www.example.com\" />");
Assert.assertEquals(invoke("xmlAttr",Jsoup.parse(x,"",Parser.xmlParser()).select("foaf|homepage").first(),"rdf:resource"),"http://www.example.com");
Assert.assertEquals(invoke("ownText",Jsoup.parse(x,"",Parser.xmlParser()).select("BODY").first()),"body1");
Assert.assertEquals(invoke("xmlText",Jsoup.parse(x,"",Parser.xmlParser()).select("foaf|Person").first()),"John Doe head1 head2 body1");
}
}

View File

@ -0,0 +1,15 @@
package com.google.refine.tests.expr.functions.xml;
import org.testng.annotations.Test;
import com.google.refine.expr.functions.xml.SelectXml;
import com.google.refine.tests.util.TestUtils;
public class SelectXmlTests {
@Test
public void serializeSelectXml() {
String json = "{\"description\":\"Selects an element from an XML or HTML element using selector syntax.\",\"params\":\"Element e, String s\",\"returns\":\"XML/HTML Elements\"}";
TestUtils.isSerializedTo(new SelectXml(), json);
}
}

View File

@ -0,0 +1,15 @@
package com.google.refine.tests.expr.functions.xml;
import org.testng.annotations.Test;
import com.google.refine.expr.functions.xml.XmlAttr;
import com.google.refine.tests.util.TestUtils;
public class xmlAttrTests {
@Test
public void serializeXmlAttr() {
String json = "{\"description\":\"Selects a value from an attribute on an xml or html Element.\",\"params\":\"Element e, String s\",\"returns\":\"String attribute Value\"}";
TestUtils.isSerializedTo(new XmlAttr(), json);
}
}

View File

@ -1,15 +1,15 @@
package com.google.refine.tests.expr.functions.html; package com.google.refine.tests.expr.functions.xml;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.refine.expr.functions.html.HtmlText; import com.google.refine.expr.functions.xml.XmlText;
import com.google.refine.tests.util.TestUtils; import com.google.refine.tests.util.TestUtils;
public class HtmlTextTests { public class xmlTextTests {
@Test @Test
public void serializeHtmlText() { public void serializeXmlText() {
String json = "{\"description\":\"Selects the text from within an element (including all child elements)\",\"params\":\"Element e\",\"returns\":\"String text\"}"; String json = "{\"description\":\"Selects the text from within an element (including all child elements)\",\"params\":\"Element e\",\"returns\":\"String text\"}";
TestUtils.isSerializedTo(new HtmlText(), json); TestUtils.isSerializedTo(new XmlText(), json);
} }
} }

View File

@ -62,7 +62,7 @@ import com.google.refine.tests.RefineTest;
public class CacheTests extends RefineTest { public class CacheTests extends RefineTest {
// Equivalent to duplicate facet on Column A with true selected // Equivalent to duplicate facet on Column A with true selected
static final String ENGINE_JSON_DUPLICATES = "{\"facets\":[{\"type\":\"list\",\"name\":\"facet A\",\"columnName\":\"Column A\",\"expression\":\"facetCount(value, 'value', 'Column A') > 1\",\"omitBlank\":false,\"omitError\":false,\"selection\":[{\"v\":{\"v\":true,\"l\":\"true\"}}],\"selectBlank\":false,\"selectError\":false,\"invert\":false}],\"mode\":\"row-based\"}}"; static private final String ENGINE_JSON_DUPLICATES = "{\"facets\":[{\"type\":\"list\",\"name\":\"facet A\",\"columnName\":\"Column A\",\"expression\":\"(facetCount(value, 'value', 'Column A') > 1).toString()\",\"omitBlank\":false,\"omitError\":false,\"selection\":[{\"v\":{\"v\":\"true\",\"l\":\"true\"}}],\"selectBlank\":false,\"selectError\":false,\"invert\":false}],\"mode\":\"row-based\"}}";
@Override @Override
@BeforeTest @BeforeTest

View File

@ -345,6 +345,11 @@ function init() {
"externals/jsoneditor/jsoneditor.js", "externals/jsoneditor/jsoneditor.js",
"externals/select2/select2.min.js", "externals/select2/select2.min.js",
"externals/jquery.lavalamp.min.js", "externals/jquery.lavalamp.min.js",
"externals/jquery.i18n.messagestore.js",
"externals/jquery.i18n.emitter.js",
"externals/jquery.i18n.parser.js",
"externals/jquery.i18n.emitter.js",
"externals/jquery.i18n.language.js",
"scripts/util/misc.js", "scripts/util/misc.js",
"scripts/util/url.js", "scripts/util/url.js",
@ -429,6 +434,10 @@ function init() {
"externals/imgareaselect/jquery.imgareaselect.js", "externals/imgareaselect/jquery.imgareaselect.js",
"externals/date.js", "externals/date.js",
"externals/jquery.i18n.js", "externals/jquery.i18n.js",
"externals/jquery.i18n.messagestore.js",
"externals/jquery.i18n.parser.js",
"externals/jquery.i18n.emitter.js",
"externals/jquery.i18n.language.js",
"externals/underscore-min.js", "externals/underscore-min.js",
"externals/jsoneditor/jsoneditor.js", "externals/jsoneditor/jsoneditor.js",
@ -541,6 +550,10 @@ function init() {
"externals/imgareaselect/jquery.imgareaselect.js", "externals/imgareaselect/jquery.imgareaselect.js",
"externals/date.js", "externals/date.js",
"externals/jquery.i18n.js", "externals/jquery.i18n.js",
"externals/jquery.i18n.messagestore.js",
"externals/jquery.i18n.parser.js",
"externals/jquery.i18n.emitter.js",
"externals/jquery.i18n.language.js",
"externals/underscore-min.js", "externals/underscore-min.js",
"scripts/preferences.js", "scripts/preferences.js",
] ]

View File

@ -0,0 +1 @@
!function(e){"use strict";var n=function(){this.language=e.i18n.languages[String.locale]||e.i18n.languages.default};n.prototype={constructor:n,emit:function(n,r){var t,a,u,i=this;switch(typeof n){case"string":case"number":t=n;break;case"object":if(a=e.map(n.slice(1),function(e){return i.emit(e,r)}),u=n[0].toLowerCase(),"function"!=typeof i[u])throw new Error('unknown operation "'+u+'"');t=i[u](a,r);break;case"undefined":t="";break;default:throw new Error("unexpected type in AST: "+typeof n)}return t},concat:function(n){var r="";return e.each(n,function(e,n){r+=n}),r},replace:function(e,n){var r=parseInt(e[0],10);return r<n.length?n[r]:"$"+(r+1)},plural:function(e){var n=parseFloat(this.language.convertNumber(e[0],10)),r=e.slice(1);return r.length?this.language.convertPlural(n,r):""},gender:function(e){var n=e[0],r=e.slice(1);return this.language.gender(n,r)},grammar:function(e){var n=e[0],r=e[1];return r&&n&&this.language.convertGrammar(r,n)}},e.extend(e.i18n.parser.emitter,new n)}(jQuery);

View File

@ -1,4 +1,4 @@
/*! jQuery based internationalization library, Copyright 2010 Dave Perrett, http://recursive-design.com/ /* jQuery Internationalization library 1.0.4
* Released under the MIT license -- https://opensource.org/licenses/MIT */ * Copyright (C) 2012 Santhosh Thottingal
(function(f){f.i18n={dict:null,plural:null,setDictionary:function(a){null===this.dict?this.dict=a:f.extend(this.dict,a)},setPlural:function(a){this.plural=a},_p:function(a,d,e){var c=this.dict[a],b=[];b.push(e);if(void 0===c||null===this.plural)return this.printf(1<e?d:a,b);a=this.plural.replace(/n%/g,e+"%");eval(a);return this.printf(c[plural],b)},_:function(a,d){var e=a;this.dict&&this.dict[a]&&(e=this.dict[a]);return this.printf(e,d)},printf:function(a,d){if(!d)return a;for(var e="",c=/%(\d+)\$s/g, * Dual licensed GPLv2 or later and MIT. */
b=c.exec(a);b;){var f=parseInt(b[1],10)-1;a=a.replace("%"+b[1]+"$s",d[f]);b=c.exec(a)}c=a.split("%s");if(1<c.length)for(b=0;b<d.length;b++)0<c[b].length&&c[b].lastIndexOf("%")==c[b].length-1&&(c[b]+="s"+c.splice(b+1,1)[0]),e+=c[b]+d[b];return e+c[c.length-1]}};f.fn._t=function(a,d){return f(this).text(f.i18n._(a,d))}})(jQuery); !function(e){"use strict";var n,a,o=Array.prototype.slice;(a=function(n){this.options=e.extend({},a.defaults,n),this.parser=this.options.parser,this.locale=this.options.locale,this.messageStore=this.options.messageStore,this.languages={},this.init()}).prototype={init:function(){var n=this;String.locale=n.locale,String.prototype.toLocaleString=function(){var a,o,t,i,l,r,s;for(t=this.valueOf(),i=n.locale,l=0;i;){o=(a=i.split("-")).length;do{if(r=a.slice(0,o).join("-"),s=n.messageStore.get(r,t))return s;o--}while(o);if("en"===i)break;i=e.i18n.fallbacks[n.locale]&&e.i18n.fallbacks[n.locale][l]||n.options.fallbackLocale,e.i18n.log("Trying fallback locale for "+n.locale+": "+i),l++}return""}},destroy:function(){e.removeData(document,"i18n")},load:function(n,a){var o,t,i,l={};if(n||a||(n="i18n/"+e.i18n().locale+".json",a=e.i18n().locale),"string"==typeof n&&"json"!==n.split(".").pop()){l[a]=n+"/"+a+".json",o=(e.i18n.fallbacks[a]||[]).concat(this.options.fallbackLocale);for(t in o)l[i=o[t]]=n+"/"+i+".json";return this.load(l)}return this.messageStore.load(n,a)},parse:function(n,a){var o=n.toLocaleString();return this.parser.language=e.i18n.languages[e.i18n().locale]||e.i18n.languages.default,""===o&&(o=n),this.parser.parse(o,a)}},e.i18n=function(n,t){var i,l=e.data(document,"i18n"),r="object"==typeof n&&n;return r&&r.locale&&l&&l.locale!==r.locale&&(String.locale=l.locale=r.locale),l||(l=new a(r),e.data(document,"i18n",l)),"string"==typeof n?(i=void 0!==t?o.call(arguments,1):[],l.parse(n,i)):l},e.fn.i18n=function(){var n=e.data(document,"i18n");return n||(n=new a,e.data(document,"i18n",n)),String.locale=n.locale,this.each(function(){var a=e(this),o=a.data("i18n");o?a.text(n.parse(o)):a.find("[data-i18n]").i18n()})},String.locale=String.locale||e("html").attr("lang"),String.locale||(void 0!==typeof window.navigator?(n=window.navigator,String.locale=n.language||n.userLanguage||""):String.locale=""),e.i18n.languages={},e.i18n.messageStore=e.i18n.messageStore||{},e.i18n.parser={parse:function(e,n){return e.replace(/\$(\d+)/g,function(e,a){var o=parseInt(a,10)-1;return void 0!==n[o]?n[o]:"$"+a})},emitter:{}},e.i18n.fallbacks={},e.i18n.debug=!1,e.i18n.log=function(){window.console&&e.i18n.debug&&window.console.log.apply(window.console,arguments)},a.defaults={locale:String.locale,fallbackLocale:"en",parser:e.i18n.parser,messageStore:e.i18n.messageStore},e.i18n.constructor=a}(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
/* jQuery Internationalization library 1.0.4
* Copyright (C) 2012 Santhosh Thottingal
* Dual licensed GPLv2 or later and MIT. */
!function(e,s,t){"use strict";function n(s){var t=e.Deferred();return e.getJSON(s).done(t.resolve).fail(function(n,r,o){e.i18n.log("Error in loading messages from "+s+" Exception: "+o),t.resolve()}),t.promise()}var r=function(){this.messages={},this.sources={}};r.prototype={load:function(s,t){var r=null,o=[],i=this;if("string"==typeof s)return e.i18n.log("Loading messages from: "+s),n(s).done(function(e){i.set(t,e)}).promise();if(t)return i.set(t,s),e.Deferred().resolve();for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(t=r,o.push(i.load(s[r],t)));return e.when.apply(e,o)},set:function(s,t){this.messages[s]?this.messages[s]=e.extend(this.messages[s],t):this.messages[s]=t},get:function(e,s){return this.messages[e]&&this.messages[e][s]}},e.extend(e.i18n.messageStore,new r)}(jQuery,window);

View File

@ -0,0 +1,4 @@
/* jQuery Internationalization library 1.0.4
* Copyright (C) 2012 Santhosh Thottingal
* Dual licensed GPLv2 or later and MIT. */
!function(n){"use strict";var r=function(r){this.options=n.extend({},n.i18n.parser.defaults,r),this.language=n.i18n.languages[String.locale]||n.i18n.languages.default,this.emitter=n.i18n.parser.emitter};r.prototype={constructor:r,simpleParse:function(n,r){return n.replace(/\$(\d+)/g,function(n,t){var u=parseInt(t,10)-1;return void 0!==r[u]?r[u]:"$"+t})},parse:function(r,t){return r.indexOf("{{")<0?this.simpleParse(r,t):(this.emitter.language=n.i18n.languages[n.i18n().locale]||n.i18n.languages.default,this.emitter.emit(this.ast(r),t))},ast:function(n){function r(n){return function(){var r,t;for(r=0;r<n.length;r++)if(null!==(t=n[r]()))return t;return null}}function t(n){var r,t,u=F,l=[];for(r=0;r<n.length;r++){if(null===(t=n[r]()))return F=u,null;l.push(t)}return l}function u(n,r){return function(){for(var t=F,u=[],l=r();null!==l;)u.push(l),l=r();return u.length<n?(F=t,null):u}}function l(r){var t=r.length;return function(){var u=null;return n.substr(F,t)===r&&(u=r,F+=t),u}}function e(r){return function(){var t=n.substr(F).match(r);return null===t?null:(F+=t[0].length,t[0])}}function i(){var n=t([h,p]);return null===n?null:n[1]}function a(){var n=t([d,m]);return null===n?null:["REPLACE",parseInt(n[1],10)-1]}function o(){var n,r=t([g,u(0,b)]);return null===r?null:(n=r[1]).length>1?["CONCAT"].concat(n):n[0]}function c(){var n=t([w,v,a]);return null===n?null:[n[0],n[2]]}function f(){var n=t([w,v,b]);return null===n?null:[n[0],n[2]]}function s(){var n=t([E,j,O]);return null===n?null:n[1]}var g,v,h,p,d,m,$,x,C,A,P,j,w,E,O,S,b,y,F=0;if(g=l("|"),v=l(":"),h=l("\\"),p=e(/^./),d=l("$"),m=e(/^\d+/),$=e(/^[^{}\[\]$\\]/),x=e(/^[^{}\[\]$\\|]/),C=e(/^[^{}\[\]$\s]/),r([i,C]),A=r([i,x]),P=r([i,$]),w=function(n,r){return function(){var t=n();return null===t?null:r(t)}}(e(/^[ !"$&'()*,.\/0-9;=?@A-Z\^_`a-z~\x80-\xFF+\-]+/),function(n){return n.toString()}),j=r([function(){var n=t([r([c,f]),u(0,o)]);return null===n?null:n[0].concat(n[1])},function(){var n=t([w,u(0,o)]);return null===n?null:[n[0]].concat(n[1])}]),E=l("{{"),O=l("}}"),S=r([s,a,function(){var n=u(1,P)();return null===n?null:n.join("")}]),b=r([s,a,function(){var n=u(1,A)();return null===n?null:n.join("")}]),null===(y=function(){var n=u(0,S)();return null===n?null:["CONCAT"].concat(n)}())||F!==n.length)throw new Error("Parse error at position "+F.toString()+" in input: "+n);return y}},n.extend(n.i18n.parser,new r)}(jQuery);

View File

@ -399,7 +399,7 @@
"core-project/learn-more": "Erfahren Sie mehr &raquo;", "core-project/learn-more": "Erfahren Sie mehr &raquo;",
"core-project/other-processes": "andere anstehende Prozesse", "core-project/other-processes": "andere anstehende Prozesse",
"core-project/project-data-package": "Projektdatenpaket", "core-project/project-data-package": "Projektdatenpaket",
"core-project/excel-xml": "Excel 2007+ (.xlsx)", "core-project/excel-xml": ">=Excel 2007 (.xlsx)",
"core-project/custom-tabular": "Benutzerdefinierter tabellarischer Exporteur....", "core-project/custom-tabular": "Benutzerdefinierter tabellarischer Exporteur....",
"core-project/filter": "Filter:", "core-project/filter": "Filter:",
"core-project/extensions": "Erweiterungen", "core-project/extensions": "Erweiterungen",
@ -709,4 +709,4 @@
"core-views/use-values-as-identifiers2": "Zellen markieren, die mit Ihren Werten als Bezeichner abgeglichen sind", "core-views/use-values-as-identifiers2": "Zellen markieren, die mit Ihren Werten als Bezeichner abgeglichen sind",
"core-views/choose-reconciliation-service": "Wählen Sie einen Abgleichdienst aus", "core-views/choose-reconciliation-service": "Wählen Sie einen Abgleichdienst aus",
"core-views/choose-reconciliation-service-alert": "Bitte wählen Sie zuerst einen Abstimmungsdienst aus." "core-views/choose-reconciliation-service-alert": "Bitte wählen Sie zuerst einen Abstimmungsdienst aus."
} }

View File

@ -133,7 +133,7 @@
"core-index-parser/include-raw-templates": "テンプレートと画像をraw wikicodeとして含める", "core-index-parser/include-raw-templates": "テンプレートと画像をraw wikicodeとして含める",
"core-index-parser/quotation-mark": "引用符はカラム区切りを含む<br/>セルを囲むために<br/>使用されています", "core-index-parser/quotation-mark": "引用符はカラム区切りを含む<br/>セルを囲むために<br/>使用されています",
"core-index-parser/invalid-wikitext": "表が解析できません。本当にwikiの表ですか?", "core-index-parser/invalid-wikitext": "表が解析できません。本当にwikiの表ですか?",
"core-index-parser/json-parser": "最初のレコードに対応した最初のJSONードをクリック", "core-index-parser/json-parser": "最初のレコードに対応した最初のJSONードをクリック.",
"core-index-parser/parse-every": "複数行をまとめる:", "core-index-parser/parse-every": "複数行をまとめる:",
"core-index-parser/store-blank": "空白行も保存", "core-index-parser/store-blank": "空白行も保存",
"core-index-parser/discard-initial": "先頭データを破棄", "core-index-parser/discard-initial": "先頭データを破棄",
@ -141,7 +141,7 @@
"core-index-parser/col-separated-by": "カラムの区切り文字", "core-index-parser/col-separated-by": "カラムの区切り文字",
"core-index-parser/wiki-base-url": "照合するwikiのURL:", "core-index-parser/wiki-base-url": "照合するwikiのURL:",
"core-index-parser/blank-spanning-cells": "連続したセルをnullで埋める", "core-index-parser/blank-spanning-cells": "連続したセルをnullで埋める",
"core-index-parser/click-xml": "最初のレコードに対応する最初のXML要素をクリックしてください", "core-index-parser/click-xml": "最初のレコードに対応する最初のXML要素をクリックしてください.",
"core-index-parser/lines-beg": "行分(先頭から)", "core-index-parser/lines-beg": "行分(先頭から)",
"core-index-parser/preserve-empty": "空文字を保存", "core-index-parser/preserve-empty": "空文字を保存",
"core-index-parser/rows-data": "行分", "core-index-parser/rows-data": "行分",
@ -189,7 +189,7 @@
"core-dialogs/rows-in-cluster": "# クラスタ内の行数", "core-dialogs/rows-in-cluster": "# クラスタ内の行数",
"core-dialogs/content": "内容", "core-dialogs/content": "内容",
"core-dialogs/use-this-val": "この値を使う", "core-dialogs/use-this-val": "この値を使う",
"core-dialogs/cells-of-row": "現在の行のcells: row.cellsの別名です。特定のセルは、cells.<column name>かcells[column name]でアクセスできます", "core-dialogs/cells-of-row": "現在の行のcells: row.cellsの別名です。特定のセルは、cells.<column name>かcells[column name]でアクセスできます.",
"core-dialogs/for-include-drop-statement-checkbox": "Drop文を含める", "core-dialogs/for-include-drop-statement-checkbox": "Drop文を含める",
"core-dialogs/ngram-radius": "ngram半径;", "core-dialogs/ngram-radius": "ngram半径;",
"core-dialogs/processing": "処理中...", "core-dialogs/processing": "処理中...",
@ -215,7 +215,7 @@
"core-dialogs/regular-dot": "標準的なドット", "core-dialogs/regular-dot": "標準的なドット",
"core-dialogs/for-recon-cell": "照合したセルを出力", "core-dialogs/for-recon-cell": "照合したセルを出力",
"core-dialogs/ppm": "PPM", "core-dialogs/ppm": "PPM",
"core-dialogs/cell-value": "現在のセルのvalue: cell.valueの別名です", "core-dialogs/cell-value": "現在のセルのvalue: cell.valueの別名です.",
"core-dialogs/cluster-values": "クラスタの値", "core-dialogs/cluster-values": "クラスタの値",
"core-dialogs/clustering": "クラスタリング中... ", "core-dialogs/clustering": "クラスタリング中... ",
"core-dialogs/out-empty-row": "空の列すべてのセルがnullを出力", "core-dialogs/out-empty-row": "空の列すべてのセルがnullを出力",
@ -227,7 +227,7 @@
"core-dialogs/preview": "プレビュー", "core-dialogs/preview": "プレビュー",
"core-dialogs/try-another-method": "他の方法を選ぶか、パラメーターに変えてみてください", "core-dialogs/try-another-method": "他の方法を選ぶか、パラメーターに変えてみてください",
"core-dialogs/opt-code": "オプションコード", "core-dialogs/opt-code": "オプションコード",
"core-dialogs/row-fields": "現在の行: flagged, starred, index, cells, recordのつのフィールドがあります", "core-dialogs/row-fields": "現在の行: flagged, starred, index, cells, recordのつのフィールドがあります.",
"core-dialogs/line-sep": "行セパレータ", "core-dialogs/line-sep": "行セパレータ",
"core-dialogs/for-include-structure-checkbox": "スキーマを含める", "core-dialogs/for-include-structure-checkbox": "スキーマを含める",
"core-dialogs/browse-only-these": "これらの値のみ閲覧", "core-dialogs/browse-only-these": "これらの値のみ閲覧",
@ -263,7 +263,7 @@
"core-dialogs/template-prefix": "ファイルの冒頭部", "core-dialogs/template-prefix": "ファイルの冒頭部",
"core-dialogs/nearest-neighbor": "最近傍法", "core-dialogs/nearest-neighbor": "最近傍法",
"core-dialogs/tableNameLabel": "テーブル名:", "core-dialogs/tableNameLabel": "テーブル名:",
"core-dialogs/cell-fields": "現在のcell: valueとreconのフィールドがあります", "core-dialogs/cell-fields": "現在のcell: valueとreconのフィールドがあります.",
"core-dialogs/for-null-cell-value-to-empty-str-label": "null値をINSERT文でNULLに変換する", "core-dialogs/for-null-cell-value-to-empty-str-label": "null値をINSERT文でNULLに変換する",
"core-dialogs/idling": "アイドリング中...", "core-dialogs/idling": "アイドリング中...",
"core-dialogs/for-include-if-exist-drop-stmt-checkbox": "Drop文のIF EXISTSを含める", "core-dialogs/for-include-if-exist-drop-stmt-checkbox": "Drop文のIF EXISTSを含める",
@ -341,7 +341,7 @@
"core-project/open": "開く", "core-project/open": "開く",
"core-project/facet-filter": "ファセット/フィルター", "core-project/facet-filter": "ファセット/フィルター",
"core-project/json-invalid": "貼り付けたJSONは無効です", "core-project/json-invalid": "貼り付けたJSONは無効です",
"core-project/last-op-er": "最後の操作でエラーが発生しました", "core-project/last-op-er": "最後の操作でエラーが発生しました",
"core-project/apply-operation": "操作履歴を適用", "core-project/apply-operation": "操作履歴を適用",
"core-project/sql-export": "SQLエクスポート...", "core-project/sql-export": "SQLエクスポート...",
"core-project/other-process": "他の保留中プロセス", "core-project/other-process": "他の保留中プロセス",
@ -412,7 +412,7 @@
"core-views/join-cells": "多値のセルを結合", "core-views/join-cells": "多値のセルを結合",
"core-views/actions": "アクション", "core-views/actions": "アクション",
"core-views/search-match": "マッチを検索", "core-views/search-match": "マッチを検索",
"core-views/filtered-cell": "選択したセルとマッチさせる対象", "core-views/filtered-cell": "選択したセルとマッチさせる対象は...",
"core-views/bounded-log-facet": "対数ファセット(1以上を強制)", "core-views/bounded-log-facet": "対数ファセット(1以上を強制)",
"core-views/remove-col": "このカラムを取り除く", "core-views/remove-col": "このカラムを取り除く",
"core-views/new-topic2": "選択した行で、各セルから新しい項目を作成する", "core-views/new-topic2": "選択した行で、各セルから新しい項目を作成する",
@ -468,14 +468,14 @@
"core-views/uppercase": "大文字に", "core-views/uppercase": "大文字に",
"core-views/table-schema-validate": "認証", "core-views/table-schema-validate": "認証",
"core-views/remove-matching": "マッチしたすべての行を削除", "core-views/remove-matching": "マッチしたすべての行を削除",
"core-views/warning-no-length": "フィールド長が指定されてません", "core-views/warning-no-length": "フィールド長が指定されてません.",
"core-views/discard-judg": "照合判断を捨てる", "core-views/discard-judg": "照合判断を捨てる",
"core-views/blank-out": "セルをnullに", "core-views/blank-out": "セルをnullに",
"core-views/best-cand-type-match": "最良候補の型はマッチ?", "core-views/best-cand-type-match": "最良候補の型はマッチ?",
"core-views/sort-by-col": "このカラムだけでソート", "core-views/sort-by-col": "このカラムだけでソート",
"core-views/enter-col-name": "新しいカラム名を入力してください", "core-views/enter-col-name": "新しいカラム名を入力してください",
"core-views/text-facet": "テキストファセット", "core-views/text-facet": "テキストファセット",
"core-views/warning-format": "フィールド長が適切にフォーマットされていません", "core-views/warning-format": "フィールド長が適切にフォーマットされていません.",
"core-views/copy-opt": "オプションをコピー", "core-views/copy-opt": "オプションをコピー",
"core-views/best-word-sim": "最良候補の名前の単語類似率", "core-views/best-word-sim": "最良候補の名前の単語類似率",
"core-views/copy-val": "カラムから値をコピー", "core-views/copy-val": "カラムから値をコピー",
@ -529,7 +529,7 @@
"core-views/separator": "区切り文字", "core-views/separator": "区切り文字",
"core-views/ctrl-enter": "Ctrl-Enter", "core-views/ctrl-enter": "Ctrl-Enter",
"core-views/view": "ビュー", "core-views/view": "ビュー",
"core-views/extend-not-supported": "この照合サービスはこの拡張子に対応していません", "core-views/extend-not-supported": "この照合サービスはこの拡張子に対応していません.",
"core-views/to-text": "テキストに", "core-views/to-text": "テキストに",
"core-views/first": "最初", "core-views/first": "最初",
"core-views/word-facet": "単語ファセット", "core-views/word-facet": "単語ファセット",
@ -567,7 +567,7 @@
"core-views/sort": "ソート", "core-views/sort": "ソート",
"core-views/match-all-cells": "この項目をこのセルと同じ全セルにマッチ", "core-views/match-all-cells": "この項目をこのセルと同じ全セルにマッチ",
"core-views/col-at-most": "最大のカラム(空白はそのまま)", "core-views/col-at-most": "最大のカラム(空白はそのまま)",
"core-views/warning-sel-judg": "コピー先の判断の種類を選択してください", "core-views/warning-sel-judg": "コピー先の判断の種類を選択してください.",
"core-views/remove-sort": "ソートを削除", "core-views/remove-sort": "ソートを削除",
"core-views/common-transform": "よく使う変換", "core-views/common-transform": "よく使う変換",
"core-views/reg-exp": "正規表現", "core-views/reg-exp": "正規表現",
@ -589,30 +589,30 @@
"core-views/best-score": "最良候補(best candidate)のスコア", "core-views/best-score": "最良候補(best candidate)のスコア",
"core-views/match-recon": "照合判断のマッチ", "core-views/match-recon": "照合判断のマッチ",
"core-views/flagged-rows": "旗付き行", "core-views/flagged-rows": "旗付き行",
"core-views/no-settings": "この属性の設定はありません", "core-views/no-settings": "この属性の設定はありません.",
"core-views/transp-cell-row": "列のセルを行に転置(縦持ち化)", "core-views/transp-cell-row": "列のセルを行に転置(縦持ち化)",
"core-views/qa-results2": "QA結果", "core-views/qa-results2": "QA結果",
"core-views/text-length-facet": "文字数ファセット", "core-views/text-length-facet": "文字数ファセット",
"core-views/not-valid-number": "有効な数値でない", "core-views/not-valid-number": "有効な数値でない.",
"core-views/reconcile": "照合(名寄せ)", "core-views/reconcile": "照合(名寄せ)",
"core-views/trim-all": "先頭と末尾の空白を削除", "core-views/trim-all": "先頭と末尾の空白を削除",
"core-views/starred-rows": "星付きの行", "core-views/starred-rows": "星付きの行",
"core-views/extend-not-reconciled": "この処理ができるのは照合カラムだけです", "core-views/extend-not-reconciled": "この処理ができるのは照合カラムだけです.",
"core-views/by-sep": "文字で分割", "core-views/by-sep": "文字で分割",
"core-views/custom-facets": "カスタムファセット", "core-views/custom-facets": "カスタムファセット",
"core-views/numbers": "数字", "core-views/numbers": "数字",
"core-views/store-err": "エラーを保存", "core-views/store-err": "エラーを保存",
"core-views/facet-error": "エラーファセット", "core-views/facet-error": "エラーファセット",
"core-views/warning-other-col": "コピー先のカラムを選択してください", "core-views/warning-other-col": "コピー先のカラムを選択してください.",
"core-views/best-type-match": "最良候補の型のマッチ", "core-views/best-type-match": "最良候補の型のマッチ",
"core-views/facet": "ファセット", "core-views/facet": "ファセット",
"core-views/key-col": "キーカラム名", "core-views/key-col": "キーカラム名",
"core-views/display-null": "null値を表示/非表示", "core-views/display-null": "null値を表示/非表示",
"core-views/on-error": "エラー", "core-views/on-error": "エラー",
"core-views/match-this-cell": "この項目をこのセルだけにマッチ", "core-views/match-this-cell": "この項目をこのセルだけにマッチ",
"core-views/not-valid-date": "有効な日付でない", "core-views/not-valid-date": "有効な日付でない.",
"core-views/text-filter": "テキストフィルター", "core-views/text-filter": "テキストフィルター",
"core-views/warning-no-property": "属性を最初に選択してください", "core-views/warning-no-property": "属性を最初に選択してください.",
"core-views/contain-names": "(中身は元のカラム名になります)", "core-views/contain-names": "(中身は元のカラム名になります)",
"core-views/best-cand-score": "最良候補のスコア", "core-views/best-cand-score": "最良候補のスコア",
"core-views/sel-col-val": "キーカラムと値カラムは違う列を選択してください。", "core-views/sel-col-val": "キーカラムと値カラムは違う列を選択してください。",
@ -713,4 +713,4 @@
"core-buttons/add-url": "URLを追加", "core-buttons/add-url": "URLを追加",
"core-buttons/unselect": "選択解除", "core-buttons/unselect": "選択解除",
"core-buttons/pick-record": "レコード要素を選択" "core-buttons/pick-record": "レコード要素を選択"
} }

View File

@ -272,5 +272,73 @@
"core-project/export-project": "Eksporter prosjekt", "core-project/export-project": "Eksporter prosjekt",
"core-project/html-table": "HTML-tabell", "core-project/html-table": "HTML-tabell",
"core-project/excel": "Excel (.xls)", "core-project/excel": "Excel (.xls)",
"core-project/excel-xml": "Excel 2007+ (.xlsx)" "core-project/excel-xml": "Excel 2007+ (.xlsx)",
} "core-project/filter": "Filtrer:",
"core-project/other-processes": "andre ventende prosesser",
"core-project/other-process": "annen ventende prosess",
"core-project/cancel-all": "Avbryt alt",
"core-project/cancel": "Avbryt",
"core-project/canceling": "Avbryter…",
"core-project/undo": "Angre",
"core-recon/service-api": "Tjeneste-API",
"core-recon/column": "Kolonne",
"core-recon/include": "Inkluder",
"core-recon/as-property": "Som egenskap",
"core-recon/wd-recon-lang": "nb",
"core-recon/cell-contains": "Hver celle inneholder:",
"core-recon/service-title": "Tjenester",
"core-util-enc/select-enc": "Velg koding",
"core-util-enc/today": "i dag",
"core-util-enc/yesterday": "i går",
"core-util-enc/days-ago": "dager siden",
"core-util-enc/week-ago": "en uke siden",
"core-util-enc/weeks-ago": "uker siden",
"core-util-enc/month-ago": "en måned siden",
"core-util-enc/months-ago": "måneder siden",
"core-util-enc/year-ago": "ett år siden",
"core-util-enc/years-ago": "år siden",
"core-util-enc/working": "Arbeider",
"core-util-enc/invalid-date": "Ugyldig datostreng",
"core-views/edit-cell": "Rediger denne cellen",
"core-views/choose-match": "Velg ny overensstemmelse",
"core-views/match-all-cells": "Jamfør dette elementet og til denne og alle identiske celler",
"core-views/match-this-cell": "Jamfør dette elementet til denne cellen",
"core-views/create-topic-cells": "Opprett et nytt element for denne og alle identiske celler",
"core-views/create-topic-cell": "Opprett et nytt element for denne cellen",
"core-views/create-topic": "Opprett nytt element",
"core-views/search-match": "Søk etter overensstemmelse",
"core-views/not-valid-number": "Ikke et gyldig nummer.",
"core-views/not-valid-date": "Ikke en gyldig dato.",
"core-views/match-this": "Jamfør kun denne cellen",
"core-views/match-other": "Jamfør andre celler med samme innhold",
"core-views/search-for": "Søk etter",
"core-views/match-cell": "Jamfør denne cellen",
"core-views/match-identical": "Jamfør alle identiske celler",
"core-views/matched": "jamført",
"core-views/new": "ny",
"core-views/edit-cells": "Rediger celler",
"core-views/edit-column": "Rediger kolonne",
"core-views/sort": "Sorter",
"core-views/collapse-this": "Fold sammen denne kolonnen",
"core-views/collapse-other": "Fold sammen alle andre kolonner",
"core-views/collapse-left": "Fold sammen alle kolonnene til venstre",
"core-views/collapse-right": "Fold sammen alle kolonnene til høyre",
"core-views/remove-sort": "Fjern sortering",
"core-views/sort-by": "Sorter etter",
"core-views/sort-cell": "Sorter celleverdier etter",
"core-views/text": "tekst",
"core-views/numbers": "nummer",
"core-views/dates": "datoer",
"core-views/booleans": "boolske verdier",
"core-views/forward": "fremover",
"core-views/sort-by-col": "sorter denne kolonnen alene",
"core-views/smallest-first": "minste først",
"core-views/largest-first": "største først",
"core-views/earliest-first": "tidligste først",
"core-views/latest-first": "seneste først",
"core-views/valid-values": "Gyldige verdier",
"core-views/errors": "Feil",
"core-views/copy-to-col": "Kopier til kolonner",
"core-views/copy-opt": "Kopieringsvalg",
"core-views/what-to-copy": "Hva som skal kopieres:"
}

View File

@ -49,39 +49,39 @@ ClusteringDialog.prototype._createDialog = function() {
var dialog = $(DOM.loadHTML("core", "scripts/dialogs/clustering-dialog.html")); var dialog = $(DOM.loadHTML("core", "scripts/dialogs/clustering-dialog.html"));
this._elmts = DOM.bind(dialog); this._elmts = DOM.bind(dialog);
this._elmts.dialogHeader.text($.i18n._('core-dialogs/cluster-edit')+' "' + this._columnName + '"'); this._elmts.dialogHeader.text($.i18n('core-dialogs/cluster-edit')+' "' + this._columnName + '"');
this._elmts.or_dialog_descr.html($.i18n._('core-dialogs/cluster-descr')); this._elmts.or_dialog_descr.html($.i18n('core-dialogs/cluster-descr'));
this._elmts.or_dialog_findMore.html($.i18n._('core-dialogs/find-more')); this._elmts.or_dialog_findMore.html($.i18n('core-dialogs/find-more'));
this._elmts.or_dialog_method.html($.i18n._('core-dialogs/method')); this._elmts.or_dialog_method.html($.i18n('core-dialogs/method'));
this._elmts.or_dialog_keyCollision.html($.i18n._('core-dialogs/key-collision')); this._elmts.or_dialog_keyCollision.html($.i18n('core-dialogs/key-collision'));
this._elmts.or_dialog_neighbor.html($.i18n._('core-dialogs/nearest-neighbor')); this._elmts.or_dialog_neighbor.html($.i18n('core-dialogs/nearest-neighbor'));
this._elmts.or_dialog_keying.html($.i18n._('core-dialogs/keying-function')); this._elmts.or_dialog_keying.html($.i18n('core-dialogs/keying-function'));
this._elmts.or_dialog_fingerprint.html($.i18n._('core-dialogs/fingerprint')); this._elmts.or_dialog_fingerprint.html($.i18n('core-dialogs/fingerprint'));
this._elmts.or_dialog_ngram.html($.i18n._('core-dialogs/ngram')); this._elmts.or_dialog_ngram.html($.i18n('core-dialogs/ngram'));
this._elmts.or_dialog_metaphone.html($.i18n._('core-dialogs/metaphone')); this._elmts.or_dialog_metaphone.html($.i18n('core-dialogs/metaphone'));
this._elmts.or_dialog_phonetic.html($.i18n._('core-dialogs/phonetic')); this._elmts.or_dialog_phonetic.html($.i18n('core-dialogs/phonetic'));
this._elmts.or_dialog_distance.html($.i18n._('core-dialogs/distance-fun')); this._elmts.or_dialog_distance.html($.i18n('core-dialogs/distance-fun'));
this._elmts.or_dialog_leven.html($.i18n._('core-dialogs/leven')); this._elmts.or_dialog_leven.html($.i18n('core-dialogs/leven'));
this._elmts.or_dialog_ppm.html($.i18n._('core-dialogs/ppm')); this._elmts.or_dialog_ppm.html($.i18n('core-dialogs/ppm'));
this._elmts.or_dialog_ngramSize.html($.i18n._('core-dialogs/ngram-size')); this._elmts.or_dialog_ngramSize.html($.i18n('core-dialogs/ngram-size'));
this._elmts.or_dialog_radius.html($.i18n._('core-dialogs/ngram-radius')); this._elmts.or_dialog_radius.html($.i18n('core-dialogs/ngram-radius'));
this._elmts.or_dialog_blockChars.html($.i18n._('core-dialogs/block-chars')); this._elmts.or_dialog_blockChars.html($.i18n('core-dialogs/block-chars'));
this._elmts.selectAllButton.html($.i18n._('core-buttons/select-all')); this._elmts.selectAllButton.html($.i18n('core-buttons/select-all'));
this._elmts.deselectAllButton.html($.i18n._('core-buttons/unselect-all')); this._elmts.deselectAllButton.html($.i18n('core-buttons/unselect-all'));
this._elmts.exportClusterButton.html($.i18n._('core-buttons/export-cluster')); this._elmts.exportClusterButton.html($.i18n('core-buttons/export-cluster'));
this._elmts.applyReClusterButton.html($.i18n._('core-buttons/merge-cluster')); this._elmts.applyReClusterButton.html($.i18n('core-buttons/merge-cluster'));
this._elmts.applyCloseButton.html($.i18n._('core-buttons/merge-close')); this._elmts.applyCloseButton.html($.i18n('core-buttons/merge-close'));
this._elmts.closeButton.html($.i18n._('core-buttons/close')); this._elmts.closeButton.html($.i18n('core-buttons/close'));
this._elmts.methodSelector.change(function() { this._elmts.methodSelector.change(function() {
var selection = $(this).find("option:selected").text(); var selection = $(this).find("option:selected").text();
if (selection == $.i18n._('core-dialogs/key-collision')) { if (selection == $.i18n('core-dialogs/key-collision')) {
dialog.find(".binning-controls").show(); dialog.find(".binning-controls").show();
dialog.find(".knn-controls").hide(); dialog.find(".knn-controls").hide();
self._method = "binning"; self._method = "binning";
self._elmts.keyingFunctionSelector.change(); self._elmts.keyingFunctionSelector.change();
} else if (selection === $.i18n._('core-dialogs/nearest-neighbor')) { } else if (selection === $.i18n('core-dialogs/nearest-neighbor')) {
dialog.find(".binning-controls").hide(); dialog.find(".binning-controls").hide();
dialog.find(".knn-controls").show(); dialog.find(".knn-controls").show();
self._method = "knn"; self._method = "knn";
@ -140,11 +140,11 @@ ClusteringDialog.prototype._renderTable = function(clusters) {
var trHead = table.insertRow(table.rows.length); var trHead = table.insertRow(table.rows.length);
trHead.className = "header"; trHead.className = "header";
$(trHead.insertCell(0)).text($.i18n._('core-dialogs/cluster-size')); $(trHead.insertCell(0)).text($.i18n('core-dialogs/cluster-size'));
$(trHead.insertCell(1)).text($.i18n._('core-dialogs/row-count')); $(trHead.insertCell(1)).text($.i18n('core-dialogs/row-count'));
$(trHead.insertCell(2)).text($.i18n._('core-dialogs/cluster-values')); $(trHead.insertCell(2)).text($.i18n('core-dialogs/cluster-values'));
$(trHead.insertCell(3)).text($.i18n._('core-dialogs/merge')); $(trHead.insertCell(3)).text($.i18n('core-dialogs/merge'));
$(trHead.insertCell(4)).text($.i18n._('core-dialogs/new-cell-val')); $(trHead.insertCell(4)).text($.i18n('core-dialogs/new-cell-val'));
var renderCluster = function(cluster) { var renderCluster = function(cluster) {
var tr = table.insertRow(table.rows.length); var tr = table.insertRow(table.rows.length);
@ -184,7 +184,7 @@ ClusteringDialog.prototype._renderTable = function(clusters) {
for (var c = 0; c < choices.length; c++) { for (var c = 0; c < choices.length; c++) {
var choice = choices[c]; var choice = choices[c];
var li = $('<li></li>'); var li = $('<li></li>');
$('<a href="javascript:{}" title='+$.i18n._('core-dialogs/use-this-val')+'></a>').text(choice.v).click(onClick).appendTo(li); $('<a href="javascript:{}" title='+$.i18n('core-dialogs/use-this-val')+'></a>').text(choice.v).click(onClick).appendTo(li);
$('<span></span>').text("(" + choice.c + " rows)").addClass("clustering-dialog-entry-count").appendTo(li); $('<span></span>').text("(" + choice.c + " rows)").addClass("clustering-dialog-entry-count").appendTo(li);
rowCount += choice.c; rowCount += choice.c;
facet.s[c] = { facet.s[c] = {
@ -206,7 +206,7 @@ ClusteringDialog.prototype._renderTable = function(clusters) {
var div = $('<div></div>').addClass("clustering-dialog-value-focus"); var div = $('<div></div>').addClass("clustering-dialog-value-focus");
var browseLink = $('<a target="_new" title="'+$.i18n._('core-dialogs/browse-only-these')+'">'+$.i18n._('core-dialogs/browse-this-cluster')+'</a>') var browseLink = $('<a target="_new" title="'+$.i18n('core-dialogs/browse-only-these')+'">'+$.i18n('core-dialogs/browse-this-cluster')+'</a>')
.addClass("clustering-dialog-browse-focus") .addClass("clustering-dialog-browse-focus")
.attr("href",url) .attr("href",url)
.css("visibility","hidden") .css("visibility","hidden")
@ -242,13 +242,13 @@ ClusteringDialog.prototype._renderTable = function(clusters) {
this._elmts.resultSummary.html( this._elmts.resultSummary.html(
(clusters.length === this._clusters.length) ? (clusters.length === this._clusters.length) ?
("<b>" + this._clusters.length + "</b> cluster" + ((this._clusters.length != 1) ? "s" : "") + " "+$.i18n._('core-dialogs/found')) : ("<b>" + this._clusters.length + "</b> cluster" + ((this._clusters.length != 1) ? "s" : "") + " "+$.i18n('core-dialogs/found')) :
("<b>" + clusters.length + "</b> cluster" + ((clusters.length != 1) ? "s" : "") + " "+$.i18n._('core-dialogs/filtered-from')+ this._clusters.length +$.i18n._('core-dialogs/from-total') ) ("<b>" + clusters.length + "</b> cluster" + ((clusters.length != 1) ? "s" : "") + " "+$.i18n('core-dialogs/filtered-from')+ this._clusters.length +$.i18n('core-dialogs/from-total') )
); );
} else { } else {
container.html( container.html(
'<div style="margin: 2em;"><div style="font-size: 130%; color: #333;">'+$.i18n._('core-dialogs/no-cluster-found')+'</div><div style="padding-top: 1em; font-size: 110%; color: #888;">'+$.i18n._('core-dialogs/try-another-method')+'</div></div>' '<div style="margin: 2em;"><div style="font-size: 130%; color: #333;">'+$.i18n('core-dialogs/no-cluster-found')+'</div><div style="padding-top: 1em; font-size: 110%; color: #888;">'+$.i18n('core-dialogs/try-another-method')+'</div></div>'
); );
} }
}; };
@ -257,7 +257,7 @@ ClusteringDialog.prototype._cluster = function() {
var self = this; var self = this;
var container = this._elmts.tableContainer.html( var container = this._elmts.tableContainer.html(
'<div style="margin: 1em; font-size: 130%; color: #888;">'+$.i18n._('core-dialogs/clustering')+'<img src="images/small-spinner.gif"></div>' '<div style="margin: 1em; font-size: 130%; color: #888;">'+$.i18n('core-dialogs/clustering')+'<img src="images/small-spinner.gif"></div>'
); );
this._elmts.resultSummary.empty(); this._elmts.resultSummary.empty();
@ -376,7 +376,7 @@ ClusteringDialog.prototype._apply = function(onDone) {
} }
); );
} else { } else {
alert($.i18n._('core-dialogs/warning-check-boxes')); alert($.i18n('core-dialogs/warning-check-boxes'));
} }
}; };
@ -438,10 +438,10 @@ ClusteringDialog.prototype._resetFacets = function() {
} }
this._facets = []; this._facets = [];
this._createFacet($.i18n._('core-dialogs/choices-in-cluster'), "size"); this._createFacet($.i18n('core-dialogs/choices-in-cluster'), "size");
this._createFacet($.i18n._('core-dialogs/rows-in-cluster'), "rowCount"); this._createFacet($.i18n('core-dialogs/rows-in-cluster'), "rowCount");
this._createFacet($.i18n._('core-dialogs/choice-avg-length'), "avg"); this._createFacet($.i18n('core-dialogs/choice-avg-length'), "avg");
this._createFacet($.i18n._('core-dialogs/choice-var-length'), "variance"); this._createFacet($.i18n('core-dialogs/choice-var-length'), "variance");
}; };
ClusteringDialog.prototype._createFacet = function(title, property) { ClusteringDialog.prototype._createFacet = function(title, property) {

View File

@ -43,11 +43,11 @@ ColumnReorderingDialog.prototype._createDialog = function() {
this._elmts.cancelButton.click(function() { self._dismiss(); }); this._elmts.cancelButton.click(function() { self._dismiss(); });
this._elmts.okButton.click(function() { self._commit(); }); this._elmts.okButton.click(function() { self._commit(); });
this._elmts.dialogHeader.html($.i18n._('core-dialogs/reorder-column')); this._elmts.dialogHeader.html($.i18n('core-dialogs/reorder-column'));
this._elmts.or_dialog_dragCol.html($.i18n._('core-dialogs/drag-column')); this._elmts.or_dialog_dragCol.html($.i18n('core-dialogs/drag-column'));
this._elmts.or_dialog_dropCol.html($.i18n._('core-dialogs/drop-column')); this._elmts.or_dialog_dropCol.html($.i18n('core-dialogs/drop-column'));
this._elmts.okButton.html($.i18n._('core-buttons/ok')); this._elmts.okButton.html($.i18n('core-buttons/ok'));
this._elmts.cancelButton.html($.i18n._('core-buttons/cancel')); this._elmts.cancelButton.html($.i18n('core-buttons/cancel'));
this._level = DialogSystem.showDialog(dialog); this._level = DialogSystem.showDialog(dialog);

View File

@ -82,50 +82,50 @@ CustomTabularExporterDialog.prototype._createDialog = function(options) {
this._elmts.uploadTabBody.remove(); this._elmts.uploadTabBody.remove();
} }
this._elmts.dialogHeader.html($.i18n._('core-dialogs/custom-tab-exp')); this._elmts.dialogHeader.html($.i18n('core-dialogs/custom-tab-exp'));
this._elmts.or_dialog_content.html($.i18n._('core-dialogs/content')); this._elmts.or_dialog_content.html($.i18n('core-dialogs/content'));
this._elmts.or_dialog_download.html($.i18n._('core-dialogs/download')); this._elmts.or_dialog_download.html($.i18n('core-dialogs/download'));
this._elmts.or_dialog_upload.html($.i18n._('core-dialogs/upload')); this._elmts.or_dialog_upload.html($.i18n('core-dialogs/upload'));
this._elmts.or_dialog_optCode.html($.i18n._('core-dialogs/opt-code')); this._elmts.or_dialog_optCode.html($.i18n('core-dialogs/opt-code'));
this._elmts.or_dialog_selAndOrd.html($.i18n._('core-dialogs/sel-and-ord')); this._elmts.or_dialog_selAndOrd.html($.i18n('core-dialogs/sel-and-ord'));
this._elmts.or_dialog_optFor.html($.i18n._('core-dialogs/opt-for')+" "); this._elmts.or_dialog_optFor.html($.i18n('core-dialogs/opt-for')+" ");
this._elmts.or_dialog_forReconCell.html($.i18n._('core-dialogs/for-recon-cell')); this._elmts.or_dialog_forReconCell.html($.i18n('core-dialogs/for-recon-cell'));
this._elmts.or_dialog_matchedName.html($.i18n._('core-dialogs/match-ent-name')); this._elmts.or_dialog_matchedName.html($.i18n('core-dialogs/match-ent-name'));
this._elmts.or_dialog_cellCont.html($.i18n._('core-dialogs/cell-content')); this._elmts.or_dialog_cellCont.html($.i18n('core-dialogs/cell-content'));
this._elmts.or_dialog_matchedId.html($.i18n._('core-dialogs/match-ent-id')); this._elmts.or_dialog_matchedId.html($.i18n('core-dialogs/match-ent-id'));
this._elmts.or_dialog_linkMatch.html($.i18n._('core-dialogs/link-match')); this._elmts.or_dialog_linkMatch.html($.i18n('core-dialogs/link-match'));
this._elmts.or_dialog_outNotUnMatch.html($.i18n._('core-dialogs/out-not-unmatch')); this._elmts.or_dialog_outNotUnMatch.html($.i18n('core-dialogs/out-not-unmatch'));
this._elmts.or_dialog_dateIso.html($.i18n._('core-dialogs/date-iso')); this._elmts.or_dialog_dateIso.html($.i18n('core-dialogs/date-iso'));
this._elmts.or_dialog_shortFormat.html($.i18n._('core-dialogs/short-format')); this._elmts.or_dialog_shortFormat.html($.i18n('core-dialogs/short-format'));
this._elmts.or_dialog_mediumFormat.html($.i18n._('core-dialogs/medium-format')); this._elmts.or_dialog_mediumFormat.html($.i18n('core-dialogs/medium-format'));
this._elmts.or_dialog_longFormat.html($.i18n._('core-dialogs/long-format')); this._elmts.or_dialog_longFormat.html($.i18n('core-dialogs/long-format'));
this._elmts.or_dialog_fullFormat.html($.i18n._('core-dialogs/full-format')); this._elmts.or_dialog_fullFormat.html($.i18n('core-dialogs/full-format'));
this._elmts.or_dialog_custom.html($.i18n._('core-dialogs/custom')); this._elmts.or_dialog_custom.html($.i18n('core-dialogs/custom'));
this._elmts.or_dialog_help.html($.i18n._('core-dialogs/help')); this._elmts.or_dialog_help.html($.i18n('core-dialogs/help'));
this._elmts.or_dialog_localTime.html($.i18n._('core-dialogs/local-time')); this._elmts.or_dialog_localTime.html($.i18n('core-dialogs/local-time'));
this._elmts.or_dialog_omitTime.html($.i18n._('core-dialogs/omit-time')); this._elmts.or_dialog_omitTime.html($.i18n('core-dialogs/omit-time'));
this._elmts.selectAllButton.html($.i18n._('core-buttons/select-all')); this._elmts.selectAllButton.html($.i18n('core-buttons/select-all'));
this._elmts.deselectAllButton.html($.i18n._('core-buttons/deselect-all')); this._elmts.deselectAllButton.html($.i18n('core-buttons/deselect-all'));
this._elmts.or_dialog_outColHeader.html($.i18n._('core-dialogs/out-col-header')); this._elmts.or_dialog_outColHeader.html($.i18n('core-dialogs/out-col-header'));
this._elmts.or_dialog_outEmptyRow.html($.i18n._('core-dialogs/out-empty-row')); this._elmts.or_dialog_outEmptyRow.html($.i18n('core-dialogs/out-empty-row'));
this._elmts.or_dialog_ignoreFacets.html($.i18n._('core-dialogs/ignore-facets')); this._elmts.or_dialog_ignoreFacets.html($.i18n('core-dialogs/ignore-facets'));
this._elmts.or_dialog_lineFormat.html($.i18n._('core-dialogs/line-based')); this._elmts.or_dialog_lineFormat.html($.i18n('core-dialogs/line-based'));
this._elmts.or_dialog_otherFormat.html($.i18n._('core-dialogs/other-format')); this._elmts.or_dialog_otherFormat.html($.i18n('core-dialogs/other-format'));
this._elmts.or_dialog_tsv.html($.i18n._('core-dialogs/tsv')); this._elmts.or_dialog_tsv.html($.i18n('core-dialogs/tsv'));
this._elmts.or_dialog_csv.html($.i18n._('core-dialogs/csv')); this._elmts.or_dialog_csv.html($.i18n('core-dialogs/csv'));
this._elmts.or_dialog_customSep.html($.i18n._('core-dialogs/custom-separator')); this._elmts.or_dialog_customSep.html($.i18n('core-dialogs/custom-separator'));
this._elmts.or_dialog_excel.html($.i18n._('core-dialogs/excel')); this._elmts.or_dialog_excel.html($.i18n('core-dialogs/excel'));
this._elmts.or_dialog_excelXml.html($.i18n._('core-dialogs/excel-xml')); this._elmts.or_dialog_excelXml.html($.i18n('core-dialogs/excel-xml'));
this._elmts.or_dialog_htmlTable.html($.i18n._('core-dialogs/html-table')); this._elmts.or_dialog_htmlTable.html($.i18n('core-dialogs/html-table'));
this._elmts.or_dialog_lineSep.html($.i18n._('core-dialogs/line-sep')); this._elmts.or_dialog_lineSep.html($.i18n('core-dialogs/line-sep'));
this._elmts.or_dialog_charEnc.html($.i18n._('core-dialogs/char-enc')); this._elmts.or_dialog_charEnc.html($.i18n('core-dialogs/char-enc'));
this._elmts.downloadPreviewButton.html($.i18n._('core-buttons/preview')); this._elmts.downloadPreviewButton.html($.i18n('core-buttons/preview'));
this._elmts.downloadButton.html($.i18n._('core-buttons/download')); this._elmts.downloadButton.html($.i18n('core-buttons/download'));
this._elmts.or_dialog_uploadTo.html($.i18n._('core-dialogs/upload-to')); this._elmts.or_dialog_uploadTo.html($.i18n('core-dialogs/upload-to'));
this._elmts.uploadButton.html($.i18n._('core-buttons/upload')); this._elmts.uploadButton.html($.i18n('core-buttons/upload'));
this._elmts.or_dialog_jsonText.html($.i18n._('core-dialogs/json-text')); this._elmts.or_dialog_jsonText.html($.i18n('core-dialogs/json-text'));
this._elmts.applyOptionCodeButton.html($.i18n._('core-buttons/apply')); this._elmts.applyOptionCodeButton.html($.i18n('core-buttons/apply'));
this._elmts.cancelButton.html($.i18n._('core-buttons/cancel')); this._elmts.cancelButton.html($.i18n('core-buttons/cancel'));
$("#custom-tabular-exporter-tabs-content").css("display", ""); $("#custom-tabular-exporter-tabs-content").css("display", "");
$("#custom-tabular-exporter-tabs-download").css("display", ""); $("#custom-tabular-exporter-tabs-download").css("display", "");
@ -371,9 +371,9 @@ CustomTabularExporterDialog.prototype._applyOptionCode = function() {
var json = JSON.parse(s); var json = JSON.parse(s);
this._configureUIFromOptionCode(json); this._configureUIFromOptionCode(json);
alert($.i18n._('core-dialogs/opt-code-applied')); alert($.i18n('core-dialogs/opt-code-applied'));
} catch (e) { } catch (e) {
alert($.i18n._('core-dialogs/error-apply-code')+': ' + e); alert($.i18n('core-dialogs/error-apply-code')+': ' + e);
} }
}; };

View File

@ -2,28 +2,33 @@
<div class="dialog-header" bind="dialogHeader"></div> <div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody"> <div class="dialog-body" bind="dialogBody">
<div id="custom-column-selecter-tabs" class="refine-tabs"> <div id="custom-column-selecter-tabs" class="refine-tabs">
<ul>
<li><a href="#custom-column-selecter-tabs-content" bind="or_dialog_content"></a></li>
</ul>
<div id="custom-column-selecter-tabs-content"><div class="grid-layout grid-layout-for-ui layout-normal layout-full"><table> <div id="custom-column-selecter-tabs-content">
<tr> <div class="grid-layout grid-layout-for-ui layout-normal layout-full">
<td bind="or_dialog_selAndOrd"></td> <table>
</tr> <tr>
<tr> <td width="100%"><div bind="columnList" class="custom-tabular-exporter-columns"></div></td>
<td width="100%"><div bind="columnList" class="custom-tabular-exporter-columns"></div></td> </tr>
</tr> <tr>
<tr> <td colspan="2">
<td colspan="2"> <button class="button" bind="selectAllButton"></button>
<button class="button" bind="selectAllButton"></button> <button class="button" bind="deselectAllButton"></button>
<button class="button" bind="deselectAllButton"></button> </td>
</td> </tr>
</tr> </table>
</table></div></div> </div>
</div>
</div>
</div>
<div class="dialog-footer" bind="dialogFooter">
<table>
<tr>
<td><button class="button" bind="okButton"></button></td>
<td><button class="button" bind="cancelButton"></button></td>
</tr>
</table>
</div>
<div class="dialog-footer" bind="dialogFooter"><div class="grid-layout layout-tightest layout-full"><table><tr>
<td><button class="button" bind="okButton"></button></td>
<td><button class="button" bind="cancelButton"></button></td>
</tr></table></div></div>
</div> </div>

View File

@ -31,13 +31,11 @@ ExpressionColumnDialog.prototype._createDialog = function() {
this._level = DialogSystem.showDialog(this._dialog); this._level = DialogSystem.showDialog(this._dialog);
this._elmts.dialogHeader.html($.i18n._('core-dialogs/select-columns-dialog')); this._elmts.dialogHeader.html($.i18n('core-dialogs/select-columns-dialog'));
this._elmts.or_dialog_content.html($.i18n._('core-dialogs/content')); this._elmts.selectAllButton.html($.i18n('core-buttons/select-all'));
this._elmts.or_dialog_selAndOrd.html($.i18n._('core-dialogs/sel-and-ord')); this._elmts.deselectAllButton.html($.i18n('core-buttons/deselect-all'));
this._elmts.selectAllButton.html($.i18n._('core-buttons/select-all')); this._elmts.okButton.html($.i18n('core-buttons/ok'));
this._elmts.deselectAllButton.html($.i18n._('core-buttons/deselect-all')); this._elmts.cancelButton.html($.i18n('core-buttons/cancel'));
this._elmts.okButton.html($.i18n._('core-buttons/ok'));
this._elmts.cancelButton.html($.i18n._('core-buttons/cancel'));
/* /*

View File

@ -45,12 +45,12 @@ function ExpressionPreviewDialog(title, cellIndex, rowIndices, values, expressio
this._elmts = DOM.bind(html); this._elmts = DOM.bind(html);
$('<button class="button"></button>').html($.i18n._('core-buttons/ok')).click(function() { $('<button class="button"></button>').html($.i18n('core-buttons/ok')).click(function() {
DialogSystem.dismissUntil(self._level - 1); DialogSystem.dismissUntil(self._level - 1);
self._onDone(self._previewWidget.getExpression(true)); self._onDone(self._previewWidget.getExpression(true));
}).appendTo(footer); }).appendTo(footer);
$('<button class="button"></button>').text($.i18n._('core-buttons/cancel')).click(function() { $('<button class="button"></button>').text($.i18n('core-buttons/cancel')).click(function() {
DialogSystem.dismissUntil(self._level - 1); DialogSystem.dismissUntil(self._level - 1);
}).appendTo(footer); }).appendTo(footer);
@ -136,12 +136,12 @@ ExpressionPreviewDialog.Widget = function(
this._tabContentWidth = this._elmts.expressionPreviewPreviewContainer.width() + "px"; this._tabContentWidth = this._elmts.expressionPreviewPreviewContainer.width() + "px";
this._elmts.or_dialog_expr.html($.i18n._('core-dialogs/expression')); this._elmts.or_dialog_expr.html($.i18n('core-dialogs/expression'));
this._elmts.or_dialog_lang.html($.i18n._('core-dialogs/language')); this._elmts.or_dialog_lang.html($.i18n('core-dialogs/language'));
this._elmts.or_dialog_preview.html($.i18n._('core-dialogs/preview')); this._elmts.or_dialog_preview.html($.i18n('core-dialogs/preview'));
this._elmts.or_dialog_history.html($.i18n._('core-dialogs/history')); this._elmts.or_dialog_history.html($.i18n('core-dialogs/history'));
this._elmts.or_dialog_starred.html($.i18n._('core-dialogs/starred')); this._elmts.or_dialog_starred.html($.i18n('core-dialogs/starred'));
this._elmts.or_dialog_help.html($.i18n._('core-dialogs/help')); this._elmts.or_dialog_help.html($.i18n('core-dialogs/help'));
this.update(); this.update();
this._renderExpressionHistoryTab(); this._renderExpressionHistoryTab();
@ -192,19 +192,19 @@ ExpressionPreviewDialog.Widget.prototype._renderHelp = function(data) {
var varTable = $('<table cellspacing="5"></table>').appendTo(elmt)[0]; var varTable = $('<table cellspacing="5"></table>').appendTo(elmt)[0];
var vars = [ var vars = [
{ name: "cell", { name: "cell",
description: $.i18n._('core-dialogs/cell-fields') description: $.i18n('core-dialogs/cell-fields')
}, },
{ name: "value", { name: "value",
description: $.i18n._('core-dialogs/cell-value') description: $.i18n('core-dialogs/cell-value')
}, },
{ name: "row", { name: "row",
description: $.i18n._('core-dialogs/row-fields') description: $.i18n('core-dialogs/row-fields')
}, },
{ name: "cells", { name: "cells",
description: $.i18n._('core-dialogs/cells-of-row') description: $.i18n('core-dialogs/cells-of-row')
}, },
{ name: "rowIndex", { name: "rowIndex",
description: $.i18n._('core-dialogs/row-index') description: $.i18n('core-dialogs/row-index')
} }
]; ];
for (var i = 0; i < vars.length; i++) { for (var i = 0; i < vars.length; i++) {
@ -223,7 +223,7 @@ ExpressionPreviewDialog.Widget.prototype._renderHelp = function(data) {
$(tr0.insertCell(1)).addClass("expression-preview-doc-item-params").text("(" + entry.params + ")"); $(tr0.insertCell(1)).addClass("expression-preview-doc-item-params").text("(" + entry.params + ")");
$(tr1.insertCell(0)); $(tr1.insertCell(0));
$(tr1.insertCell(1)).addClass("expression-preview-doc-item-returns").text($.i18n._('core-dialogs/returns')+": " + entry.returns); $(tr1.insertCell(1)).addClass("expression-preview-doc-item-returns").text($.i18n('core-dialogs/returns')+": " + entry.returns);
$(tr2.insertCell(0)); $(tr2.insertCell(0));
$(tr2.insertCell(1)).addClass("expression-preview-doc-item-desc").text(entry.description); $(tr2.insertCell(1)).addClass("expression-preview-doc-item-desc").text(entry.description);
@ -270,7 +270,7 @@ ExpressionPreviewDialog.Widget.prototype._renderExpressionHistory = function(dat
var table = $( var table = $(
'<table>' + '<table>' +
'<tr><th></th><th></th><th>'+$.i18n._('core-dialogs/from')+'</th><th colspan="2">'+$.i18n._('core-dialogs/expression')+'</th><th></th></tr>' + '<tr><th></th><th></th><th>'+$.i18n('core-dialogs/from')+'</th><th colspan="2">'+$.i18n('core-dialogs/expression')+'</th><th></th></tr>' +
'</table>' '</table>'
).appendTo($('<div>').addClass("expression-preview-table-wrapper").appendTo(elmt))[0]; ).appendTo($('<div>').addClass("expression-preview-table-wrapper").appendTo(elmt))[0];
@ -293,7 +293,7 @@ ExpressionPreviewDialog.Widget.prototype._renderExpressionHistory = function(dat
); );
}); });
$('<a href="javascript:{}">'+$.i18n._('core-dialogs/reuse')+'</a>').appendTo(tr.insertCell(1)).click(function() { $('<a href="javascript:{}">'+$.i18n('core-dialogs/reuse')+'</a>').appendTo(tr.insertCell(1)).click(function() {
self._elmts.expressionPreviewTextarea[0].value = o.expression; self._elmts.expressionPreviewTextarea[0].value = o.expression;
self._elmts.expressionPreviewLanguageSelect[0].value = o.language; self._elmts.expressionPreviewLanguageSelect[0].value = o.language;
@ -336,7 +336,7 @@ ExpressionPreviewDialog.Widget.prototype._renderStarredExpressions = function(da
var table = $( var table = $(
'<table>' + '<table>' +
'<tr><th></th><th></th><th colspan="2">'+$.i18n._('core-dialogs/expression')+'</th><th></th></tr>' + '<tr><th></th><th></th><th colspan="2">'+$.i18n('core-dialogs/expression')+'</th><th></th></tr>' +
'</table>' '</table>'
).appendTo($('<div>').addClass("expression-preview-table-wrapper").appendTo(elmt))[0]; ).appendTo($('<div>').addClass("expression-preview-table-wrapper").appendTo(elmt))[0];
@ -344,7 +344,7 @@ ExpressionPreviewDialog.Widget.prototype._renderStarredExpressions = function(da
var tr = table.insertRow(table.rows.length); var tr = table.insertRow(table.rows.length);
var o = Scripting.parse(entry.code); var o = Scripting.parse(entry.code);
$('<a href="javascript:{}">'+$.i18n._('core-dialogs/remove')+'</a>').appendTo(tr.insertCell(0)).click(function() { $('<a href="javascript:{}">'+$.i18n('core-dialogs/remove')+'</a>').appendTo(tr.insertCell(0)).click(function() {
$.post( $.post(
"command/core/toggle-starred-expression", "command/core/toggle-starred-expression",
{ expression: entry.code, returnList: true }, { expression: entry.code, returnList: true },
@ -431,7 +431,7 @@ ExpressionPreviewDialog.Widget.prototype._renderPreview = function(expression, d
var renderValue = function(td, v) { var renderValue = function(td, v) {
if (v !== null && v !== undefined) { if (v !== null && v !== undefined) {
if ($.isPlainObject(v)) { if ($.isPlainObject(v)) {
$('<span></span>').addClass("expression-preview-special-value").text($.i18n._('core-dialogs/error')+": " + v.message).appendTo(td); $('<span></span>').addClass("expression-preview-special-value").text($.i18n('core-dialogs/error')+": " + v.message).appendTo(td);
} else { } else {
td.text(v); td.text(v);
} }
@ -441,9 +441,9 @@ ExpressionPreviewDialog.Widget.prototype._renderPreview = function(expression, d
}; };
if (this._results !== null) { if (this._results !== null) {
this._elmts.expressionPreviewParsingStatus.empty().removeClass("error").text($.i18n._('core-dialogs/no-syntax-err')+"."); this._elmts.expressionPreviewParsingStatus.empty().removeClass("error").text($.i18n('core-dialogs/no-syntax-err')+".");
} else { } else {
var message = (data.type == "parser") ? data.message : $.i18n._('core-dialogs/internal-err'); var message = (data.type == "parser") ? data.message : $.i18n('core-dialogs/internal-err');
this._elmts.expressionPreviewParsingStatus.empty().addClass("error").text(message); this._elmts.expressionPreviewParsingStatus.empty().addClass("error").text(message);
} }

View File

@ -41,7 +41,7 @@ function ExtendReconciledDataPreviewDialog(column, columnIndex, rowIndices, onDo
var self = this; var self = this;
this._dialog = $(DOM.loadHTML("core", "scripts/views/data-table/extend-data-preview-dialog.html")); this._dialog = $(DOM.loadHTML("core", "scripts/views/data-table/extend-data-preview-dialog.html"));
this._elmts = DOM.bind(this._dialog); this._elmts = DOM.bind(this._dialog);
this._elmts.dialogHeader.html($.i18n._('core-views/add-col-recon-col')+" "+column.name); this._elmts.dialogHeader.html($.i18n('core-views/add-col-recon-col')+" "+column.name);
this._elmts.resetButton.click(function() { this._elmts.resetButton.click(function() {
self._extension.properties = []; self._extension.properties = [];
self._update(); self._update();
@ -49,7 +49,7 @@ function ExtendReconciledDataPreviewDialog(column, columnIndex, rowIndices, onDo
this._elmts.okButton.click(function() { this._elmts.okButton.click(function() {
if (self._extension.properties.length === 0) { if (self._extension.properties.length === 0) {
alert($.i18n._('core-views/warning-no-property')); alert($.i18n('core-views/warning-no-property'));
} else { } else {
DialogSystem.dismissUntil(self._level - 1); DialogSystem.dismissUntil(self._level - 1);
self._onDone(self._extension, self._onDone(self._extension,
@ -83,9 +83,9 @@ function ExtendReconciledDataPreviewDialog(column, columnIndex, rowIndices, onDo
} }
if (this._serviceMetadata === null) { if (this._serviceMetadata === null) {
alert($.i18n._('core-views/extend-not-reconciled')); alert($.i18n('core-views/extend-not-reconciled'));
} else if(extend === null) { } else if(extend === null) {
alert($.i18n._('core-views/extend-not-supported')); alert($.i18n('core-views/extend-not-supported'));
} else { } else {
var dismissBusy = DialogSystem.showBusy(); var dismissBusy = DialogSystem.showBusy();
ExtendReconciledDataPreviewDialog.getAllProperties(this._proposePropertiesUrl, type, function(properties) { ExtendReconciledDataPreviewDialog.getAllProperties(this._proposePropertiesUrl, type, function(properties) {
@ -196,7 +196,7 @@ ExtendReconciledDataPreviewDialog.prototype._update = function() {
}, },
"json" "json"
).fail(function(data) { ).fail(function(data) {
alert($.i18n._('core-views/internal-err')); alert($.i18n('core-views/internal-err'));
}); });
} }
}; };
@ -255,17 +255,17 @@ ExtendReconciledDataPreviewDialog.prototype._renderPreview = function(data) {
$('<br>').appendTo(th); $('<br>').appendTo(th);
$('<a href="javascript:{}"></a>') $('<a href="javascript:{}"></a>')
.text($.i18n._('core-views/remove-prop')) .text($.i18n('core-views/remove-prop'))
.addClass("action") .addClass("action")
.attr("title", $.i18n._('core-views/remove-col')) .attr("title", $.i18n('core-views/remove-col'))
.click(function() { .click(function() {
self._removeProperty(column.id); self._removeProperty(column.id);
}).appendTo(th); }).appendTo(th);
$('<a href="javascript:{}"></a>') $('<a href="javascript:{}"></a>')
.text($.i18n._('core-views/configure-prop')) .text($.i18n('core-views/configure-prop'))
.addClass("action") .addClass("action")
.attr("title", $.i18n._('core-views/configure-col')) .attr("title", $.i18n('core-views/configure-col'))
.click(function() { .click(function() {
self._constrainProperty(column.id); self._constrainProperty(column.id);
}).appendTo(th); }).appendTo(th);
@ -380,7 +380,7 @@ ExtendReconciledDataPreviewDialog.prototype._constrainProperty = function(id) {
if (table.children().length === 0) { if (table.children().length === 0) {
var tr = $('<tr></tr>').appendTo(table); var tr = $('<tr></tr>').appendTo(table);
$('<td></td>').text($.i18n._('core-views/no-settings')).appendTo(tr); $('<td></td>').text($.i18n('core-views/no-settings')).appendTo(tr);
} }
var form = $('<form class="data-extension-property-config" bind="form"></form>').append(table); var form = $('<form class="data-extension-property-config" bind="form"></form>').append(table);
@ -389,8 +389,8 @@ ExtendReconciledDataPreviewDialog.prototype._constrainProperty = function(id) {
var bodyElmts = DOM.bind(body); var bodyElmts = DOM.bind(body);
footer.html( footer.html(
'<button class="button" bind="okButton">'+$.i18n._('core-buttons/ok')+'</button>' + '<button class="button" bind="okButton">'+$.i18n('core-buttons/ok')+'</button>' +
'<button class="button" bind="cancelButton">'+$.i18n._('core-buttons/cancel')+'</button>' '<button class="button" bind="cancelButton">'+$.i18n('core-buttons/cancel')+'</button>'
); );
var footerElmts = DOM.bind(footer); var footerElmts = DOM.bind(footer);
@ -416,7 +416,7 @@ ExtendReconciledDataPreviewDialog.prototype._constrainProperty = function(id) {
self._update(); self._update();
} catch (e) { } catch (e) {
alert($.i18n._('core-views/internal-err')); alert($.i18n('core-views/internal-err'));
} }
}); });

View File

@ -43,19 +43,19 @@ ScatterplotDialog.prototype._createDialog = function() {
var dialog = $(DOM.loadHTML("core", "scripts/dialogs/scatterplot-dialog.html")); var dialog = $(DOM.loadHTML("core", "scripts/dialogs/scatterplot-dialog.html"));
this._elmts = DOM.bind(dialog); this._elmts = DOM.bind(dialog);
this._elmts.dialogHeader.text( this._elmts.dialogHeader.text(
$.i18n._('core-dialogs/scatterplot-matrix') + $.i18n('core-dialogs/scatterplot-matrix') +
((typeof this._column == "undefined") ? "" : " ("+$.i18n._('core-dialogs/focusing-on')+" '" + this._column + "')")); ((typeof this._column == "undefined") ? "" : " ("+$.i18n('core-dialogs/focusing-on')+" '" + this._column + "')"));
this._elmts.closeButton.click(function() { self._dismiss(); }); this._elmts.closeButton.click(function() { self._dismiss(); });
this._elmts.or_dialog_linplot.attr("title", $.i18n._('core-dialogs/linear-plot')); this._elmts.or_dialog_linplot.attr("title", $.i18n('core-dialogs/linear-plot'));
this._elmts.or_dialog_logplot.attr("title", $.i18n._('core-dialogs/logarithmic-plot')); this._elmts.or_dialog_logplot.attr("title", $.i18n('core-dialogs/logarithmic-plot'));
this._elmts.or_dialog_counter.attr("title", $.i18n._('core-dialogs/rotated-counter-clock')); this._elmts.or_dialog_counter.attr("title", $.i18n('core-dialogs/rotated-counter-clock'));
this._elmts.or_dialog_norot.attr("title", $.i18n._('core-dialogs/no-rotation')); this._elmts.or_dialog_norot.attr("title", $.i18n('core-dialogs/no-rotation'));
this._elmts.or_dialog_clock.attr("title", $.i18n._('core-dialogs/rotated-clock')); this._elmts.or_dialog_clock.attr("title", $.i18n('core-dialogs/rotated-clock'));
this._elmts.or_dialog_smallDot.attr("title", $.i18n._('core-dialogs/small-dot')); this._elmts.or_dialog_smallDot.attr("title", $.i18n('core-dialogs/small-dot'));
this._elmts.or_dialog_regularDot.attr("title", $.i18n._('core-dialogs/regular-dot')); this._elmts.or_dialog_regularDot.attr("title", $.i18n('core-dialogs/regular-dot'));
this._elmts.or_dialog_bigDot.attr("title", $.i18n._('core-dialogs/big-dot')); this._elmts.or_dialog_bigDot.attr("title", $.i18n('core-dialogs/big-dot'));
this._elmts.closeButton.text($.i18n._('core-buttons/close')); this._elmts.closeButton.text($.i18n('core-buttons/close'));
this._elmts.plotSelector.buttonset().change(function() { this._elmts.plotSelector.buttonset().change(function() {
self._plot_method = $(this).find("input:checked").val(); self._plot_method = $(this).find("input:checked").val();
@ -87,7 +87,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
var self = this; var self = this;
var container = this._elmts.tableContainer.html( var container = this._elmts.tableContainer.html(
'<div style="margin: 1em; font-size: 130%; color: #888; background-color: white;">'+$.i18n._('core-dialogs/focusing-on')+' <img src="images/small-spinner.gif"></div>' '<div style="margin: 1em; font-size: 130%; color: #888; background-color: white;">'+$.i18n('core-dialogs/focusing-on')+' <img src="images/small-spinner.gif"></div>'
); );
if (theProject.columnModel.columns.length > 0) { if (theProject.columnModel.columns.length > 0) {
@ -96,7 +96,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
}; };
$.getJSON("command/core/get-columns-info?" + $.param(params),function(data) { $.getJSON("command/core/get-columns-info?" + $.param(params),function(data) {
if (data === null || typeof data.length == 'undefined') { if (data === null || typeof data.length == 'undefined') {
container.html($.i18n._('core-dialogs')["error-getColumnInfo"]); container.html($.i18n('core-dialogs')["error-getColumnInfo"]);
return; return;
} }
@ -214,7 +214,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
}); });
} else { } else {
container.html( container.html(
'<div style="margin: 2em;"><div style="font-size: 130%; color: #333;">'+$.i18n._('core-dialogs/no-column-dataset')+ '</div></div>' '<div style="margin: 2em;"><div style="font-size: 130%; color: #333;">'+$.i18n('core-dialogs/no-column-dataset')+ '</div></div>'
); );
} }

View File

@ -48,30 +48,30 @@ function SqlExporterDialog(options) {
this._dialog = $(DOM.loadHTML("core", "scripts/dialogs/sql-exporter-dialog.html")); this._dialog = $(DOM.loadHTML("core", "scripts/dialogs/sql-exporter-dialog.html"));
this._elmts = DOM.bind(this._dialog); this._elmts = DOM.bind(this._dialog);
this._level = DialogSystem.showDialog(this._dialog); this._level = DialogSystem.showDialog(this._dialog);
this._elmts.dialogHeader.html($.i18n._('core-dialogs/sql-exporter')); this._elmts.dialogHeader.html($.i18n('core-dialogs/sql-exporter'));
this._elmts.or_dialog_content.html($.i18n._('core-dialogs/content')); this._elmts.or_dialog_content.html($.i18n('core-dialogs/content'));
this._elmts.or_dialog_download.html($.i18n._('core-dialogs/download')); this._elmts.or_dialog_download.html($.i18n('core-dialogs/download'));
this._elmts.selectAllButton.html($.i18n._('core-buttons/select-all')); this._elmts.selectAllButton.html($.i18n('core-buttons/select-all'));
this._elmts.deselectAllButton.html($.i18n._('core-buttons/deselect-all')); this._elmts.deselectAllButton.html($.i18n('core-buttons/deselect-all'));
this._elmts.downloadPreviewButton.html($.i18n._('core-buttons/preview')); this._elmts.downloadPreviewButton.html($.i18n('core-buttons/preview'));
this._elmts.downloadButton.html($.i18n._('core-buttons/download')); this._elmts.downloadButton.html($.i18n('core-buttons/download'));
this._elmts.cancelButton.html($.i18n._('core-buttons/cancel')); this._elmts.cancelButton.html($.i18n('core-buttons/cancel'));
// this._elmts.nextButton.html($.i18n._('core-buttons/next')); // this._elmts.nextButton.html($.i18n('core-buttons/next'));
this._elmts.tableNameLabel.html($.i18n._('core-dialogs/tableNameLabel')); this._elmts.tableNameLabel.html($.i18n('core-dialogs/tableNameLabel'));
this._elmts.includeStructureLabel.html($.i18n._('core-dialogs/for-include-structure-checkbox')); this._elmts.includeStructureLabel.html($.i18n('core-dialogs/for-include-structure-checkbox'));
this._elmts.includeDropStatementLabel.html($.i18n._('core-dialogs/for-include-drop-statement-checkbox')); this._elmts.includeDropStatementLabel.html($.i18n('core-dialogs/for-include-drop-statement-checkbox'));
this._elmts.includeContentLabel.html($.i18n._('core-dialogs/for-include-content-checkbox')); this._elmts.includeContentLabel.html($.i18n('core-dialogs/for-include-content-checkbox'));
this._elmts.includeIfExistDropStatementLabel.html($.i18n._('core-dialogs/for-include-if-exist-drop-stmt-checkbox')); this._elmts.includeIfExistDropStatementLabel.html($.i18n('core-dialogs/for-include-if-exist-drop-stmt-checkbox'));
this._elmts.nullCellValueToEmptyStringLabel.html($.i18n._('core-dialogs/for-null-cell-value-to-empty-str-label')); this._elmts.nullCellValueToEmptyStringLabel.html($.i18n('core-dialogs/for-null-cell-value-to-empty-str-label'));
this._elmts.sqlExportIgnoreFacetsLabel.html($.i18n._('core-dialogs/sqlExporterIgnoreFacets')); this._elmts.sqlExportIgnoreFacetsLabel.html($.i18n('core-dialogs/sqlExporterIgnoreFacets'));
this._elmts.sqlExportTrimAllColumnsLabel.html($.i18n._('core-dialogs/sqlExporterTrimColumns')); this._elmts.sqlExportTrimAllColumnsLabel.html($.i18n('core-dialogs/sqlExporterTrimColumns'));
this._elmts.sqlExportOutputEmptyRowsLabel.html($.i18n._('core-dialogs/sqlExporterOutputEmptyRows')); this._elmts.sqlExportOutputEmptyRowsLabel.html($.i18n('core-dialogs/sqlExporterOutputEmptyRows'));
$("#sql-exporter-tabs-content").css("display", ""); $("#sql-exporter-tabs-content").css("display", "");
$("#sql-exporter-tabs-download").css("display", ""); $("#sql-exporter-tabs-download").css("display", "");

View File

@ -43,14 +43,14 @@ TemplatingExporterDialog.prototype._createDialog = function() {
this._elmts = DOM.bind(dialog); this._elmts = DOM.bind(dialog);
this._elmts.controls.find("textarea").bind("keyup change input",function() { self._scheduleUpdate(); }); this._elmts.controls.find("textarea").bind("keyup change input",function() { self._scheduleUpdate(); });
this._elmts.dialogHeader.html($.i18n._('core-dialogs/template-export')); this._elmts.dialogHeader.html($.i18n('core-dialogs/template-export'));
this._elmts.or_dialog_prefix.html($.i18n._('core-dialogs/template-prefix')); this._elmts.or_dialog_prefix.html($.i18n('core-dialogs/template-prefix'));
this._elmts.or_dialog_rowTmpl.html($.i18n._('core-dialogs/template-rowt')); this._elmts.or_dialog_rowTmpl.html($.i18n('core-dialogs/template-rowt'));
this._elmts.or_dialog_rowSep.html($.i18n._('core-dialogs/template-rows')); this._elmts.or_dialog_rowSep.html($.i18n('core-dialogs/template-rows'));
this._elmts.or_dialog_suffix.html($.i18n._('core-dialogs/template-suffix')); this._elmts.or_dialog_suffix.html($.i18n('core-dialogs/template-suffix'));
this._elmts.resetButton.html($.i18n._('core-buttons/reset-template')); this._elmts.resetButton.html($.i18n('core-buttons/reset-template'));
this._elmts.exportButton.html($.i18n._('core-buttons/export')); this._elmts.exportButton.html($.i18n('core-buttons/export'));
this._elmts.cancelButton.html($.i18n._('core-buttons/cancel')); this._elmts.cancelButton.html($.i18n('core-buttons/cancel'));
this._elmts.exportButton.click(function() { self._export(); self._dismiss(); }); this._elmts.exportButton.click(function() { self._export(); self._dismiss(); });
this._elmts.cancelButton.click(function() { self._dismiss(); }); this._elmts.cancelButton.click(function() { self._dismiss(); });
@ -107,10 +107,10 @@ TemplatingExporterDialog.prototype._scheduleUpdate = function() {
window.clearTimeout(this._timerID); window.clearTimeout(this._timerID);
} }
this._elmts.previewTextarea[0].value = $.i18n._('core-dialogs/idling'); this._elmts.previewTextarea[0].value = $.i18n('core-dialogs/idling');
this._timerID = window.setTimeout(function() { this._timerID = window.setTimeout(function() {
self._timerID = null; self._timerID = null;
self._elmts.previewTextarea[0].value = $.i18n._('core-dialogs/updating'); self._elmts.previewTextarea[0].value = $.i18n('core-dialogs/updating');
self._updatePreview(); self._updatePreview();
}, 1000); }, 1000);
}; };

View File

@ -44,6 +44,9 @@ function ListFacet(div, config, options, selection) {
} }
this._selection = selection || []; this._selection = selection || [];
this._numberChoice = (config.selectNumber) ? { s : true, c : 0 } : null;
this._datetimeChoice = (config.selectDateTime) ? { s : true, c : 0 } : null;
this._booleanChoice = (config.selecBoolean) ? { s : true, c : 0 } : null;
this._blankChoice = (config.selectBlank) ? { s : true, c : 0 } : null; this._blankChoice = (config.selectBlank) ? { s : true, c : 0 } : null;
this._errorChoice = (config.selectError) ? { s : true, c : 0 } : null; this._errorChoice = (config.selectError) ? { s : true, c : 0 } : null;
@ -62,6 +65,9 @@ ListFacet.prototype.dispose = function() {
ListFacet.prototype.reset = function() { ListFacet.prototype.reset = function() {
this._selection = []; this._selection = [];
this._numberChoice = null;
this._datetimeChoice = null;
this._booleanChoice = null;
this._blankChoice = null; this._blankChoice = null;
this._errorChoice = null; this._errorChoice = null;
}; };
@ -85,11 +91,14 @@ ListFacet.prototype.getJSON = function() {
columnName: this._config.columnName, columnName: this._config.columnName,
expression: this._config.expression, expression: this._config.expression,
omitBlank: "omitBlank" in this._config ? this._config.omitBlank : false, omitBlank: "omitBlank" in this._config ? this._config.omitBlank : false,
omitError: "omitError" in this._config ? this._config.omitError : false, omitError: "omitError" in this._config ? this._config.omitError : false,
selection: [], selection: [],
selectBlank: this._blankChoice !== null && this._blankChoice.s, selectNumber: this._numberChoice !== null && this._numberChoice.s,
selectError: this._errorChoice !== null && this._errorChoice.s, selectDateTime: this._datetimeChoice !== null && this._datetimeChoice.s,
invert: this._config.invert selectBoolean: this._booleanChoice !== null && this._booleanChoice.s,
selectBlank: this._blankChoice !== null && this._blankChoice.s,
selectError: this._errorChoice !== null && this._errorChoice.s,
invert: this._config.invert
}; };
for (var i = 0; i < this._selection.length; i++) { for (var i = 0; i < this._selection.length; i++) {
var choice = { var choice = {
@ -102,8 +111,11 @@ ListFacet.prototype.getJSON = function() {
ListFacet.prototype.hasSelection = function() { ListFacet.prototype.hasSelection = function() {
return this._selection.length > 0 || return this._selection.length > 0 ||
(this._blankChoice !== null && this._blankChoice.s) || ( this._numberChoice !== null && this._numberChoice.s ) ||
(this._errorChoice !== null && this._errorChoice.s); ( this._datetimeChoice !== null && this._datetimeChoice.s ) ||
( this._booleanChoice !== null && this._booleanChoice.s ) ||
( this._blankChoice !== null && this._blankChoice.s ) ||
( this._errorChoice !== null && this._errorChoice.s );
}; };
ListFacet.prototype.updateState = function(data) { ListFacet.prototype.updateState = function(data) {
@ -121,6 +133,9 @@ ListFacet.prototype.updateState = function(data) {
this._selection = selection; this._selection = selection;
this._reSortChoices(); this._reSortChoices();
this._numberChoice = data.numberChoice || null;
this._datetimeChoice = data.datetimeChoice || null;
this._booleanChoice = data.booleanChoice || null;
this._blankChoice = data.blankChoice || null; this._blankChoice = data.blankChoice || null;
this._errorChoice = data.errorChoice || null; this._errorChoice = data.errorChoice || null;
} }
@ -148,23 +163,23 @@ ListFacet.prototype._initializeUI = function() {
this._div.empty().show().html( this._div.empty().show().html(
'<div class="facet-title" bind="facetTitle">' + '<div class="facet-title" bind="facetTitle">' +
'<div class="grid-layout layout-tightest layout-full"><table><tr>' + '<div class="grid-layout layout-tightest layout-full"><table><tr>' +
'<td width="1%"><a href="javascript:{}" title="'+$.i18n._('core-facets/remove-facet')+'" class="facet-title-remove" bind="removeButton">&nbsp;</a></td>' + '<td width="1%"><a href="javascript:{}" title="'+$.i18n('core-facets/remove-facet')+'" class="facet-title-remove" bind="removeButton">&nbsp;</a></td>' +
'<td>' + '<td>' +
'<a href="javascript:{}" class="facet-choice-link" bind="resetButton">'+$.i18n._('core-facets/reset')+'</a>' + '<a href="javascript:{}" class="facet-choice-link" bind="resetButton">'+$.i18n('core-facets/reset')+'</a>' +
'<a href="javascript:{}" class="facet-choice-link" bind="invertButton">'+$.i18n._('core-facets/invert')+'</a>' + '<a href="javascript:{}" class="facet-choice-link" bind="invertButton">'+$.i18n('core-facets/invert')+'</a>' +
'<a href="javascript:{}" class="facet-choice-link" bind="changeButton">'+$.i18n._('core-facets/change')+'</a>' + '<a href="javascript:{}" class="facet-choice-link" bind="changeButton">'+$.i18n('core-facets/change')+'</a>' +
'<span bind="titleSpan"></span>' + '<span bind="titleSpan"></span>' +
'</td>' + '</td>' +
'</tr></table></div>' + '</tr></table></div>' +
'</div>' + '</div>' +
'<div class="facet-expression" bind="expressionDiv" title="'+$.i18n._('core-facets/click-to-edit')+'"></div>' + '<div class="facet-expression" bind="expressionDiv" title="'+$.i18n('core-facets/click-to-edit')+'"></div>' +
'<div class="facet-controls" bind="controlsDiv" style="display:none;">' + '<div class="facet-controls" bind="controlsDiv" style="display:none;">' +
'<a bind="choiceCountContainer" class="action" href="javascript:{}"></a> ' + '<a bind="choiceCountContainer" class="action" href="javascript:{}"></a> ' +
'<span class="facet-controls-sortControls" bind="sortGroup">'+$.i18n._('core-facets/sort-by')+': ' + '<span class="facet-controls-sortControls" bind="sortGroup">'+$.i18n('core-facets/sort-by')+': ' +
'<a href="javascript:{}" bind="sortByNameLink">'+$.i18n._('core-facets/name')+'</a>' + '<a href="javascript:{}" bind="sortByNameLink">'+$.i18n('core-facets/name')+'</a>' +
'<a href="javascript:{}" bind="sortByCountLink">'+$.i18n._('core-facets/count')+'</a>' + '<a href="javascript:{}" bind="sortByCountLink">'+$.i18n('core-facets/count')+'</a>' +
'</span>' + '</span>' +
'<button bind="clusterLink" class="facet-controls-button button">'+$.i18n._('core-facets/cluster')+'</button>' + '<button bind="clusterLink" class="facet-controls-button button">'+$.i18n('core-facets/cluster')+'</button>' +
'</div>' + '</div>' +
'<div class="facet-body" bind="bodyDiv">' + '<div class="facet-body" bind="bodyDiv">' +
'<div class="facet-body-inner" bind="bodyInnerDiv"></div>' + '<div class="facet-body-inner" bind="bodyInnerDiv"></div>' +
@ -173,7 +188,7 @@ ListFacet.prototype._initializeUI = function() {
this._elmts = DOM.bind(this._div); this._elmts = DOM.bind(this._div);
this._elmts.titleSpan.text(this._config.name); this._elmts.titleSpan.text(this._config.name);
this._elmts.changeButton.attr("title",$.i18n._('core-facets/current-exp')+": " + this._config.expression).click(function() { this._elmts.changeButton.attr("title",$.i18n('core-facets/current-exp')+": " + this._config.expression).click(function() {
self._elmts.expressionDiv.slideToggle(100, function() { self._elmts.expressionDiv.slideToggle(100, function() {
if (self._elmts.expressionDiv.css("display") != "none") { if (self._elmts.expressionDiv.css("display") != "none") {
self._editExpression(); self._editExpression();
@ -223,14 +238,14 @@ ListFacet.prototype._copyChoices = function() {
var frame = DialogSystem.createDialog(); var frame = DialogSystem.createDialog();
frame.width("600px"); frame.width("600px");
var header = $('<div></div>').addClass("dialog-header").text($.i18n._('core-facets/facet-choices')).appendTo(frame); var header = $('<div></div>').addClass("dialog-header").text($.i18n('core-facets/facet-choices')).appendTo(frame);
var body = $('<div></div>').addClass("dialog-body").appendTo(frame); var body = $('<div></div>').addClass("dialog-body").appendTo(frame);
var footer = $('<div></div>').addClass("dialog-footer").appendTo(frame); var footer = $('<div></div>').addClass("dialog-footer").appendTo(frame);
body.html('<textarea wrap="off" bind="textarea" style="display: block; width: 100%; height: 400px;" />'); body.html('<textarea wrap="off" bind="textarea" style="display: block; width: 100%; height: 400px;" />');
var elmts = DOM.bind(body); var elmts = DOM.bind(body);
$('<button class="button"></button>').text($.i18n._('core-buttons/close')).click(function() { $('<button class="button"></button>').text($.i18n('core-buttons/close')).click(function() {
DialogSystem.dismissUntil(level - 1); DialogSystem.dismissUntil(level - 1);
}).appendTo(footer); }).appendTo(footer);
@ -239,6 +254,15 @@ ListFacet.prototype._copyChoices = function() {
var choice = this._data.choices[i]; var choice = this._data.choices[i];
lines.push(choice.v.l + "\t" + choice.c); lines.push(choice.v.l + "\t" + choice.c);
} }
if (this._numberChoice) {
lines.push("(number)\t" + this._numberChoice.c);
}
if (this._datetimeChoice) {
lines.push("(date)\t" + this._datetimeChoice.c);
}
if (this._booleanChoice) {
lines.push("(boolean)\t" + this._booleanChoice.c);
}
if (this._blankChoice) { if (this._blankChoice) {
lines.push("(blank)\t" + this._blankChoice.c); lines.push("(blank)\t" + this._blankChoice.c);
} }
@ -272,7 +296,7 @@ ListFacet.prototype._update = function(resetScroll) {
//this._elmts.statusDiv.hide(); //this._elmts.statusDiv.hide();
this._elmts.controlsDiv.hide(); this._elmts.controlsDiv.hide();
this._elmts.bodyInnerDiv.empty().append( this._elmts.bodyInnerDiv.empty().append(
$('<div>').text($.i18n._('core-facets/loading')).addClass("facet-body-message")); $('<div>').text($.i18n('core-facets/loading')).addClass("facet-body-message"));
return; return;
} else if ("error" in this._data) { } else if ("error" in this._data) {
@ -283,12 +307,12 @@ ListFacet.prototype._update = function(resetScroll) {
this._elmts.bodyInnerDiv.empty(); this._elmts.bodyInnerDiv.empty();
var messageDiv = $('<div>') var messageDiv = $('<div>')
.text(this._data.choiceCount + " "+$.i18n._('core-facets/too-many-choices')) .text(this._data.choiceCount + " "+$.i18n('core-facets/too-many-choices'))
.addClass("facet-body-message") .addClass("facet-body-message")
.appendTo(this._elmts.bodyInnerDiv); .appendTo(this._elmts.bodyInnerDiv);
$('<br>').appendTo(messageDiv); $('<br>').appendTo(messageDiv);
$('<a>') $('<a>')
.text($.i18n._('core-facets/set-choice-count')) .text($.i18n('core-facets/set-choice-count'))
.attr("href", "javascript:{}") .attr("href", "javascript:{}")
.addClass("action") .addClass("action")
.addClass("secondary") .addClass("secondary")
@ -335,6 +359,9 @@ ListFacet.prototype._update = function(resetScroll) {
var choices = this._data.choices; var choices = this._data.choices;
var selectionCount = this._selection.length + var selectionCount = this._selection.length +
(this._numberChoice !== null && this._numberChoice.s ? 1 : 0) +
(this._datetimeChoice !== null && this._datetimeChoice.s ? 1 : 0) +
(this._booleanChoice !== null && this._booleanChoice.s ? 1 : 0) +
(this._blankChoice !== null && this._blankChoice.s ? 1 : 0) + (this._blankChoice !== null && this._blankChoice.s ? 1 : 0) +
(this._errorChoice !== null && this._errorChoice.s ? 1 : 0); (this._errorChoice !== null && this._errorChoice.s ? 1 : 0);
@ -378,7 +405,7 @@ ListFacet.prototype._update = function(resetScroll) {
// edit link // edit link
if (renderEdit) { if (renderEdit) {
html.push('<a href="javascript:{}" class="facet-choice-link facet-choice-edit" style="visibility: hidden">'+$.i18n._('core-facets/edit')+'</a>'); html.push('<a href="javascript:{}" class="facet-choice-link facet-choice-edit" style="visibility: hidden">'+$.i18n('core-facets/edit')+'</a>');
} }
html.push('<a href="javascript:{}" class="facet-choice-label">' + encodeHtml(label) + '</a>'); html.push('<a href="javascript:{}" class="facet-choice-label">' + encodeHtml(label) + '</a>');
@ -389,10 +416,24 @@ ListFacet.prototype._update = function(resetScroll) {
for (var i = 0; i < choices.length; i++) { for (var i = 0; i < choices.length; i++) {
renderChoice(i, choices[i]); renderChoice(i, choices[i]);
} }
if (this._numberChoice !== null) {
renderEdit = false;
renderChoice(-5, this._numberChoice, "(number)");
}
if (this._datetimeChoice !== null) {
renderEdit = false;
renderChoice(-4, this._datetimeChoice, "(date)");
}
if (this._booleanChoice !== null) {
renderEdit = false;
renderChoice(-3, this._booleanChoice, "(boolean)");
}
if (this._blankChoice !== null) { if (this._blankChoice !== null) {
renderEdit = false;
renderChoice(-1, this._blankChoice, "(blank)"); renderChoice(-1, this._blankChoice, "(blank)");
} }
if (this._errorChoice !== null) { if (this._errorChoice !== null) {
renderEdit = false;
renderChoice(-2, this._errorChoice, "(error)"); renderChoice(-2, this._errorChoice, "(error)");
} }
@ -406,6 +447,12 @@ ListFacet.prototype._update = function(resetScroll) {
return self._blankChoice; return self._blankChoice;
} else if (index === -2) { } else if (index === -2) {
return self._errorChoice; return self._errorChoice;
} else if (index === -3) {
return self._booleanChoice;
} else if (index === -4) {
return self._datetimeChoice;
} else if (index === -5) {
return self._numberChoice;
} else { } else {
return choices[index]; return choices[index];
} }
@ -481,7 +528,7 @@ ListFacet.prototype._renderBodyControls = function() {
.appendTo(this._elmts.bodyInnerDiv); .appendTo(this._elmts.bodyInnerDiv);
$('<a>') $('<a>')
.text($.i18n._('core-facets/facet-by-count')) .text($.i18n('core-facets/facet-by-count'))
.attr("href", "javascript:{}") .attr("href", "javascript:{}")
.addClass("action") .addClass("action")
.addClass("secondary") .addClass("secondary")
@ -523,12 +570,12 @@ ListFacet.prototype._editChoice = function(choice, choiceDiv) {
'<textarea class="data-table-cell-editor-editor" bind="textarea" />' + '<textarea class="data-table-cell-editor-editor" bind="textarea" />' +
'<div id="data-table-cell-editor-actions">' + '<div id="data-table-cell-editor-actions">' +
'<div class="data-table-cell-editor-action">' + '<div class="data-table-cell-editor-action">' +
'<button class="button" bind="okButton">'+$.i18n._('core-buttons/apply')+'</button>' + '<button class="button" bind="okButton">'+$.i18n('core-buttons/apply')+'</button>' +
'<div class="data-table-cell-editor-key">'+$.i18n._('core-buttons/enter')+'</div>' + '<div class="data-table-cell-editor-key">'+$.i18n('core-buttons/enter')+'</div>' +
'</div>' + '</div>' +
'<div class="data-table-cell-editor-action">' + '<div class="data-table-cell-editor-action">' +
'<button class="button" bind="cancelButton">'+$.i18n._('core-buttons/cancel')+'</button>' + '<button class="button" bind="cancelButton">'+$.i18n('core-buttons/cancel')+'</button>' +
'<div class="data-table-cell-editor-key">'+$.i18n._('core-buttons/esc')+'</div>' + '<div class="data-table-cell-editor-key">'+$.i18n('core-buttons/esc')+'</div>' +
'</div>' + '</div>' +
'</div>' '</div>'
); );
@ -542,6 +589,12 @@ ListFacet.prototype._editChoice = function(choice, choiceDiv) {
originalContent = "(blank)"; originalContent = "(blank)";
} else if (choice === this._errorChoice) { } else if (choice === this._errorChoice) {
originalContent = "(error)"; originalContent = "(error)";
} else if (choice === this._booleanChoice) {
originalContent = "(boolean)";
} else if (choice === this._datetimeChoice) {
originalContent = "(date)";
} else if (choice === this._numberChoice) {
originalContent = "(number)";
} else { } else {
originalContent = choice.v.v; originalContent = choice.v.v;
} }
@ -617,6 +670,15 @@ ListFacet.prototype._editChoice = function(choice, choiceDiv) {
ListFacet.prototype._select = function(choice, only) { ListFacet.prototype._select = function(choice, only) {
if (only) { if (only) {
this._selection = []; this._selection = [];
if (this._numberChoice !== null) {
this._numberChoice.s = false;
}
if (this._datetimeChoice !== null) {
this._datetimeChoice.s = false;
}
if (this._booleanChoice !== null) {
this._booleanChoice.s = false;
}
if (this._blankChoice !== null) { if (this._blankChoice !== null) {
this._blankChoice.s = false; this._blankChoice.s = false;
} }
@ -626,7 +688,11 @@ ListFacet.prototype._select = function(choice, only) {
} }
choice.s = true; choice.s = true;
if (choice !== this._errorChoice && choice !== this._blankChoice) { if (choice !== this._errorChoice &&
choice !== this._blankChoice &&
choice !== this._numberChoice &&
choice !== this._datetimeChoice &&
choice !== this._booleanChoice ) {
this._selection.push(choice); this._selection.push(choice);
} }
@ -634,7 +700,7 @@ ListFacet.prototype._select = function(choice, only) {
}; };
ListFacet.prototype._deselect = function(choice) { ListFacet.prototype._deselect = function(choice) {
if (choice === this._errorChoice || choice === this._blankChoice) { if (choice === this._errorChoice || choice === this._blankChoice || choice === this._numberChoice || choice === this._datetimeChoice || choice === this._booleanChoice) {
choice.s = false; choice.s = false;
} else { } else {
for (var i = this._selection.length - 1; i >= 0; i--) { for (var i = this._selection.length - 1; i >= 0; i--) {
@ -649,6 +715,9 @@ ListFacet.prototype._deselect = function(choice) {
ListFacet.prototype._reset = function() { ListFacet.prototype._reset = function() {
this._selection = []; this._selection = [];
this._numberChoice = null;
this._datetimeChoice = null;
this._booleanChoice = null;
this._blankChoice = null; this._blankChoice = null;
this._errorChoice = null; this._errorChoice = null;
this._config.invert = false; this._config.invert = false;
@ -669,6 +738,9 @@ ListFacet.prototype._remove = function() {
this._config = null; this._config = null;
this._selection = null; this._selection = null;
this._numberChoice = null;
this._datetimeChoice = null;
this._booleanChoice = null;
this._blankChoice = null; this._blankChoice = null;
this._errorChoice = null; this._errorChoice = null;
this._data = null; this._data = null;
@ -681,8 +753,8 @@ ListFacet.prototype._updateRest = function() {
ListFacet.prototype._editExpression = function() { ListFacet.prototype._editExpression = function() {
var self = this; var self = this;
var title = (this._config.columnName) ? var title = (this._config.columnName) ?
($.i18n._('core-facets/edit-based-col')+" " + this._config.columnName) : ($.i18n('core-facets/edit-based-col')+" " + this._config.columnName) :
$.i18n._('core-facets/edit-facet-exp'); $.i18n('core-facets/edit-facet-exp');
var column = Refine.columnNameToColumn(this._config.columnName); var column = Refine.columnNameToColumn(this._config.columnName);
var o = DataTableView.sampleVisibleRows(column); var o = DataTableView.sampleVisibleRows(column);
@ -698,7 +770,7 @@ ListFacet.prototype._editExpression = function() {
self._config.expression = expr; self._config.expression = expr;
self._elmts.expressionDiv.text(self._config.expression); self._elmts.expressionDiv.text(self._config.expression);
self._elmts.changeButton.attr("title", $.i18n._('core-facets/current-exp')+": " + self._config.expression); self._elmts.changeButton.attr("title", $.i18n('core-facets/current-exp')+": " + self._config.expression);
if (self._config.expression === "value" || self._config.expression === "grel:value") { if (self._config.expression === "value" || self._config.expression === "grel:value") {
self._elmts.clusterLink.show(); self._elmts.clusterLink.show();
} else { } else {
@ -715,7 +787,7 @@ ListFacet.prototype._editExpression = function() {
ListFacet.prototype._setChoiceCountLimit = function(choiceCount) { ListFacet.prototype._setChoiceCountLimit = function(choiceCount) {
var limit = Math.ceil(choiceCount / 1000) * 1000; var limit = Math.ceil(choiceCount / 1000) * 1000;
var s = window.prompt($.i18n._('core-facets/set-max-choices'), limit); var s = window.prompt($.i18n('core-facets/set-max-choices'), limit);
if (s) { if (s) {
var n = parseInt(s,10); var n = parseInt(s,10);

View File

@ -132,17 +132,17 @@ RangeFacet.prototype._initializeUI = function() {
.html( .html(
'<div class="facet-title" bind="headerDiv">' + '<div class="facet-title" bind="headerDiv">' +
'<div class="grid-layout layout-tightest layout-full"><table><tr>' + '<div class="grid-layout layout-tightest layout-full"><table><tr>' +
'<td width="1%"><a href="javascript:{}" title="'+$.i18n._('core-facets/remove-facet')+'" class="facet-title-remove" bind="removeButton">&nbsp;</a></td>' + '<td width="1%"><a href="javascript:{}" title="'+$.i18n('core-facets/remove-facet')+'" class="facet-title-remove" bind="removeButton">&nbsp;</a></td>' +
'<td>' + '<td>' +
'<a href="javascript:{}" class="facet-choice-link" bind="resetButton">'+$.i18n._('core-facets/reset')+'</a>' + '<a href="javascript:{}" class="facet-choice-link" bind="resetButton">'+$.i18n('core-facets/reset')+'</a>' +
'<a href="javascript:{}" class="facet-choice-link" bind="changeButton">'+$.i18n._('core-facets/change')+'</a>' + '<a href="javascript:{}" class="facet-choice-link" bind="changeButton">'+$.i18n('core-facets/change')+'</a>' +
'<span bind="facetTitle"></span>' + '<span bind="facetTitle"></span>' +
'</td>' + '</td>' +
'</tr></table></div>' + '</tr></table></div>' +
'</div>' + '</div>' +
'<div class="facet-expression" bind="expressionDiv" title="'+$.i18n._('core-facets/click-to-edit')+'"></div>' + '<div class="facet-expression" bind="expressionDiv" title="'+$.i18n('core-facets/click-to-edit')+'"></div>' +
'<div class="facet-range-body">' + '<div class="facet-range-body">' +
'<div class="facet-range-message" bind="messageDiv">'+$.i18n._('core-facets/loading')+'</div>' + '<div class="facet-range-message" bind="messageDiv">'+$.i18n('core-facets/loading')+'</div>' +
'<div class="facet-range-slider" bind="sliderWidgetDiv">' + '<div class="facet-range-slider" bind="sliderWidgetDiv">' +
'<div class="facet-range-histogram" bind="histogramDiv"></div>' + '<div class="facet-range-histogram" bind="histogramDiv"></div>' +
'</div>' + '</div>' +
@ -153,7 +153,7 @@ RangeFacet.prototype._initializeUI = function() {
this._elmts = DOM.bind(this._div); this._elmts = DOM.bind(this._div);
this._elmts.facetTitle.text(this._config.name); this._elmts.facetTitle.text(this._config.name);
this._elmts.changeButton.attr("title",$.i18n._('core-facets/current-expression')+": " + this._config.expression).click(function() { this._elmts.changeButton.attr("title",$.i18n('core-facets/current-expression')+": " + this._config.expression).click(function() {
self._elmts.expressionDiv.slideToggle(100, function() { self._elmts.expressionDiv.slideToggle(100, function() {
if (self._elmts.expressionDiv.css("display") != "none") { if (self._elmts.expressionDiv.css("display") != "none") {
self._editExpression(); self._editExpression();
@ -209,7 +209,7 @@ RangeFacet.prototype._renderOtherChoices = function() {
if (this._selectNumeric) numericCheck.attr("checked","checked"); if (this._selectNumeric) numericCheck.attr("checked","checked");
var numericLabel = $('<label>').attr("for", facet_id + "-numeric").appendTo(numericDiv); var numericLabel = $('<label>').attr("for", facet_id + "-numeric").appendTo(numericDiv);
$('<span>').text($.i18n._('core-facets/numeric')+" ").addClass("facet-range-choice-label").appendTo(numericLabel); $('<span>').text($.i18n('core-facets/numeric')+" ").addClass("facet-range-choice-label").appendTo(numericLabel);
$('<div>').text(this._numericCount).addClass("facet-range-choice-count").appendTo(numericLabel); $('<div>').text(this._numericCount).addClass("facet-range-choice-count").appendTo(numericLabel);
// ----------------- non-numeric ----------------- // ----------------- non-numeric -----------------
@ -315,7 +315,7 @@ RangeFacet.prototype.updateState = function(data) {
this._errorCount = data.errorCount; this._errorCount = data.errorCount;
} else { } else {
this._error = true; this._error = true;
this._errorMessage = "error" in data ? data.error : $.i18n._('core-facets/unknown-error')+"."; this._errorMessage = "error" in data ? data.error : $.i18n('core-facets/unknown-error')+".";
} }
this.render(); this.render();
@ -375,8 +375,8 @@ RangeFacet.prototype._updateRest = function() {
RangeFacet.prototype._editExpression = function() { RangeFacet.prototype._editExpression = function() {
var self = this; var self = this;
var title = (this._config.columnName) ? var title = (this._config.columnName) ?
($.i18n._('core-facets/edit-based-col')+" " + this._config.columnName) : ($.i18n('core-facets/edit-based-col')+" " + this._config.columnName) :
$.i18n._('core-facets/edit-facet-exp'); $.i18n('core-facets/edit-facet-exp');
var column = Refine.columnNameToColumn(this._config.columnName); var column = Refine.columnNameToColumn(this._config.columnName);
var o = DataTableView.sampleVisibleRows(column); var o = DataTableView.sampleVisibleRows(column);

View File

@ -93,15 +93,15 @@ ScatterplotFacet.prototype._initializeUI = function() {
this._div.empty().show().html( this._div.empty().show().html(
'<div class="facet-title">' + '<div class="facet-title">' +
'<div class="grid-layout layout-tightest layout-full"><table><tr>' + '<div class="grid-layout layout-tightest layout-full"><table><tr>' +
'<td width="1%"><a href="javascript:{}" title="'+$.i18n._('core-facets/remove-facet')+'" class="facet-title-remove" bind="removeButton">&nbsp;</a></td>' + '<td width="1%"><a href="javascript:{}" title="'+$.i18n('core-facets/remove-facet')+'" class="facet-title-remove" bind="removeButton">&nbsp;</a></td>' +
'<td>' + '<td>' +
'<a href="javascript:{}" class="facet-choice-link" bind="resetButton">'+$.i18n._('core-facets/reset')+'</a>' + '<a href="javascript:{}" class="facet-choice-link" bind="resetButton">'+$.i18n('core-facets/reset')+'</a>' +
'<span bind="titleSpan"></span>' + '<span bind="titleSpan"></span>' +
'</td>' + '</td>' +
'</tr></table></div>' + '</tr></table></div>' +
'</div>' + '</div>' +
'<div class="facet-scatterplot-body" bind="bodyDiv">' + '<div class="facet-scatterplot-body" bind="bodyDiv">' +
'<div class="facet-scatterplot-message" bind="messageDiv">'+$.i18n._('core-facets/loading')+'</div>' + '<div class="facet-scatterplot-message" bind="messageDiv">'+$.i18n('core-facets/loading')+'</div>' +
'<table width="100%"><tr>' + '<table width="100%"><tr>' +
'<td>' + '<td>' +
'<div class="facet-scatterplot-plot-container">' + '<div class="facet-scatterplot-plot-container">' +
@ -114,20 +114,20 @@ ScatterplotFacet.prototype._initializeUI = function() {
'<td class="facet-scatterplot-selectors-container" width="100%">' + '<td class="facet-scatterplot-selectors-container" width="100%">' +
'<div class="scatterplot-selectors" bind="selectors">' + '<div class="scatterplot-selectors" bind="selectors">' +
'<div class="buttonset scatterplot-dim-selector">' + '<div class="buttonset scatterplot-dim-selector">' +
'<input type="radio" id="' + facet_id + '-dim-lin" name="' + facet_id + '-dim" value="lin"/><label class="dim-lin-label" for="' + facet_id + '-dim-lin" title="'+$.i18n._('core-facets/linear-plot')+'">'+$.i18n._('core-facets/linear-plot-abbr')+'</label>' + '<input type="radio" id="' + facet_id + '-dim-lin" name="' + facet_id + '-dim" value="lin"/><label class="dim-lin-label" for="' + facet_id + '-dim-lin" title="'+$.i18n('core-facets/linear-plot')+'">'+$.i18n('core-facets/linear-plot-abbr')+'</label>' +
'<input type="radio" id="' + facet_id + '-dim-log" name="' + facet_id + '-dim" value="log"/><label class="dim-log-label" for="' + facet_id + '-dim-log" title="'+$.i18n._('core-facets/logar-plot')+'">'+$.i18n._('core-facets/logar-plot-abbr')+'</label>' + '<input type="radio" id="' + facet_id + '-dim-log" name="' + facet_id + '-dim" value="log"/><label class="dim-log-label" for="' + facet_id + '-dim-log" title="'+$.i18n('core-facets/logar-plot')+'">'+$.i18n('core-facets/logar-plot-abbr')+'</label>' +
'</div>' + '</div>' +
'<div class="buttonset scatterplot-rot-selector">' + '<div class="buttonset scatterplot-rot-selector">' +
'<input type="radio" id="' + facet_id + '-rot-ccw" name="' + facet_id + '-rot" value="ccw"/><label class="rot-ccw-label" for="' + facet_id + '-rot-ccw" title="'+$.i18n._('core-facets/rotated-counter-clock')+'">&nbsp;</label>' + '<input type="radio" id="' + facet_id + '-rot-ccw" name="' + facet_id + '-rot" value="ccw"/><label class="rot-ccw-label" for="' + facet_id + '-rot-ccw" title="'+$.i18n('core-facets/rotated-counter-clock')+'">&nbsp;</label>' +
'<input type="radio" id="' + facet_id + '-rot-none" name="' + facet_id + '-rot" value="none"/><label class="rot-none-label" for="' + facet_id + '-rot-none" title="'+$.i18n._('core-facets/no-rotation')+'">&nbsp;</label>' + '<input type="radio" id="' + facet_id + '-rot-none" name="' + facet_id + '-rot" value="none"/><label class="rot-none-label" for="' + facet_id + '-rot-none" title="'+$.i18n('core-facets/no-rotation')+'">&nbsp;</label>' +
'<input type="radio" id="' + facet_id + '-rot-cw" name="' + facet_id + '-rot" value="cw"/><label class="rot-cw-label" for="' + facet_id + '-rot-cw" title="'+$.i18n._('core-facets/rotated-clock')+'">&nbsp;</label>' + '<input type="radio" id="' + facet_id + '-rot-cw" name="' + facet_id + '-rot" value="cw"/><label class="rot-cw-label" for="' + facet_id + '-rot-cw" title="'+$.i18n('core-facets/rotated-clock')+'">&nbsp;</label>' +
'</div>' + '</div>' +
'<div class="buttonset scatterplot-dot-selector">' + '<div class="buttonset scatterplot-dot-selector">' +
'<input type="radio" id="' + facet_id + '-dot-small" name="' + facet_id + '-dot" value="small"/><label class="dot-small-label" for="' + facet_id + '-dot-small" title="'+$.i18n._('core-facets/small-dot')+'">&nbsp;</label>' + '<input type="radio" id="' + facet_id + '-dot-small" name="' + facet_id + '-dot" value="small"/><label class="dot-small-label" for="' + facet_id + '-dot-small" title="'+$.i18n('core-facets/small-dot')+'">&nbsp;</label>' +
'<input type="radio" id="' + facet_id + '-dot-regular" name="' + facet_id + '-dot" value="regular"/><label class="dot-regular-label" for="' + facet_id + '-dot-regular" title="'+$.i18n._('core-facets/regular-dot')+'">&nbsp;</label>' + '<input type="radio" id="' + facet_id + '-dot-regular" name="' + facet_id + '-dot" value="regular"/><label class="dot-regular-label" for="' + facet_id + '-dot-regular" title="'+$.i18n('core-facets/regular-dot')+'">&nbsp;</label>' +
'<input type="radio" id="' + facet_id + '-dot-big" name="' + facet_id + '-dot" value="big"/><label class="dot-big-label" for="' + facet_id + '-dot-big" title="'+$.i18n._('core-facets/big-dot')+'">&nbsp;</label>' + '<input type="radio" id="' + facet_id + '-dot-big" name="' + facet_id + '-dot" value="big"/><label class="dot-big-label" for="' + facet_id + '-dot-big" title="'+$.i18n('core-facets/big-dot')+'">&nbsp;</label>' +
'</div>' + '</div>' +
'<div class="scatterplot-export-plot"><a bind="exportPlotLink" class="action" target="_blank">'+$.i18n._('core-facets/export-plot')+'</a></div>' + '<div class="scatterplot-export-plot"><a bind="exportPlotLink" class="action" target="_blank">'+$.i18n('core-facets/export-plot')+'</a></div>' +
'</div>' + '</div>' +
'</td>' + '</td>' +
'</tr></table>' + '</tr></table>' +
@ -279,7 +279,7 @@ ScatterplotFacet.prototype._formulateImageUrl = function(engineConfig, conf) {
ScatterplotFacet.prototype.updateState = function(data) { ScatterplotFacet.prototype.updateState = function(data) {
if ("error" in data) { if ("error" in data) {
this._error = true; this._error = true;
this._errorMessage = "error" in data ? data.error : $.i18n._('core-facets/unknown-error')+"."; this._errorMessage = "error" in data ? data.error : $.i18n('core-facets/unknown-error')+".";
} else { } else {
this._error = false; this._error = false;

View File

@ -90,10 +90,10 @@ TextSearchFacet.prototype._initializeUI = function() {
this._div.empty().show().html( this._div.empty().show().html(
'<div class="facet-title" bind="facetTitle">' + '<div class="facet-title" bind="facetTitle">' +
'<div class="grid-layout layout-tightest layout-full"><table><tr>' + '<div class="grid-layout layout-tightest layout-full"><table><tr>' +
'<td width="1%"><a href="javascript:{}" title="'+$.i18n._('core-facets/remove-facet')+'" class="facet-title-remove" bind="removeButton">&nbsp;</a></td>' + '<td width="1%"><a href="javascript:{}" title="'+$.i18n('core-facets/remove-facet')+'" class="facet-title-remove" bind="removeButton">&nbsp;</a></td>' +
'<td>' + '<td>' +
'<a href="javascript:{}" class="facet-choice-link" bind="resetButton">'+$.i18n._('core-facets/reset')+'</a>' + '<a href="javascript:{}" class="facet-choice-link" bind="resetButton">'+$.i18n('core-facets/reset')+'</a>' +
'<a href="javascript:{}" class="facet-choice-link" bind="invertButton">'+$.i18n._('core-facets/invert')+'</a>' + '<a href="javascript:{}" class="facet-choice-link" bind="invertButton">'+$.i18n('core-facets/invert')+'</a>' +
'<span bind="titleSpan"></span>' + '<span bind="titleSpan"></span>' +
'</td>' + '</td>' +
'</tr></table></div>' + '</tr></table></div>' +
@ -101,8 +101,8 @@ TextSearchFacet.prototype._initializeUI = function() {
'<div class="facet-text-body"><div class="grid-layout layout-tightest layout-full"><table>' + '<div class="facet-text-body"><div class="grid-layout layout-tightest layout-full"><table>' +
'<tr><td colspan="4"><div class="input-container"><input bind="input" /></div></td></tr>' + '<tr><td colspan="4"><div class="input-container"><input bind="input" /></div></td></tr>' +
'<tr>' + '<tr>' +
'<td width="1%"><input type="checkbox" bind="caseSensitiveCheckbox" id="caseSensitiveCheckbox" /></td><td><label for="caseSensitiveCheckbox">'+$.i18n._('core-facets/case-sensitive')+'</label></td>' + '<td width="1%"><input type="checkbox" bind="caseSensitiveCheckbox" id="caseSensitiveCheckbox" /></td><td><label for="caseSensitiveCheckbox">'+$.i18n('core-facets/case-sensitive')+'</label></td>' +
'<td width="1%"><input type="checkbox" bind="regexCheckbox" id="regexCheckbox" /></td><td><label for="regexCheckbox">'+$.i18n._('core-facets/regular-exp')+'</label></td>' + '<td width="1%"><input type="checkbox" bind="regexCheckbox" id="regexCheckbox" /></td><td><label for="regexCheckbox">'+$.i18n('core-facets/regular-exp')+'</label></td>' +
'</tr>' + '</tr>' +
'</table></div></div>' '</table></div></div>'
); );

View File

@ -133,17 +133,17 @@ TimeRangeFacet.prototype._initializeUI = function() {
.html( .html(
'<div class="facet-title" bind="headerDiv">' + '<div class="facet-title" bind="headerDiv">' +
'<div class="grid-layout layout-tightest layout-full"><table><tr>' + '<div class="grid-layout layout-tightest layout-full"><table><tr>' +
'<td width="1%"><a href="javascript:{}" title="'+$.i18n._('core-facets/remove-facet')+'" class="facet-title-remove" bind="removeButton">&nbsp;</a></td>' + '<td width="1%"><a href="javascript:{}" title="'+$.i18n('core-facets/remove-facet')+'" class="facet-title-remove" bind="removeButton">&nbsp;</a></td>' +
'<td>' + '<td>' +
'<a href="javascript:{}" class="facet-choice-link" bind="resetButton">'+$.i18n._('core-facets/reset')+'</a>' + '<a href="javascript:{}" class="facet-choice-link" bind="resetButton">'+$.i18n('core-facets/reset')+'</a>' +
'<a href="javascript:{}" class="facet-choice-link" bind="changeButton">'+$.i18n._('core-facets/change')+'</a>' + '<a href="javascript:{}" class="facet-choice-link" bind="changeButton">'+$.i18n('core-facets/change')+'</a>' +
'<span bind="facetTitle"></span>' + '<span bind="facetTitle"></span>' +
'</td>' + '</td>' +
'</tr></table></div>' + '</tr></table></div>' +
'</div>' + '</div>' +
'<div class="facet-expression" bind="expressionDiv" title="'+$.i18n._('core-facets/click-to-edit')+'"></div>' + '<div class="facet-expression" bind="expressionDiv" title="'+$.i18n('core-facets/click-to-edit')+'"></div>' +
'<div class="facet-range-body">' + '<div class="facet-range-body">' +
'<div class="facet-range-message" bind="messageDiv">'+$.i18n._('core-facets/loading')+'</div>' + '<div class="facet-range-message" bind="messageDiv">'+$.i18n('core-facets/loading')+'</div>' +
'<div class="facet-range-slider" bind="sliderWidgetDiv">' + '<div class="facet-range-slider" bind="sliderWidgetDiv">' +
'<div class="facet-range-histogram" bind="histogramDiv"></div>' + '<div class="facet-range-histogram" bind="histogramDiv"></div>' +
'</div>' + '</div>' +
@ -154,7 +154,7 @@ TimeRangeFacet.prototype._initializeUI = function() {
this._elmts = DOM.bind(this._div); this._elmts = DOM.bind(this._div);
this._elmts.facetTitle.text(this._config.name); this._elmts.facetTitle.text(this._config.name);
this._elmts.changeButton.attr("title",$.i18n._('core-facets/current-exp')+": " + this._config.expression).click(function() { this._elmts.changeButton.attr("title",$.i18n('core-facets/current-exp')+": " + this._config.expression).click(function() {
self._elmts.expressionDiv.slideToggle(100, function() { self._elmts.expressionDiv.slideToggle(100, function() {
if (self._elmts.expressionDiv.css("display") != "none") { if (self._elmts.expressionDiv.css("display") != "none") {
self._editExpression(); self._editExpression();
@ -210,7 +210,7 @@ TimeRangeFacet.prototype._renderOtherChoices = function() {
if (this._selectTime) timeCheck.attr("checked","checked"); if (this._selectTime) timeCheck.attr("checked","checked");
var timeLabel = $('<label>').attr("for", facet_id + "-time").appendTo(timeDiv); var timeLabel = $('<label>').attr("for", facet_id + "-time").appendTo(timeDiv);
$('<span>').text($.i18n._('core-facets/time')+" ").addClass("facet-range-choice-label").appendTo(timeLabel); $('<span>').text($.i18n('core-facets/time')+" ").addClass("facet-range-choice-label").appendTo(timeLabel);
$('<div>').text(this._timeCount).addClass("facet-range-choice-count").appendTo(timeLabel); $('<div>').text(this._timeCount).addClass("facet-range-choice-count").appendTo(timeLabel);
// ----------------- non-Time ----------------- // ----------------- non-Time -----------------
@ -223,7 +223,7 @@ TimeRangeFacet.prototype._renderOtherChoices = function() {
if (this._selectNonTime) nonTimeCheck.attr("checked","checked"); if (this._selectNonTime) nonTimeCheck.attr("checked","checked");
var nonTimeLabel = $('<label>').attr("for", facet_id + "-non-time").appendTo(nonTimeDiv); var nonTimeLabel = $('<label>').attr("for", facet_id + "-non-time").appendTo(nonTimeDiv);
$('<span>').text($.i18n._('core-facets/non-time')+" ").addClass("facet-range-choice-label").appendTo(nonTimeLabel); $('<span>').text($.i18n('core-facets/non-time')+" ").addClass("facet-range-choice-label").appendTo(nonTimeLabel);
$('<div>').text(this._nonTimeCount).addClass("facet-range-choice-count").appendTo(nonTimeLabel); $('<div>').text(this._nonTimeCount).addClass("facet-range-choice-count").appendTo(nonTimeLabel);
if (this._baseNonTimeCount === 0) nonTimeCheck.removeAttr("checked"); if (this._baseNonTimeCount === 0) nonTimeCheck.removeAttr("checked");
@ -238,7 +238,7 @@ TimeRangeFacet.prototype._renderOtherChoices = function() {
if (this._selectBlank) blankCheck.attr("checked","checked"); if (this._selectBlank) blankCheck.attr("checked","checked");
var blankLabel = $('<label>').attr("for", facet_id + "-blank").appendTo(blankDiv); var blankLabel = $('<label>').attr("for", facet_id + "-blank").appendTo(blankDiv);
$('<span>').text($.i18n._('core-facets/blank')+" ").addClass("facet-range-choice-label").appendTo(blankLabel); $('<span>').text($.i18n('core-facets/blank')+" ").addClass("facet-range-choice-label").appendTo(blankLabel);
$('<div>').text(this._blankCount).addClass("facet-range-choice-count").appendTo(blankLabel); $('<div>').text(this._blankCount).addClass("facet-range-choice-count").appendTo(blankLabel);
if (this._baseBlankCount === 0) blankCheck.removeAttr("checked"); if (this._baseBlankCount === 0) blankCheck.removeAttr("checked");
@ -253,7 +253,7 @@ TimeRangeFacet.prototype._renderOtherChoices = function() {
if (this._selectError) errorCheck.attr("checked","checked"); if (this._selectError) errorCheck.attr("checked","checked");
var errorLabel = $('<label>').attr("for", facet_id + "-error").appendTo(errorDiv); var errorLabel = $('<label>').attr("for", facet_id + "-error").appendTo(errorDiv);
$('<span>').text($.i18n._('core-facets/error')+" ").addClass("facet-range-choice-label").appendTo(errorLabel); $('<span>').text($.i18n('core-facets/error')+" ").addClass("facet-range-choice-label").appendTo(errorLabel);
$('<div>').text(this._errorCount).addClass("facet-range-choice-count").appendTo(errorLabel); $('<div>').text(this._errorCount).addClass("facet-range-choice-count").appendTo(errorLabel);
if (this._baseErrorCount === 0) errorCheck.removeAttr("checked"); if (this._baseErrorCount === 0) errorCheck.removeAttr("checked");
@ -342,7 +342,7 @@ TimeRangeFacet.prototype.updateState = function(data) {
this._errorCount = data.errorCount; this._errorCount = data.errorCount;
} else { } else {
this._error = true; this._error = true;
this._errorMessage = "error" in data ? data.error : $.i18n._('core-facets/unknown-error')+"."; this._errorMessage = "error" in data ? data.error : $.i18n('core-facets/unknown-error')+".";
} }
this.render(); this.render();
@ -402,8 +402,8 @@ TimeRangeFacet.prototype._updateRest = function() {
TimeRangeFacet.prototype._editExpression = function() { TimeRangeFacet.prototype._editExpression = function() {
var self = this; var self = this;
var title = (this._config.columnName) ? var title = (this._config.columnName) ?
($.i18n._('core-facets/edit-based-col')+" " + this._config.columnName) : ($.i18n('core-facets/edit-based-col')+" " + this._config.columnName) :
$.i18n._('core-facets/edit-facet-exp'); $.i18n('core-facets/edit-facet-exp');
var column = Refine.columnNameToColumn(this._config.columnName); var column = Refine.columnNameToColumn(this._config.columnName);
var o = DataTableView.sampleVisibleRows(column); var o = DataTableView.sampleVisibleRows(column);

View File

@ -48,10 +48,12 @@ $.ajax({
// lang : lang // lang : lang
}, },
success : function(data) { success : function(data) {
dictionary = data; dictionary = data['dictionary'];
lang = data['lang'];
} }
}); });
$.i18n.setDictionary(dictionary); $.i18n().load(dictionary, lang);
$.i18n({ locale: lang });
// End internationalization // End internationalization
Refine.selectActionArea = function(id) { Refine.selectActionArea = function(id) {
@ -100,7 +102,7 @@ $(function() {
function(data) { function(data) {
OpenRefineVersion = data; OpenRefineVersion = data;
$("#openrefine-version").text($.i18n._('core-index/version')+" " + OpenRefineVersion.full_version); $("#openrefine-version").text($.i18n('core-index/version')+" " + OpenRefineVersion.full_version);
$.getJSON("https://api.github.com/repos/openrefine/openrefine/releases/latest", $.getJSON("https://api.github.com/repos/openrefine/openrefine/releases/latest",
@ -118,13 +120,13 @@ $(function() {
var container = $('<div id="notification-container">') var container = $('<div id="notification-container">')
.appendTo(document.body); .appendTo(document.body);
var notification = $('<div id="notification">') var notification = $('<div id="notification">')
.text($.i18n._('core-index/new-version')+' ') .text($.i18n('core-index/new-version')+' ')
.appendTo(container); .appendTo(container);
$('<a>') $('<a>')
.addClass('notification-action') .addClass('notification-action')
.attr("href", latestVersionUrl) .attr("href", latestVersionUrl)
.attr("target", "_blank") .attr("target", "_blank")
.text($.i18n._('core-index/download')+' ' + latestVersionName + ' '+$.i18n._('core-index/now')+'.') .text($.i18n('core-index/download')+' ' + latestVersionName + ' '+$.i18n('core-index/now')+'.')
.appendTo(notification); .appendTo(notification);
} }
}); });
@ -201,13 +203,13 @@ $(function() {
} }
Refine.selectActionArea('create-project'); Refine.selectActionArea('create-project');
$("#slogan").text($.i18n._('core-index/slogan')+"."); $("#slogan").text($.i18n('core-index/slogan')+".");
$("#or-index-pref").text($.i18n._('core-index/preferences')); $("#or-index-pref").text($.i18n('core-index/preferences'));
$("#or-index-help").text($.i18n._('core-index/help')); $("#or-index-help").text($.i18n('core-index/help'));
$("#or-index-about").text($.i18n._('core-index/about')); $("#or-index-about").text($.i18n('core-index/about'));
$("#or-index-noProj").text($.i18n._('core-index/no-proj')+"."); $("#or-index-noProj").text($.i18n('core-index/no-proj')+".");
$("#or-index-try").text($.i18n._('core-index/try-these')); $("#or-index-try").text($.i18n('core-index/try-these'));
$("#or-index-sample").text($.i18n._('core-index/sample-data')); $("#or-index-sample").text($.i18n('core-index/sample-data'));
showVersion(); showVersion();
}); });

View File

@ -49,12 +49,12 @@ Refine.CreateProjectUI = function(elmt) {
this._errorPanel = this.addCustomPanel(); this._errorPanel = this.addCustomPanel();
this._errorPanel.html(DOM.loadHTML("core", "scripts/index/create-project-error-panel.html")); this._errorPanel.html(DOM.loadHTML("core", "scripts/index/create-project-error-panel.html"));
$('#or-create-question').text($.i18n._('core-index-create/question')); $('#or-create-question').text($.i18n('core-index-create/question'));
$('#or-create-formats').text($.i18n._('core-index-create/formats')); $('#or-create-formats').text($.i18n('core-index-create/formats'));
$('#or-create-from').text($.i18n._('core-index-create/from')); $('#or-create-from').text($.i18n('core-index-create/from'));
$('#create-project-progress-cancel-button').text($.i18n._('core-buttons/cancel')); $('#create-project-progress-cancel-button').text($.i18n('core-buttons/cancel'));
$('#create-project-error-ok-button').html($.i18n._('core-buttons/ok')); $('#create-project-error-ok-button').html($.i18n('core-buttons/ok'));
$.post( $.post(
"command/core/get-importing-configuration", "command/core/get-importing-configuration",
@ -162,7 +162,7 @@ Refine.CreateProjectUI.prototype.showSourceSelectionPanel = function() {
Refine.actionAreas.push({ Refine.actionAreas.push({
id: "create-project", id: "create-project",
label: $.i18n._('core-index-create/create-proj'), label: $.i18n('core-index-create/create-proj'),
uiClass: Refine.CreateProjectUI uiClass: Refine.CreateProjectUI
}); });
@ -173,7 +173,7 @@ Refine.CreateProjectUI.prototype.showImportProgressPanel = function(progressMess
$('#create-project-progress-message').text(progressMessage); $('#create-project-progress-message').text(progressMessage);
$('#create-project-progress-bar-body').css("width", "0%"); $('#create-project-progress-bar-body').css("width", "0%");
$('#create-project-progress-message-left').text($.i18n._('core-index-create/starting')); $('#create-project-progress-message-left').text($.i18n('core-index-create/starting'));
$('#create-project-progress-message-center').empty(); $('#create-project-progress-message-center').empty();
$('#create-project-progress-message-right').empty(); $('#create-project-progress-message-right').empty();
$('#create-project-progress-timing').empty(); $('#create-project-progress-timing').empty();
@ -203,7 +203,7 @@ Refine.CreateProjectUI.prototype.pollImportJob = function(start, jobID, timerID,
onError(job); onError(job);
} else if (checkDone(job)) { } else if (checkDone(job)) {
$('#create-project-progress-message').text($.i18n._('core-index-create/done')); $('#create-project-progress-message').text($.i18n('core-index-create/done'));
window.clearInterval(timerID); window.clearInterval(timerID);
if (callback) { if (callback) {
@ -222,13 +222,13 @@ Refine.CreateProjectUI.prototype.pollImportJob = function(start, jobID, timerID,
if (secondsRemaining > 1) { if (secondsRemaining > 1) {
if (secondsRemaining > 60) { if (secondsRemaining > 60) {
$('#create-project-progress-timing').text( $('#create-project-progress-timing').text(
Math.ceil(secondsRemaining / 60) + " "+$.i18n._('core-index-create/min-remaining')); Math.ceil(secondsRemaining / 60) + " "+$.i18n('core-index-create/min-remaining'));
} else { } else {
$('#create-project-progress-timing').text( $('#create-project-progress-timing').text(
Math.ceil(secondsRemaining) + " "+$.i18n._('core-index-create/sec-remaining')); Math.ceil(secondsRemaining) + " "+$.i18n('core-index-create/sec-remaining'));
} }
} else { } else {
$('#create-project-progress-timing').text($.i18n._('core-index-create/almost-done')); $('#create-project-progress-timing').text($.i18n('core-index-create/almost-done'));
} }
} else { } else {
$('#create-project-progress-bar-body').addClass('indefinite'); $('#create-project-progress-bar-body').addClass('indefinite');
@ -237,7 +237,7 @@ Refine.CreateProjectUI.prototype.pollImportJob = function(start, jobID, timerID,
$('#create-project-progress-message').text(progress.message); $('#create-project-progress-message').text(progress.message);
if ('memory' in progress) { if ('memory' in progress) {
var percent = progress.memory * 100.0 / progress.maxmemory; var percent = progress.memory * 100.0 / progress.maxmemory;
$('#create-project-progress-memory').text($.i18n._('core-index-create/memory-usage')+" "+percent.toFixed()+'% ('+progress.memory+'/'+progress.maxmemory+"MB)"); $('#create-project-progress-memory').text($.i18n('core-index-create/memory-usage')+" "+percent.toFixed()+'% ('+progress.memory+'/'+progress.maxmemory+"MB)");
if (percent > 90) { if (percent > 90) {
$('#create-project-progress-memory').addClass('warning'); $('#create-project-progress-memory').addClass('warning');
} else { } else {
@ -254,7 +254,7 @@ Refine.CreateProjectUI.prototype.showImportJobError = function(message, stack) {
var self = this; var self = this;
$('#create-project-error-message').text(message); $('#create-project-error-message').text(message);
$('#create-project-error-stack').text(stack || $.i18n._('core-index-create/no-details')); $('#create-project-error-stack').text(stack || $.i18n('core-index-create/no-details'));
this.showCustomPanel(this._errorPanel); this.showCustomPanel(this._errorPanel);
$('#create-project-error-ok-button').unbind().click(function() { $('#create-project-error-ok-button').unbind().click(function() {

View File

@ -179,7 +179,7 @@ Refine.DefaultImportingController.prototype._prepareData = function() {
Refine.DefaultImportingController.prototype._ensureFormatParserUIHasInitializationData = function(format, onDone) { Refine.DefaultImportingController.prototype._ensureFormatParserUIHasInitializationData = function(format, onDone) {
if (!(format in this._parserOptions)) { if (!(format in this._parserOptions)) {
var self = this; var self = this;
var dismissBusy = DialogSystem.showBusy($.i18n._('core-index-import/inspecting')); var dismissBusy = DialogSystem.showBusy($.i18n('core-index-import/inspecting'));
$.post( $.post(
"command/core/importing-controller?" + $.param({ "command/core/importing-controller?" + $.param({
"controller": "core/default-importing-controller", "controller": "core/default-importing-controller",
@ -200,7 +200,7 @@ Refine.DefaultImportingController.prototype._ensureFormatParserUIHasInitializati
) )
.fail(function() { .fail(function() {
dismissBusy(); dismissBusy();
alert($.i18n._('core-views/check-format')); alert($.i18n('core-views/check-format'));
}); });
} else { } else {
onDone(); onDone();
@ -273,7 +273,7 @@ Refine.DefaultImportingController.prototype._createProject = function() {
if ((this._formatParserUI) && this._formatParserUI.confirmReadyToCreateProject()) { if ((this._formatParserUI) && this._formatParserUI.confirmReadyToCreateProject()) {
var projectName = $.trim(this._parsingPanelElmts.projectNameInput[0].value); var projectName = $.trim(this._parsingPanelElmts.projectNameInput[0].value);
if (projectName.length === 0) { if (projectName.length === 0) {
window.alert($.i18n._('core-index-import/warning-name')); window.alert($.i18n('core-index-import/warning-name'));
this._parsingPanelElmts.projectNameInput.focus(); this._parsingPanelElmts.projectNameInput.focus();
return; return;
} }
@ -315,14 +315,14 @@ Refine.DefaultImportingController.prototype._createProject = function() {
document.location = "project?project=" + job.config.projectID; document.location = "project?project=" + job.config.projectID;
}, },
function(job) { function(job) {
alert($.i18n._('core-index-import/errors')+'\n' + Refine.CreateProjectUI.composeErrorMessage(job)); alert($.i18n('core-index-import/errors')+'\n' + Refine.CreateProjectUI.composeErrorMessage(job));
self._onImportJobReady(); self._onImportJobReady();
} }
); );
}, },
1000 1000
); );
self._createProjectUI.showImportProgressPanel($.i18n._('core-index-import/creating-proj'), function() { self._createProjectUI.showImportProgressPanel($.i18n('core-index-import/creating-proj'), function() {
// stop the timed polling // stop the timed polling
window.clearInterval(timerID); window.clearInterval(timerID);

View File

@ -59,17 +59,17 @@ Refine.DefaultImportingController.prototype._prepareFileSelectionPanel = functio
this._fileSelectionPanelElmts = DOM.bind(this._fileSelectionPanel); this._fileSelectionPanelElmts = DOM.bind(this._fileSelectionPanel);
$('#or-import-select').text($.i18n._('core-index-import/select-file')); $('#or-import-select').text($.i18n('core-index-import/select-file'));
$('#or-import-severalFile').text($.i18n._('core-index-import/several-file')); $('#or-import-severalFile').text($.i18n('core-index-import/several-file'));
$('#or-import-selExt').text($.i18n._('core-index-import/sel-by-extension')); $('#or-import-selExt').text($.i18n('core-index-import/sel-by-extension'));
$('#or-import-regex').text($.i18n._('core-index-import/sel-by-regex')); $('#or-import-regex').text($.i18n('core-index-import/sel-by-regex'));
this._fileSelectionPanelElmts.startOverButton.html($.i18n._('core-buttons/startover')); this._fileSelectionPanelElmts.startOverButton.html($.i18n('core-buttons/startover'));
this._fileSelectionPanelElmts.nextButton.html($.i18n._('core-buttons/conf-pars-opt')); this._fileSelectionPanelElmts.nextButton.html($.i18n('core-buttons/conf-pars-opt'));
this._fileSelectionPanelElmts.selectAllButton.text($.i18n._('core-buttons/select-all')); this._fileSelectionPanelElmts.selectAllButton.text($.i18n('core-buttons/select-all'));
this._fileSelectionPanelElmts.unselectAllButton.text($.i18n._('core-buttons/unselect-all')); this._fileSelectionPanelElmts.unselectAllButton.text($.i18n('core-buttons/unselect-all'));
this._fileSelectionPanelElmts.selectRegexButton.text($.i18n._('core-buttons/select')); this._fileSelectionPanelElmts.selectRegexButton.text($.i18n('core-buttons/select'));
this._fileSelectionPanelElmts.unselectRegexButton.text($.i18n._('core-buttons/unselect')); this._fileSelectionPanelElmts.unselectRegexButton.text($.i18n('core-buttons/unselect'));
this._fileSelectionPanelElmts.startOverButton.click(function() { this._fileSelectionPanelElmts.startOverButton.click(function() {
self._startOver(); self._startOver();
@ -110,7 +110,7 @@ Refine.DefaultImportingController.prototype._renderFileSelectionPanelFileTable =
this._fileSelectionPanelElmts.filePanel.empty(); this._fileSelectionPanelElmts.filePanel.empty();
var fileTable = $('<table><tr><th>'+$.i18n._('core-index-import/import')+'</th><th>'+$.i18n._('core-index-import/name')+'</th><th>'+$.i18n._('core-index-import/mime-type')+'</th><th>'+$.i18n._('core-index-import/format')+'</th><th>'+$.i18n._('core-index-import/size')+'</th></tr></table>') var fileTable = $('<table><tr><th>'+$.i18n('core-index-import/import')+'</th><th>'+$.i18n('core-index-import/name')+'</th><th>'+$.i18n('core-index-import/mime-type')+'</th><th>'+$.i18n('core-index-import/format')+'</th><th>'+$.i18n('core-index-import/size')+'</th></tr></table>')
.appendTo(this._fileSelectionPanelElmts.filePanel)[0]; .appendTo(this._fileSelectionPanelElmts.filePanel)[0];
var round = function(n) { var round = function(n) {
@ -204,7 +204,7 @@ Refine.DefaultImportingController.prototype._renderFileSelectionPanelControlPane
$('<td>').text(extension.extension).appendTo(tr); $('<td>').text(extension.extension).appendTo(tr);
$('<td>').text(extension.count + (extension.count > 1 ? " files" : " file")).appendTo(tr); $('<td>').text(extension.count + (extension.count > 1 ? " files" : " file")).appendTo(tr);
$('<button>') $('<button>')
.text($.i18n._('core-buttons/select')) .text($.i18n('core-buttons/select'))
.addClass("button") .addClass("button")
.appendTo($('<td>').appendTo(tr)) .appendTo($('<td>').appendTo(tr))
.click(function() { .click(function() {
@ -222,7 +222,7 @@ Refine.DefaultImportingController.prototype._renderFileSelectionPanelControlPane
self._updateFileSelectionSummary(); self._updateFileSelectionSummary();
}); });
$('<button>') $('<button>')
.text($.i18n._('core-buttons/unselect')) .text($.i18n('core-buttons/unselect'))
.addClass("button") .addClass("button")
.appendTo($('<td>').appendTo(tr)) .appendTo($('<td>').appendTo(tr))
.click(function() { .click(function() {
@ -329,7 +329,7 @@ Refine.DefaultImportingController.prototype._commitFileSelection = function() {
} }
var self = this; var self = this;
var dismissBusy = DialogSystem.showBusy($.i18n._('core-index-import/inspecting-files')); var dismissBusy = DialogSystem.showBusy($.i18n('core-index-import/inspecting-files'));
$.post( $.post(
"command/core/importing-controller?" + $.param({ "command/core/importing-controller?" + $.param({
"controller": "core/default-importing-controller", "controller": "core/default-importing-controller",
@ -343,9 +343,9 @@ Refine.DefaultImportingController.prototype._commitFileSelection = function() {
dismissBusy(); dismissBusy();
if (!(data)) { if (!(data)) {
self._createProjectUI.showImportJobError($.i18n._('core-index-import/unknown-err')); self._createProjectUI.showImportJobError($.i18n('core-index-import/unknown-err'));
} else if (data.code == "error" || !("job" in data)) { } else if (data.code == "error" || !("job" in data)) {
self._createProjectUI.showImportJobError((data.message) ? ($.i18n._('core-index-import/error')+ ' ' + data.message) : $.i18n._('core-index-import/unknown-err')); self._createProjectUI.showImportJobError((data.message) ? ($.i18n('core-index-import/error')+ ' ' + data.message) : $.i18n('core-index-import/unknown-err'));
} else { } else {
// Different files might be selected. We start over again. // Different files might be selected. We start over again.
delete this._parserOptions; delete this._parserOptions;

View File

@ -92,13 +92,13 @@ Refine.DefaultImportingController.prototype._prepareParsingPanel = function() {
}); });
this._parsingPanelElmts.progressPanel.hide(); this._parsingPanelElmts.progressPanel.hide();
this._parsingPanelElmts.startOverButton.html($.i18n._('core-buttons/startover')); this._parsingPanelElmts.startOverButton.html($.i18n('core-buttons/startover'));
this._parsingPanelElmts.nextButton.html($.i18n._('core-buttons/create-project')); this._parsingPanelElmts.nextButton.html($.i18n('core-buttons/create-project'));
$('#or-import-parsopt').text($.i18n._('core-index-import/parsing-options')); $('#or-import-parsopt').text($.i18n('core-index-import/parsing-options'));
$('#or-import-projname').html($.i18n._('core-index-import/project-name')); $('#or-import-projname').html($.i18n('core-index-import/project-name'));
$('#or-import-projtags').html($.i18n._('core-index-import/project-tags')); $('#or-import-projtags').html($.i18n('core-index-import/project-tags'));
$('#or-import-updating').text($.i18n._('core-index-import/updating-preview')); $('#or-import-updating').text($.i18n('core-index-import/updating-preview'));
$('#or-import-parseas').text($.i18n._('core-index-import/parse-as')); $('#or-import-parseas').text($.i18n('core-index-import/parse-as'));
//tags dropdown //tags dropdown
$("#tagsInput").select2({ $("#tagsInput").select2({

View File

@ -35,7 +35,7 @@ function ThisComputerImportingSourceUI(controller) {
this._controller = controller; this._controller = controller;
} }
Refine.DefaultImportingController.sources.push({ Refine.DefaultImportingController.sources.push({
"label": $.i18n._('core-index-import/this-computer'), "label": $.i18n('core-index-import/this-computer'),
"id": "upload", "id": "upload",
"uiClass": ThisComputerImportingSourceUI "uiClass": ThisComputerImportingSourceUI
}); });
@ -47,14 +47,14 @@ ThisComputerImportingSourceUI.prototype.attachUI = function(bodyDiv) {
this._elmts = DOM.bind(bodyDiv); this._elmts = DOM.bind(bodyDiv);
$('#or-import-locate-files').text($.i18n._('core-index-import/locate-files')); $('#or-import-locate-files').text($.i18n('core-index-import/locate-files'));
this._elmts.nextButton.html($.i18n._('core-buttons/next')); this._elmts.nextButton.html($.i18n('core-buttons/next'));
this._elmts.nextButton.click(function(evt) { this._elmts.nextButton.click(function(evt) {
if (self._elmts.fileInput[0].files.length === 0) { if (self._elmts.fileInput[0].files.length === 0) {
window.alert($.i18n._('core-index-import/warning-data-file')); window.alert($.i18n('core-index-import/warning-data-file'));
} else { } else {
self._controller.startImportJob(self._elmts.form, $.i18n._('core-index-import/uploading-data')); self._controller.startImportJob(self._elmts.form, $.i18n('core-index-import/uploading-data'));
} }
}); });
}; };
@ -66,7 +66,7 @@ function UrlImportingSourceUI(controller) {
this._controller = controller; this._controller = controller;
} }
Refine.DefaultImportingController.sources.push({ Refine.DefaultImportingController.sources.push({
"label": $.i18n._('core-index-import/web-address'), "label": $.i18n('core-index-import/web-address'),
"id": "download", "id": "download",
"uiClass": UrlImportingSourceUI "uiClass": UrlImportingSourceUI
}); });
@ -78,15 +78,15 @@ UrlImportingSourceUI.prototype.attachUI = function(bodyDiv) {
this._elmts = DOM.bind(bodyDiv); this._elmts = DOM.bind(bodyDiv);
$('#or-import-enterurl').text($.i18n._('core-index-import/enter-url')); $('#or-import-enterurl').text($.i18n('core-index-import/enter-url'));
this._elmts.addButton.html($.i18n._('core-buttons/add-url')); this._elmts.addButton.html($.i18n('core-buttons/add-url'));
this._elmts.nextButton.html($.i18n._('core-buttons/next')); this._elmts.nextButton.html($.i18n('core-buttons/next'));
this._elmts.nextButton.click(function(evt) { this._elmts.nextButton.click(function(evt) {
if ($.trim(self._elmts.urlInput[0].value).length === 0) { if ($.trim(self._elmts.urlInput[0].value).length === 0) {
window.alert($.i18n._('core-index-import/warning-web-address')); window.alert($.i18n('core-index-import/warning-web-address'));
} else { } else {
self._controller.startImportJob(self._elmts.form, $.i18n._('core-index-import/downloading-data')); self._controller.startImportJob(self._elmts.form, $.i18n('core-index-import/downloading-data'));
} }
}); });
this._elmts.addButton.click(function(evt) { this._elmts.addButton.click(function(evt) {
@ -102,7 +102,7 @@ function ClipboardImportingSourceUI(controller) {
this._controller = controller; this._controller = controller;
} }
Refine.DefaultImportingController.sources.push({ Refine.DefaultImportingController.sources.push({
"label": $.i18n._('core-index-import/clipboard'), "label": $.i18n('core-index-import/clipboard'),
"id": "clipboard", "id": "clipboard",
"uiClass": ClipboardImportingSourceUI "uiClass": ClipboardImportingSourceUI
}); });
@ -114,14 +114,14 @@ ClipboardImportingSourceUI.prototype.attachUI = function(bodyDiv) {
this._elmts = DOM.bind(bodyDiv); this._elmts = DOM.bind(bodyDiv);
$('#or-import-clipboard').text($.i18n._('core-index-import/clipboard-label')); $('#or-import-clipboard').text($.i18n('core-index-import/clipboard-label'));
this._elmts.nextButton.html($.i18n._('core-buttons/next')); this._elmts.nextButton.html($.i18n('core-buttons/next'));
this._elmts.nextButton.click(function(evt) { this._elmts.nextButton.click(function(evt) {
if ($.trim(self._elmts.textInput[0].value).length === 0) { if ($.trim(self._elmts.textInput[0].value).length === 0) {
window.alert($.i18n._('core-index-import/warning-clipboard')); window.alert($.i18n('core-index-import/warning-clipboard'));
} else { } else {
self._controller.startImportJob(self._elmts.form, $.i18n._('core-index-import/uploading-pasted-data')); self._controller.startImportJob(self._elmts.form, $.i18n('core-index-import/uploading-pasted-data'));
} }
}); });
}; };
@ -135,7 +135,7 @@ function DataPackageImportingSourceUI(controller) {
this._controller = controller; this._controller = controller;
} }
Refine.DefaultImportingController.sources.push({ Refine.DefaultImportingController.sources.push({
"label": $.i18n._('core-index-import/data-package'), "label": $.i18n('core-index-import/data-package'),
"id": "data-package", "id": "data-package",
"uiClass": DataPackageImportingSourceUI "uiClass": DataPackageImportingSourceUI
}); });
@ -147,14 +147,14 @@ function DataPackageImportingSourceUI(controller) {
this._elmts = DOM.bind(bodyDiv); this._elmts = DOM.bind(bodyDiv);
$('#or-import-enterurl').text($.i18n._('core-index-import/enter-url')); $('#or-import-enterurl').text($.i18n('core-index-import/enter-url'));
this._elmts.nextButton.html($.i18n._('core-buttons/next')); this._elmts.nextButton.html($.i18n('core-buttons/next'));
this._elmts.nextButton.click(function(evt) { this._elmts.nextButton.click(function(evt) {
if ($.trim(self._elmts.urlInput[0].value).length === 0) { if ($.trim(self._elmts.urlInput[0].value).length === 0) {
window.alert($.i18n._('core-index-import/warning-web-address')); window.alert($.i18n('core-index-import/warning-web-address'));
} else { } else {
self._controller.startImportJob(self._elmts.form, $.i18n._('core-index-import/data-package')); self._controller.startImportJob(self._elmts.form, $.i18n('core-index-import/data-package'));
} }
}); });
}; };

View File

@ -14,17 +14,17 @@ function EditMetadataDialog(metaData, targetRowElem) {
var td0 = tr.insertCell(0); var td0 = tr.insertCell(0);
var td1 = tr.insertCell(1); var td1 = tr.insertCell(1);
var keyLable = $.i18n._('core-index')[key] || key; var keyLable = $.i18n('core-index')[key] || key;
$(td1).text(keyLable); $(td1).text(keyLable);
var td2 = tr.insertCell(2); var td2 = tr.insertCell(2);
$(td2).text((value !== null) ? value : ""); $(td2).text((value !== null) ? value : "");
if(key==="tags"){ if(key==="tags"){
$('<button class="button">').text($.i18n._('core-index/edit')).appendTo(td0).click(function() { $('<button class="button">').text($.i18n('core-index/edit')).appendTo(td0).click(function() {
var oldTags = $(td1).text().replace("[","").replace("]",""); var oldTags = $(td1).text().replace("[","").replace("]","");
oldTags = replaceAll(oldTags,"\"",""); oldTags = replaceAll(oldTags,"\"","");
var newTags = window.prompt($.i18n._('core-index/change-metadata-value')+" " + key, $(td2).text()); var newTags = window.prompt($.i18n('core-index/change-metadata-value')+" " + key, $(td2).text());
newTags = newTags.replace("[","").replace("]",""); newTags = newTags.replace("[","").replace("]","");
newTags = replaceAll(newTags,"\"",""); newTags = replaceAll(newTags,"\"","");
if (newTags !== null) { if (newTags !== null) {
@ -52,8 +52,8 @@ function EditMetadataDialog(metaData, targetRowElem) {
key !== "importOptionMetadata" && key !== "importOptionMetadata" &&
key !== "id" && key !== "id" &&
key !== "tags") { key !== "tags") {
$('<button class="button">').text($.i18n._('core-index/edit')).appendTo(td0).click(function() { $('<button class="button">').text($.i18n('core-index/edit')).appendTo(td0).click(function() {
var newValue = window.prompt($.i18n._('core-index/change-metadata-value')+" " + key, value); var newValue = window.prompt($.i18n('core-index/change-metadata-value')+" " + key, value);
if (newValue !== null) { if (newValue !== null) {
$(td2).text(newValue); $(td2).text(newValue);
metaData[key] = newValue; metaData[key] = newValue;
@ -88,17 +88,17 @@ EditMetadataDialog.prototype._createDialog = function() {
this._elmts = DOM.bind(frame); this._elmts = DOM.bind(frame);
this._level = DialogSystem.showDialog(frame); this._level = DialogSystem.showDialog(frame);
this._elmts.closeButton.html($.i18n._('core-buttons/close')); this._elmts.closeButton.html($.i18n('core-buttons/close'));
this._elmts.closeButton.click(function() { self._dismiss();Refine.OpenProjectUI.prototype._addTagFilter()}); this._elmts.closeButton.click(function() { self._dismiss();Refine.OpenProjectUI.prototype._addTagFilter()});
var body = $("#metadata-body"); var body = $("#metadata-body");
$('<h1>').text($.i18n._('core-index/metaDatas')).appendTo(body); $('<h1>').text($.i18n('core-index/metaDatas')).appendTo(body);
var metadataTable = $("<table>") var metadataTable = $("<table>")
.addClass("list-table") .addClass("list-table")
.addClass("preferences") .addClass("preferences")
.html('<tr><th></th><th>'+$.i18n._('core-index/key')+'</th><th>'+$.i18n._('core-index/value')+'</th><th></th></tr>') .html('<tr><th></th><th>'+$.i18n('core-index/key')+'</th><th>'+$.i18n('core-index/value')+'</th><th></th></tr>')
.appendTo(body)[0]; .appendTo(body)[0];
var flattenObject = function(ob, key) { var flattenObject = function(ob, key) {

View File

@ -37,15 +37,15 @@ Refine.ImportProjectUI = function(elmt) {
this._elmt = elmt; this._elmt = elmt;
this._elmts = DOM.bind(elmt); this._elmts = DOM.bind(elmt);
$('#or-import-locate').text($.i18n._('core-index-import/locate')); $('#or-import-locate').text($.i18n('core-index-import/locate'));
$('#or-import-file').text($.i18n._('core-index-import/file')); $('#or-import-file').text($.i18n('core-index-import/file'));
$('#or-import-rename').text($.i18n._('core-index-import/rename')); $('#or-import-rename').text($.i18n('core-index-import/rename'));
$('#import-project-button').attr("value",$.i18n._('core-buttons/import-proj')); $('#import-project-button').attr("value",$.i18n('core-buttons/import-proj'));
}; };
Refine.actionAreas.push({ Refine.actionAreas.push({
id: "import-project", id: "import-project",
label: $.i18n._('core-index-import/import-proj'), label: $.i18n('core-index-import/import-proj'),
uiClass: Refine.ImportProjectUI uiClass: Refine.ImportProjectUI
}); });

View File

@ -6,8 +6,8 @@ Refine.SetLanguageUI = function(elmt) {
this._elmt = elmt; this._elmt = elmt;
this._elmts = DOM.bind(elmt); this._elmts = DOM.bind(elmt);
this._elmts.or_lang_label.text($.i18n._('core-index-lang/label')+":"); this._elmts.or_lang_label.text($.i18n('core-index-lang/label')+":");
this._elmts.set_lan_btn.attr("value", $.i18n._('core-index-lang/send-req')); this._elmts.set_lan_btn.attr("value", $.i18n('core-index-lang/send-req'));
$.ajax({ $.ajax({
@ -37,7 +37,7 @@ Refine.SetLanguageUI = function(elmt) {
value : $("#langDD option:selected").val() value : $("#langDD option:selected").val()
}, },
success : function(data) { success : function(data) {
alert($.i18n._('core-index-lang/page-reload')); alert($.i18n('core-index-lang/page-reload'));
location.reload(true); location.reload(true);
} }
}); });
@ -49,6 +49,6 @@ Refine.SetLanguageUI.prototype.resize = function() {
Refine.actionAreas.push({ Refine.actionAreas.push({
id : "lang-settings", id : "lang-settings",
label : $.i18n._('core-index-lang/lang-settings'), label : $.i18n('core-index-lang/lang-settings'),
uiClass : Refine.SetLanguageUI uiClass : Refine.SetLanguageUI
}); });

View File

@ -57,7 +57,7 @@ Refine.OpenProjectUI = function(elmt) {
return self._onClickUploadFileButton(evt); return self._onClickUploadFileButton(evt);
}); });
$('#projects-workspace-open').text($.i18n._('core-index-open/browse')); $('#projects-workspace-open').text($.i18n('core-index-open/browse'));
$('#projects-workspace-open').click(function() { $('#projects-workspace-open').click(function() {
$.ajax({ $.ajax({
type: "POST", type: "POST",
@ -190,12 +190,12 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
'<table class="tablesorter-blue list-table"><thead><tr>' + '<table class="tablesorter-blue list-table"><thead><tr>' +
'<th></th>' + '<th></th>' +
'<th></th>' + '<th></th>' +
'<th>'+$.i18n._('core-index-open/last-mod')+'</th>' + '<th>'+$.i18n('core-index-open/last-mod')+'</th>' +
'<th>'+$.i18n._('core-index-open/name')+'</th>' + '<th>'+$.i18n('core-index-open/name')+'</th>' +
'<th>'+$.i18n._('core-index-open/tags')+'</th>' + '<th>'+$.i18n('core-index-open/tags')+'</th>' +
'<th>'+$.i18n._('core-index-open/subject')+'</th>' + '<th>'+$.i18n('core-index-open/subject')+'</th>' +
'<th>'+$.i18n._('core-index-open/description')+'</th>' + '<th>'+$.i18n('core-index-open/description')+'</th>' +
'<th>'+$.i18n._('core-index-open/row-count')+'</th>' + '<th>'+$.i18n('core-index-open/row-count')+'</th>' +
(function() { (function() {
var htmlDisplay = ""; var htmlDisplay = "";
for (var n in data.customMetadataColumns) { for (var n in data.customMetadataColumns) {
@ -215,11 +215,11 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
var deleteLink = $('<a></a>') var deleteLink = $('<a></a>')
.addClass("delete-project") .addClass("delete-project")
.attr("title",$.i18n._('core-index-open/del-title')) .attr("title",$.i18n('core-index-open/del-title'))
.attr("href","") .attr("href","")
.html("<img src='images/close.png' />") .html("<img src='images/close.png' />")
.click(function() { .click(function() {
if (window.confirm($.i18n._('core-index-open/del-body') + project.name + "\"?")) { if (window.confirm($.i18n('core-index-open/del-body') + project.name + "\"?")) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "command/core/delete-project", url: "command/core/delete-project",
@ -240,7 +240,7 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
var metadataCell = $(tr.insertCell(tr.cells.length)); var metadataCell = $(tr.insertCell(tr.cells.length));
var editMetadataLink = $('<a></a>') var editMetadataLink = $('<a></a>')
.text($.i18n._('core-index-open/edit-meta-data')) .text($.i18n('core-index-open/edit-meta-data'))
.addClass("secondary") .addClass("secondary")
.attr("href", "javascript:{}") .attr("href", "javascript:{}")
.click(function() { .click(function() {
@ -265,7 +265,7 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
$("<span/>") $("<span/>")
.addClass("project-tag") .addClass("project-tag")
.text(tag) .text(tag)
.attr("title", $.i18n._('core-index-open/edit-tags')) .attr("title", $.i18n('core-index-open/edit-tags'))
.appendTo(tagsCell); .appendTo(tagsCell);
$(tr).addClass(tag); $(tr).addClass(tag);
}); });
@ -314,10 +314,10 @@ Refine.OpenProjectUI.prototype._onClickUploadFileButton = function(evt) {
var projectName = $("#project-name-input")[0].value; var projectName = $("#project-name-input")[0].value;
var dataURL = $.trim($("#project-url-input")[0].value); var dataURL = $.trim($("#project-url-input")[0].value);
if (! $.trim(projectName).length) { if (! $.trim(projectName).length) {
window.alert($.i18n._('core-index-open/warning-proj-name')); window.alert($.i18n('core-index-open/warning-proj-name'));
} else if ($("#project-file-input")[0].files.length === 0 && ! dataURL.length) { } else if ($("#project-file-input")[0].files.length === 0 && ! dataURL.length) {
window.alert($.i18n._('core-index-open/warning-data-file')); window.alert($.i18n('core-index-open/warning-data-file'));
} else { } else {
$("#file-upload-form").attr("action", $("#file-upload-form").attr("action",
@ -359,7 +359,7 @@ Refine.OpenProjectUI.refreshProject = function(tr, metaData, project) {
var tagsCell = $("<span/>") var tagsCell = $("<span/>")
.addClass("project-tag") .addClass("project-tag")
.text(tag) .text(tag)
.attr("title", $.i18n._('core-index-open/edit-tags')) .attr("title", $.i18n('core-index-open/edit-tags'))
.appendTo(tagCol); .appendTo(tagCol);
tagCol.parent().addClass(tag); tagCol.parent().addClass(tag);
}); });
@ -369,7 +369,7 @@ Refine.OpenProjectUI.refreshProject = function(tr, metaData, project) {
var tagsCell = $("<span/>") var tagsCell = $("<span/>")
.addClass("project-tag") .addClass("project-tag")
.text(tag) .text(tag)
.attr("title", $.i18n._('core-index-open/edit-tags')) .attr("title", $.i18n('core-index-open/edit-tags'))
.appendTo(tagCol); .appendTo(tagCol);
tagCol.parent().addClass(tag); tagCol.parent().addClass(tag);
}); });
@ -426,6 +426,6 @@ Refine.OpenProjectUI.refreshProject = function(tr, metaData, project) {
Refine.actionAreas.push({ Refine.actionAreas.push({
id: "open-project", id: "open-project",
label: $.i18n._('core-index-open/open-proj'), label: $.i18n('core-index-open/open-proj'),
uiClass: Refine.OpenProjectUI uiClass: Refine.OpenProjectUI
}); });

View File

@ -120,19 +120,19 @@ Refine.ExcelParserUI.prototype._initialize = function() {
this._optionContainerElmts = DOM.bind(this._optionContainer); this._optionContainerElmts = DOM.bind(this._optionContainer);
this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); }); this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); });
this._optionContainerElmts.previewButton.html($.i18n._('core-buttons/update-preview')); this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-import-worksheet').text($.i18n._('core-index-import/import-worksheet')); $('#or-import-worksheet').text($.i18n('core-index-import/import-worksheet'));
$('#or-import-ignore').text($.i18n._('core-index-parser/ignore-first')); $('#or-import-ignore').text($.i18n('core-index-parser/ignore-first'));
$('#or-import-lines').text($.i18n._('core-index-parser/lines-beg')); $('#or-import-lines').text($.i18n('core-index-parser/lines-beg'));
$('#or-import-parse').text($.i18n._('core-index-parser/parse-next')); $('#or-import-parse').text($.i18n('core-index-parser/parse-next'));
$('#or-import-header').text($.i18n._('core-index-parser/lines-header')); $('#or-import-header').text($.i18n('core-index-parser/lines-header'));
$('#or-import-discard').text($.i18n._('core-index-parser/discard-initial')); $('#or-import-discard').text($.i18n('core-index-parser/discard-initial'));
$('#or-import-rows').text($.i18n._('core-index-parser/rows-data')); $('#or-import-rows').text($.i18n('core-index-parser/rows-data'));
$('#or-import-load').text($.i18n._('core-index-parser/load-at-most')); $('#or-import-load').text($.i18n('core-index-parser/load-at-most'));
$('#or-import-rows2').text($.i18n._('core-index-parser/rows-data')); $('#or-import-rows2').text($.i18n('core-index-parser/rows-data'));
$('#or-import-blank').text($.i18n._('core-index-parser/store-blank')); $('#or-import-blank').text($.i18n('core-index-parser/store-blank'));
$('#or-import-null').text($.i18n._('core-index-parser/store-nulls')); $('#or-import-null').text($.i18n('core-index-parser/store-nulls'));
$('#or-import-source').html($.i18n._('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
var sheetTable = this._optionContainerElmts.sheetRecordContainer[0]; var sheetTable = this._optionContainerElmts.sheetRecordContainer[0];
$.each(this._config.sheetRecords, function(i, v) { $.each(this._config.sheetRecords, function(i, v) {

View File

@ -121,25 +121,25 @@ Refine.FixedWidthParserUI.prototype._initialize = function() {
this._optionContainerElmts = DOM.bind(this._optionContainer); this._optionContainerElmts = DOM.bind(this._optionContainer);
this._optionContainerElmts.previewButton.click(function() { self.updatePreview(); }); this._optionContainerElmts.previewButton.click(function() { self.updatePreview(); });
this._optionContainerElmts.previewButton.html($.i18n._('core-buttons/update-preview')); this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-import-encoding').html($.i18n._('core-index-import/char-encoding')); $('#or-import-encoding').html($.i18n('core-index-import/char-encoding'));
$('#or-import-columnWidth').text($.i18n._('core-index-import/column-widths')); $('#or-import-columnWidth').text($.i18n('core-index-import/column-widths'));
$('#or-import-columnNames').text($.i18n._('core-index-import/column-names')); $('#or-import-columnNames').text($.i18n('core-index-import/column-names'));
$('#or-import-comma').text($.i18n._('core-index-import/comma-separated')); $('#or-import-comma').text($.i18n('core-index-import/comma-separated'));
$('#or-import-optional').text($.i18n._('core-index-import/optional-separated')); $('#or-import-optional').text($.i18n('core-index-import/optional-separated'));
$('#or-import-ignore').text($.i18n._('core-index-parser/ignore-first')); $('#or-import-ignore').text($.i18n('core-index-parser/ignore-first'));
$('#or-import-lines').text($.i18n._('core-index-parser/lines-beg')); $('#or-import-lines').text($.i18n('core-index-parser/lines-beg'));
$('#or-import-parse').text($.i18n._('core-index-parser/parse-next')); $('#or-import-parse').text($.i18n('core-index-parser/parse-next'));
$('#or-import-header').text($.i18n._('core-index-parser/lines-header')); $('#or-import-header').text($.i18n('core-index-parser/lines-header'));
$('#or-import-discard').text($.i18n._('core-index-parser/discard-initial')); $('#or-import-discard').text($.i18n('core-index-parser/discard-initial'));
$('#or-import-rows').text($.i18n._('core-index-parser/rows-data')); $('#or-import-rows').text($.i18n('core-index-parser/rows-data'));
$('#or-import-load').text($.i18n._('core-index-parser/load-at-most')); $('#or-import-load').text($.i18n('core-index-parser/load-at-most'));
$('#or-import-rows2').text($.i18n._('core-index-parser/rows-data')); $('#or-import-rows2').text($.i18n('core-index-parser/rows-data'));
$('#or-import-parseCell').html($.i18n._('core-index-parser/parse-cell')); $('#or-import-parseCell').html($.i18n('core-index-parser/parse-cell'));
$('#or-import-blank').text($.i18n._('core-index-parser/store-blank')); $('#or-import-blank').text($.i18n('core-index-parser/store-blank'));
$('#or-import-null').text($.i18n._('core-index-parser/store-nulls')); $('#or-import-null').text($.i18n('core-index-parser/store-nulls'));
$('#or-import-source').html($.i18n._('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
this._optionContainerElmts.encodingInput this._optionContainerElmts.encodingInput
.attr('value', this._config.encoding || '') .attr('value', this._config.encoding || '')

View File

@ -61,7 +61,7 @@ Refine.JsonParserUI.prototype.confirmReadyToCreateProject = function() {
if ((this._config.recordPath) && this._config.recordPath.length > 0) { if ((this._config.recordPath) && this._config.recordPath.length > 0) {
return true; return true;
} else { } else {
window.alert($.i18n._('core-index-import/warning-record-path')); window.alert($.i18n('core-index-import/warning-record-path'));
} }
}; };
@ -107,15 +107,15 @@ Refine.JsonParserUI.prototype._initialize = function() {
this._optionContainerElmts = DOM.bind(this._optionContainer); this._optionContainerElmts = DOM.bind(this._optionContainer);
this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); }); this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); });
this._optionContainerElmts.pickRecordElementsButton.text($.i18n._('core-index-import/warning-record-path')); this._optionContainerElmts.pickRecordElementsButton.text($.i18n('core-index-import/warning-record-path'));
this._optionContainerElmts.previewButton.html($.i18n._('core-buttons/update-preview')); this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-import-load').text($.i18n._('core-index-parser/load-at-most')); $('#or-import-load').text($.i18n('core-index-parser/load-at-most'));
$('#or-import-rows').text($.i18n._('core-index-parser/rows-data')); $('#or-import-rows').text($.i18n('core-index-parser/rows-data'));
$('#or-import-preserve').text($.i18n._('core-index-parser/preserve-empty')); $('#or-import-preserve').text($.i18n('core-index-parser/preserve-empty'));
$('#or-import-trim').html($.i18n._('core-index-parser/trim')); $('#or-import-trim').html($.i18n('core-index-parser/trim'));
$('#or-import-parseCell').html($.i18n._('core-index-parser/parse-cell')); $('#or-import-parseCell').html($.i18n('core-index-parser/parse-cell'));
$('#or-import-source').html($.i18n._('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
$('#or-import-jsonParser').text($.i18n._('core-index-parser/json-parser')); $('#or-import-jsonParser').text($.i18n('core-index-parser/json-parser'));
if (this._config.limit > 0) { if (this._config.limit > 0) {
this._optionContainerElmts.limitCheckbox.prop("checked", true); this._optionContainerElmts.limitCheckbox.prop("checked", true);

View File

@ -110,21 +110,21 @@ Refine.LineBasedParserUI.prototype._initialize = function() {
this._optionContainerElmts = DOM.bind(this._optionContainer); this._optionContainerElmts = DOM.bind(this._optionContainer);
this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); }); this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); });
$('#or-import-encoding').html($.i18n._('core-index-import/char-encoding')); $('#or-import-encoding').html($.i18n('core-index-import/char-encoding'));
this._optionContainerElmts.previewButton.html($.i18n._('core-buttons/update-preview')); this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-import-parseEvery').html($.i18n._('core-index-parser/parse-every')); $('#or-import-parseEvery').html($.i18n('core-index-parser/parse-every'));
$('#or-impor-linesIntoRow').html($.i18n._('core-index-parser/lines-into-row')); $('#or-impor-linesIntoRow').html($.i18n('core-index-parser/lines-into-row'));
$('#or-import-blank').text($.i18n._('core-index-parser/store-blank')); $('#or-import-blank').text($.i18n('core-index-parser/store-blank'));
$('#or-import-null').text($.i18n._('core-index-parser/store-nulls')); $('#or-import-null').text($.i18n('core-index-parser/store-nulls'));
$('#or-import-source').html($.i18n._('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
$('#or-import-ignore').text($.i18n._('core-index-parser/ignore-first')); $('#or-import-ignore').text($.i18n('core-index-parser/ignore-first'));
$('#or-import-lines').text($.i18n._('core-index-parser/lines-beg')); $('#or-import-lines').text($.i18n('core-index-parser/lines-beg'));
$('#or-import-parse').text($.i18n._('core-index-parser/parse-next')); $('#or-import-parse').text($.i18n('core-index-parser/parse-next'));
$('#or-import-header').text($.i18n._('core-index-parser/lines-header')); $('#or-import-header').text($.i18n('core-index-parser/lines-header'));
$('#or-import-discard').text($.i18n._('core-index-parser/discard-initial')); $('#or-import-discard').text($.i18n('core-index-parser/discard-initial'));
$('#or-import-rows').text($.i18n._('core-index-parser/rows-data')); $('#or-import-rows').text($.i18n('core-index-parser/rows-data'));
$('#or-import-load').text($.i18n._('core-index-parser/load-at-most')); $('#or-import-load').text($.i18n('core-index-parser/load-at-most'));
$('#or-import-rows2').text($.i18n._('core-index-parser/rows-data')); $('#or-import-rows2').text($.i18n('core-index-parser/rows-data'));
this._optionContainerElmts.encodingInput this._optionContainerElmts.encodingInput
.attr('value', this._config.encoding || '') .attr('value', this._config.encoding || '')

View File

@ -76,8 +76,8 @@ Refine.RdfTriplesParserUI.prototype._initialize = function() {
this._optionContainerElmts = DOM.bind(this._optionContainer); this._optionContainerElmts = DOM.bind(this._optionContainer);
this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); }); this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); });
this._optionContainerElmts.previewButton.html($.i18n._('core-buttons/update-preview')); this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-import-encoding').html($.i18n._('core-index-import/char-encoding')); $('#or-import-encoding').html($.i18n('core-index-import/char-encoding'));
this._optionContainerElmts.encodingInput this._optionContainerElmts.encodingInput
.attr('value', this._config.encoding || '') .attr('value', this._config.encoding || '')

View File

@ -136,32 +136,32 @@ Refine.SeparatorBasedParserUI.prototype._initialize = function() {
this._optionContainerElmts = DOM.bind(this._optionContainer); this._optionContainerElmts = DOM.bind(this._optionContainer);
this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); }); this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); });
this._optionContainerElmts.previewButton.html($.i18n._('core-buttons/update-preview')); this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-import-encoding').html($.i18n._('core-index-import/char-encoding')); $('#or-import-encoding').html($.i18n('core-index-import/char-encoding'));
$('#or-import-colsep').html($.i18n._('core-index-parser/col-separated-by')); $('#or-import-colsep').html($.i18n('core-index-parser/col-separated-by'));
$('#or-import-commas').html($.i18n._('core-index-parser/commas')); $('#or-import-commas').html($.i18n('core-index-parser/commas'));
$('#or-import-tabs').html($.i18n._('core-index-parser/tabs')); $('#or-import-tabs').html($.i18n('core-index-parser/tabs'));
$('#or-import-custom').html($.i18n._('core-index-parser/custom')); $('#or-import-custom').html($.i18n('core-index-parser/custom'));
$('#or-import-escape').html($.i18n._('core-index-parser/escape')); $('#or-import-escape').html($.i18n('core-index-parser/escape'));
$('#or-import-columnNames').html($.i18n._('core-index-parser/column-names-label') + ':'); $('#or-import-columnNames').html($.i18n('core-index-parser/column-names-label') + ':');
$('#or-import-optional').html($.i18n._('core-index-parser/column-names-optional')); $('#or-import-optional').html($.i18n('core-index-parser/column-names-optional'));
self._optionContainerElmts.columnNamesInput.prop('disabled', true); self._optionContainerElmts.columnNamesInput.prop('disabled', true);
$('#or-import-ignore').text($.i18n._('core-index-parser/ignore-first')); $('#or-import-ignore').text($.i18n('core-index-parser/ignore-first'));
$('#or-import-lines').text($.i18n._('core-index-parser/lines-beg')); $('#or-import-lines').text($.i18n('core-index-parser/lines-beg'));
$('#or-import-parse').text($.i18n._('core-index-parser/parse-next')); $('#or-import-parse').text($.i18n('core-index-parser/parse-next'));
$('#or-import-header').text($.i18n._('core-index-parser/lines-header')); $('#or-import-header').text($.i18n('core-index-parser/lines-header'));
$('#or-import-discard').text($.i18n._('core-index-parser/discard-initial')); $('#or-import-discard').text($.i18n('core-index-parser/discard-initial'));
$('#or-import-rows').text($.i18n._('core-index-parser/rows-data')); $('#or-import-rows').text($.i18n('core-index-parser/rows-data'));
$('#or-import-load').text($.i18n._('core-index-parser/load-at-most')); $('#or-import-load').text($.i18n('core-index-parser/load-at-most'));
$('#or-import-rows2').text($.i18n._('core-index-parser/rows-data')); $('#or-import-rows2').text($.i18n('core-index-parser/rows-data'));
$('#or-import-parseCell').html($.i18n._('core-index-parser/parse-cell')); $('#or-import-parseCell').html($.i18n('core-index-parser/parse-cell'));
$('#or-import-quote').html($.i18n._('core-index-parser/use-quote')); $('#or-import-quote').html($.i18n('core-index-parser/use-quote'));
$('#or-import-quote-character').html($.i18n._('core-index-parser/quote-delimits-cells')); $('#or-import-quote-character').html($.i18n('core-index-parser/quote-delimits-cells'));
$('#or-import-blank').text($.i18n._('core-index-parser/store-blank')); $('#or-import-blank').text($.i18n('core-index-parser/store-blank'));
$('#or-import-null').text($.i18n._('core-index-parser/store-nulls')); $('#or-import-null').text($.i18n('core-index-parser/store-nulls'));
$('#or-import-source').html($.i18n._('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
this._optionContainerElmts.encodingInput this._optionContainerElmts.encodingInput
.attr('value', this._config.encoding || '') .attr('value', this._config.encoding || '')

View File

@ -114,20 +114,20 @@ Refine.WikitextParserUI.prototype._initialize = function() {
this._optionContainerElmts = DOM.bind(this._optionContainer); this._optionContainerElmts = DOM.bind(this._optionContainer);
this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); }); this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); });
this._optionContainerElmts.previewButton.html($.i18n._('core-buttons/update-preview')); this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-import-wiki-base-url').text($.i18n._('core-index-parser/wiki-base-url')); $('#or-import-wiki-base-url').text($.i18n('core-index-parser/wiki-base-url'));
$('#or-import-parse').text($.i18n._('core-index-parser/parse-next')); $('#or-import-parse').text($.i18n('core-index-parser/parse-next'));
$('#or-import-header').text($.i18n._('core-index-parser/lines-header')); $('#or-import-header').text($.i18n('core-index-parser/lines-header'));
$('#or-import-load').text($.i18n._('core-index-parser/load-at-most')); $('#or-import-load').text($.i18n('core-index-parser/load-at-most'));
$('#or-import-rows2').text($.i18n._('core-index-parser/rows-data')); $('#or-import-rows2').text($.i18n('core-index-parser/rows-data'));
$('#or-import-parseCell').html($.i18n._('core-index-parser/parse-cell')); $('#or-import-parseCell').html($.i18n('core-index-parser/parse-cell'));
$('#or-import-blankSpanningCells').text($.i18n._('core-index-parser/blank-spanning-cells')); $('#or-import-blankSpanningCells').text($.i18n('core-index-parser/blank-spanning-cells'));
$('#or-import-includeRawTemplates').text($.i18n._('core-index-parser/include-raw-templates')); $('#or-import-includeRawTemplates').text($.i18n('core-index-parser/include-raw-templates'));
$('#or-import-parseReferences').text($.i18n._('core-index-parser/parse-references')); $('#or-import-parseReferences').text($.i18n('core-index-parser/parse-references'));
$('#or-import-blank').text($.i18n._('core-index-parser/store-blank')); $('#or-import-blank').text($.i18n('core-index-parser/store-blank'));
$('#or-import-null').text($.i18n._('core-index-parser/store-nulls')); $('#or-import-null').text($.i18n('core-index-parser/store-nulls'));
$('#or-import-source').html($.i18n._('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
/* /*
this._optionContainerElmts.encodingInput this._optionContainerElmts.encodingInput
@ -214,7 +214,7 @@ Refine.WikitextParserUI.prototype._updatePreview = function() {
var container = self._dataContainer.unbind().empty(); var container = self._dataContainer.unbind().empty();
if (projectData.rowModel.rows.length === 0) { if (projectData.rowModel.rows.length === 0) {
$('<div>').addClass("wikitext-parser-ui-message") $('<div>').addClass("wikitext-parser-ui-message")
.text($.i18n._('core-index-parser/invalid-wikitext')).appendTo(container); .text($.i18n('core-index-parser/invalid-wikitext')).appendTo(container);
} else { } else {
new Refine.PreviewTable(projectData, container); new Refine.PreviewTable(projectData, container);
} }

View File

@ -61,7 +61,7 @@ Refine.XmlParserUI.prototype.confirmReadyToCreateProject = function() {
if ((this._config.recordPath) && this._config.recordPath.length > 0) { if ((this._config.recordPath) && this._config.recordPath.length > 0) {
return true; return true;
} else { } else {
window.alert($.i18n._('core-index-import/warning-record-path')); window.alert($.i18n('core-index-import/warning-record-path'));
} }
}; };
@ -105,14 +105,14 @@ Refine.XmlParserUI.prototype._initialize = function() {
this._optionContainerElmts = DOM.bind(this._optionContainer); this._optionContainerElmts = DOM.bind(this._optionContainer);
this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); }); this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); });
this._optionContainerElmts.pickRecordElementsButton.html($.i18n._('core-buttons/pick-record')); this._optionContainerElmts.pickRecordElementsButton.html($.i18n('core-buttons/pick-record'));
this._optionContainerElmts.previewButton.html($.i18n._('core-buttons/update-preview')); this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-import-rows').text($.i18n._('core-index-parser/rows-data')); $('#or-import-rows').text($.i18n('core-index-parser/rows-data'));
$('#or-import-load').text($.i18n._('core-index-parser/load-at-most')); $('#or-import-load').text($.i18n('core-index-parser/load-at-most'));
$('#or-import-preserve').text($.i18n._('core-index-parser/preserve-empty')); $('#or-import-preserve').text($.i18n('core-index-parser/preserve-empty'));
$('#or-import-trim').html($.i18n._('core-index-parser/trim')); $('#or-import-trim').html($.i18n('core-index-parser/trim'));
$('#or-import-parseCell').html($.i18n._('core-index-parser/parse-cell')); $('#or-import-parseCell').html($.i18n('core-index-parser/parse-cell'));
$('#or-import-store').html($.i18n._('core-index-parser/store-source')); $('#or-import-store').html($.i18n('core-index-parser/store-source'));
if (this._config.limit > 0) { if (this._config.limit > 0) {
this._optionContainerElmts.limitCheckbox.prop("checked", true); this._optionContainerElmts.limitCheckbox.prop("checked", true);
@ -147,7 +147,7 @@ Refine.XmlParserUI.prototype._showPickRecordElementsUI = function() {
this._dataContainer.unbind().empty().html( this._dataContainer.unbind().empty().html(
DOM.loadHTML("core", "scripts/index/parser-interfaces/xml-parser-select-ui.html")); DOM.loadHTML("core", "scripts/index/parser-interfaces/xml-parser-select-ui.html"));
$('#or-import-clickXML').text($.i18n._('core-index-parser/click-xml')); $('#or-import-clickXML').text($.i18n('core-index-parser/click-xml'));
var elmts = DOM.bind(this._dataContainer); var elmts = DOM.bind(this._dataContainer);

View File

@ -44,10 +44,11 @@ module : "core",
//lang : lang //lang : lang
}, },
success : function(data) { success : function(data) {
dictionary = data; dictionary = data['dictionary'];
lang = data['lang'];
} }
}); });
$.i18n.setDictionary(dictionary); $.i18n().load(dictionary, lang);
//End internationalization //End internationalization
function deDupUserMetaData(arrObj) { function deDupUserMetaData(arrObj) {
@ -69,8 +70,8 @@ function PreferenceUI(tr, key, value) {
var td2 = tr.insertCell(2); var td2 = tr.insertCell(2);
$('<button class="button">').text($.i18n._('core-index/edit')).appendTo(td2).click(function() { $('<button class="button">').text($.i18n('core-index/edit')).appendTo(td2).click(function() {
var newValue = window.prompt($.i18n._('core-index/change-value')+" " + key, value); var newValue = window.prompt($.i18n('core-index/change-value')+" " + key, value);
if (newValue !== null) { if (newValue !== null) {
if (key === "userMetadata") { if (key === "userMetadata") {
newValue = deDupUserMetaData(newValue); newValue = deDupUserMetaData(newValue);
@ -93,8 +94,8 @@ function PreferenceUI(tr, key, value) {
} }
}); });
$('<button class="button">').text($.i18n._('core-index/delete')).appendTo(td2).click(function() { $('<button class="button">').text($.i18n('core-index/delete')).appendTo(td2).click(function() {
if (window.confirm($.i18n._('core-index/delete-key')+" " + key + "?")) { if (window.confirm($.i18n('core-index/delete-key')+" " + key + "?")) {
$.post( $.post(
"command/core/set-preference", "command/core/set-preference",
{ {
@ -123,13 +124,13 @@ function PreferenceUI(tr, key, value) {
function populatePreferences(prefs) { function populatePreferences(prefs) {
var body = $("#body-info").empty(); var body = $("#body-info").empty();
$("#or-proj-starting").text($.i18n._('core-project/starting')+"..."); $("#or-proj-starting").text($.i18n('core-project/starting')+"...");
$('<h1>').text($.i18n._('core-index/preferences')).appendTo(body); $('<h1>').text($.i18n('core-index/preferences')).appendTo(body);
var table = $('<table>') var table = $('<table>')
.addClass("list-table") .addClass("list-table")
.addClass("preferences") .addClass("preferences")
.html('<tr><th>'+$.i18n._('core-index/key')+'</th><th>'+$.i18n._('core-index/value')+'</th><th></th></tr>') .html('<tr><th>'+$.i18n('core-index/key')+'</th><th>'+$.i18n('core-index/value')+'</th><th></th></tr>')
.appendTo(body)[0]; .appendTo(body)[0];
for (var k in prefs) { for (var k in prefs) {
@ -141,10 +142,10 @@ function populatePreferences(prefs) {
var tdLast0 = trLast.insertCell(0); var tdLast0 = trLast.insertCell(0);
trLast.insertCell(1); trLast.insertCell(1);
trLast.insertCell(2); trLast.insertCell(2);
$('<button class="button">').text($.i18n._('core-index/add-pref')).appendTo(tdLast0).click(function() { $('<button class="button">').text($.i18n('core-index/add-pref')).appendTo(tdLast0).click(function() {
var key = window.prompt($.i18n._('core-index/add-pref')); var key = window.prompt($.i18n('core-index/add-pref'));
if (key) { if (key) {
var value = window.prompt($.i18n._('core-index/pref-key')); var value = window.prompt($.i18n('core-index/pref-key'));
if (value !== null) { if (value !== null) {
var tr = table.insertRow(table.rows.length - 1); var tr = table.insertRow(table.rows.length - 1);
preferenceUIs.push(new PreferenceUI(tr, key, value)); preferenceUIs.push(new PreferenceUI(tr, key, value));

View File

@ -45,10 +45,12 @@ $.ajax({
// lang : lang // lang : lang
}, },
success : function(data) { success : function(data) {
dictionary = data; dictionary = data['dictionary'];
lang = data['lang'];
} }
}); });
$.i18n.setDictionary(dictionary); $.i18n().load(dictionary, lang);
$.i18n({ locale: lang });
// End internationalization // End internationalization
var Refine = { var Refine = {
@ -121,15 +123,15 @@ function initializeUI(uiState) {
$("#project-controls").show(); $("#project-controls").show();
$("#body").show(); $("#body").show();
$("#or-proj-open").text($.i18n._('core-project/open')+"..."); $("#or-proj-open").text($.i18n('core-project/open')+"...");
$("#project-permalink-button").text($.i18n._('core-project/permalink')); $("#project-permalink-button").text($.i18n('core-project/permalink'));
$("#project-name-button").attr("title",$.i18n._('core-project/proj-name')); $("#project-name-button").attr("title",$.i18n('core-project/proj-name'));
$("#or-proj-export").text($.i18n._('core-project/export')); $("#or-proj-export").text($.i18n('core-project/export'));
$("#or-proj-help").text($.i18n._('core-project/help')); $("#or-proj-help").text($.i18n('core-project/help'));
$("#or-proj-starting").text($.i18n._('core-project/starting')+"..."); $("#or-proj-starting").text($.i18n('core-project/starting')+"...");
$("#or-proj-facFil").text($.i18n._('core-project/facet-filter')); $("#or-proj-facFil").text($.i18n('core-project/facet-filter'));
$("#or-proj-undoRedo").text($.i18n._('core-project/undo-redo')); $("#or-proj-undoRedo").text($.i18n('core-project/undo-redo'));
$("#or-proj-ext").text($.i18n._('core-project/extensions')+":"); $("#or-proj-ext").text($.i18n('core-project/extensions')+":");
$('#project-name-button').click(Refine._renameProject); $('#project-name-button').click(Refine._renameProject);
$('#project-permalink-button').mouseenter(function() { $('#project-permalink-button').mouseenter(function() {
@ -204,7 +206,7 @@ Refine.reinitializeProjectData = function(f, fError) {
}; };
Refine._renameProject = function() { Refine._renameProject = function() {
var name = window.prompt($.i18n._('core-index/new-proj-name'), theProject.metadata.name); var name = window.prompt($.i18n('core-index/new-proj-name'), theProject.metadata.name);
if (name === null) { if (name === null) {
return; return;
} }
@ -224,7 +226,7 @@ Refine._renameProject = function() {
theProject.metadata.name = name; theProject.metadata.name = name;
Refine.setTitle(); Refine.setTitle();
} else { } else {
alert($.i18n._('core-index/error-rename')+" " + data.message); alert($.i18n('core-index/error-rename')+" " + data.message);
} }
} }
}); });

View File

@ -96,21 +96,21 @@ BrowsingEngine.prototype._initializeUI = function() {
this._div.html( this._div.html(
'<div class="browsing-panel-help" bind="help">' + '<div class="browsing-panel-help" bind="help">' +
'<h1>'+$.i18n._('core-project/use-facets')+'</h1>' + '<h1>'+$.i18n('core-project/use-facets')+'</h1>' +
'<p>'+$.i18n._('core-project/use-to-select')+'</p>' + '<p>'+$.i18n('core-project/use-to-select')+'</p>' +
'<p>'+$.i18n._('core-project/not-sure')+'<br /><a href="https://github.com/OpenRefine/OpenRefine/wiki/Screencasts" target="_blank"><b>'+$.i18n._('core-project/watch-cast')+'</b></a></p>' + '<p>'+$.i18n('core-project/not-sure')+'<br /><a href="https://github.com/OpenRefine/OpenRefine/wiki/Screencasts" target="_blank"><b>'+$.i18n('core-project/watch-cast')+'</b></a></p>' +
'</div>' + '</div>' +
'<div class="browsing-panel-header" bind="header">' + '<div class="browsing-panel-header" bind="header">' +
'<div class="browsing-panel-errors" bind="errors"></div>' + '<div class="browsing-panel-errors" bind="errors"></div>' +
'<div class="browsing-panel-indicator" bind="indicator">' + '<div class="browsing-panel-indicator" bind="indicator">' +
'<img src="images/small-spinner.gif" /> '+$.i18n._('core-project/refreshing-facet')+'' + '<img src="images/small-spinner.gif" /> '+$.i18n('core-project/refreshing-facet')+'' +
'</div>' + '</div>' +
'<div class="browsing-panel-controls" bind="controls">' + '<div class="browsing-panel-controls" bind="controls">' +
'<div class="browsing-panel-controls-refresh">' + '<div class="browsing-panel-controls-refresh">' +
'<a href="javascript:{}" bind="refreshLink" class="button" title="'+$.i18n._('core-project/update-facets')+'">'+$.i18n._('core-buttons/refresh')+'</a>' + '<a href="javascript:{}" bind="refreshLink" class="button" title="'+$.i18n('core-project/update-facets')+'">'+$.i18n('core-buttons/refresh')+'</a>' +
'</div>' + '</div>' +
'<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="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>' + '<a href="javascript:{}" bind="removeLink" class="button button-pill-right" title="'+$.i18n('core-project/remove-all')+'">'+$.i18n('core-buttons/remove-all')+'</a>' +
'</div>' + '</div>' +
'</div>' + '</div>' +
'<ul bind="facets" class="facets-container"></ul>' '<ul bind="facets" class="facets-container"></ul>'

View File

@ -571,9 +571,9 @@ EditGeneralMetadataDialog.prototype._createDialog = function() {
var editor; var editor;
this._elmts.okButton.html($.i18n._('core-buttons/ok')); this._elmts.okButton.html($.i18n('core-buttons/ok'));
this._elmts.okButton.click(function() { self._submit(editor); }); this._elmts.okButton.click(function() { self._submit(editor); });
this._elmts.closeButton.html($.i18n._('core-buttons/close')); this._elmts.closeButton.html($.i18n('core-buttons/close'));
this._elmts.closeButton.click(function() { self._dismiss(); }); this._elmts.closeButton.click(function() { self._dismiss(); });
$.get( $.get(

View File

@ -39,59 +39,59 @@ ExporterManager.handlers = {};
ExporterManager.MenuItems = [ ExporterManager.MenuItems = [
{ {
"id" : "core/export-project", "id" : "core/export-project",
"label": $.i18n._('core-project/export-project'), "label": $.i18n('core-project/export-project'),
"click": function() { ExporterManager.handlers.exportProject(); } "click": function() { ExporterManager.handlers.exportProject(); }
}, },
{ {
"id" : "core/project-data-package", "id" : "core/project-data-package",
"label": $.i18n._('core-project/project-data-package'), "label": $.i18n('core-project/project-data-package'),
"click": function() { ExporterManager.handlers.projectDataPackage(); } "click": function() { ExporterManager.handlers.projectDataPackage(); }
}, },
{}, {},
{ {
"id" : "core/export-tsv", "id" : "core/export-tsv",
"label": $.i18n._('core-project/tab-value'), "label": $.i18n('core-project/tab-value'),
"click": function() { ExporterManager.handlers.exportRows("tsv", "tsv"); } "click": function() { ExporterManager.handlers.exportRows("tsv", "tsv"); }
}, },
{ {
"id" : "core/export-csv", "id" : "core/export-csv",
"label": $.i18n._('core-project/comma-sep'), "label": $.i18n('core-project/comma-sep'),
"click": function() { ExporterManager.handlers.exportRows("csv", "csv"); } "click": function() { ExporterManager.handlers.exportRows("csv", "csv"); }
}, },
{ {
"id" : "core/export-html-table", "id" : "core/export-html-table",
"label": $.i18n._('core-project/html-table'), "label": $.i18n('core-project/html-table'),
"click": function() { ExporterManager.handlers.exportRows("html", "html"); } "click": function() { ExporterManager.handlers.exportRows("html", "html"); }
}, },
{ {
"id" : "core/export-excel", "id" : "core/export-excel",
"label": $.i18n._('core-project/excel'), "label": $.i18n('core-project/excel'),
"click": function() { ExporterManager.handlers.exportRows("xls", "xls"); } "click": function() { ExporterManager.handlers.exportRows("xls", "xls"); }
}, },
{ {
"id" : "core/export-excel-xml", "id" : "core/export-excel-xml",
"label": $.i18n._('core-project/excel-xml'), "label": $.i18n('core-project/excel-xml'),
"click": function() { ExporterManager.handlers.exportRows("xlsx", "xlsx"); } "click": function() { ExporterManager.handlers.exportRows("xlsx", "xlsx"); }
}, },
{ {
"id" : "core/export-ods", "id" : "core/export-ods",
"label": $.i18n._('core-project/odf'), "label": $.i18n('core-project/odf'),
"click": function() { ExporterManager.handlers.exportRows("ods", "ods"); } "click": function() { ExporterManager.handlers.exportRows("ods", "ods"); }
}, },
{}, {},
{ {
"id" : "core/export-custom-tabular", "id" : "core/export-custom-tabular",
"label": $.i18n._('core-project/custom-tabular'), "label": $.i18n('core-project/custom-tabular'),
"click": function() { new CustomTabularExporterDialog(); } "click": function() { new CustomTabularExporterDialog(); }
}, },
{ {
"id" : "core/export-sql", "id" : "core/export-sql",
"label": $.i18n._('core-project/sql-export'), "label": $.i18n('core-project/sql-export'),
"click": function() { new SqlExporterDialog(); } "click": function() { new SqlExporterDialog(); }
}, },
{ {
"id" : "core/export-templating", "id" : "core/export-templating",
"label": $.i18n._('core-project/templating'), "label": $.i18n('core-project/templating'),
"click": function() { new TemplatingExporterDialog(); } "click": function() { new TemplatingExporterDialog(); }
} }
]; ];
@ -116,7 +116,7 @@ ExporterManager.stripNonFileChars = function(name) {
ExporterManager.handlers.exportTripleloader = function(format) { ExporterManager.handlers.exportTripleloader = function(format) {
if (!theProject.overlayModels.freebaseProtograph) { if (!theProject.overlayModels.freebaseProtograph) {
alert($.i18n._('triple-loader/warning-align')); alert($.i18n('triple-loader/warning-align'));
} else { } else {
ExporterManager.handlers.exportRows(format, "txt"); ExporterManager.handlers.exportRows(format, "txt");
} }
@ -170,11 +170,11 @@ ExporterManager.handlers.exportProject = function() {
var dialog = $(DOM.loadHTML("core", "scripts/dialogs/export-project-dialog.html")); var dialog = $(DOM.loadHTML("core", "scripts/dialogs/export-project-dialog.html"));
var _elmts = DOM.bind(dialog); var _elmts = DOM.bind(dialog);
_elmts.dialogHeader.html($.i18n._('core-dialogs/choose-export-destination')); _elmts.dialogHeader.html($.i18n('core-dialogs/choose-export-destination'));
_elmts.toLocalRadio.html($.i18n._('core-dialogs/export-to-local')); _elmts.toLocalRadio.html($.i18n('core-dialogs/export-to-local'));
_elmts.toGoogleDriveRadio.html($.i18n._('core-dialogs/export-to-google-drive')); _elmts.toGoogleDriveRadio.html($.i18n('core-dialogs/export-to-google-drive'));
_elmts.exportButton.html($.i18n._('core-buttons/export')); _elmts.exportButton.html($.i18n('core-buttons/export'));
_elmts.cancelButton.html($.i18n._('core-buttons/cancel')); _elmts.cancelButton.html($.i18n('core-buttons/cancel'));
_elmts.exportButton.click(function() { _elmts.exportButton.click(function() {
if ($("input[name='export-destination']")[0].checked) { if ($("input[name='export-destination']")[0].checked) {
@ -194,7 +194,7 @@ ExporterManager.handlers.exportProject = function() {
var doExportToGoogleDrive = function() { var doExportToGoogleDrive = function() {
var name = window.prompt(prompt, theProject.metadata.name); var name = window.prompt(prompt, theProject.metadata.name);
if (name) { if (name) {
var dismiss = DialogSystem.showBusy($.i18n._('gdata-exporter/uploading')); var dismiss = DialogSystem.showBusy($.i18n('gdata-exporter/uploading'));
$.post( $.post(
"command/gdata/upload", "command/gdata/upload",
{ {
@ -206,9 +206,9 @@ ExporterManager.handlers.exportProject = function() {
dismiss(); dismiss();
if (o.url) { if (o.url) {
alert($.i18n._('gdata-exporter/upload-success') + o.url); alert($.i18n('gdata-exporter/upload-success') + o.url);
} else { } else {
alert($.i18n._('gdata-exporter/upload-error') + o.message) alert($.i18n('gdata-exporter/upload-error') + o.message)
} }
onDone(); onDone();
}, },

View File

@ -69,19 +69,19 @@ HistoryPanel.prototype.update = function(onDone) {
HistoryPanel.prototype._render = function() { HistoryPanel.prototype._render = function() {
var self = this; var self = this;
this._tabHeader.html($.i18n._('core-project/undo-redo')+' <span class="count">' + this._data.past.length + ' / ' + ( this._data.future.length + this._data.past.length ) + '</span>'); this._tabHeader.html($.i18n('core-project/undo-redo')+' <span class="count">' + this._data.past.length + ' / ' + ( this._data.future.length + this._data.past.length ) + '</span>');
this._div.empty().unbind().html(DOM.loadHTML("core", "scripts/project/history-panel.html")); this._div.empty().unbind().html(DOM.loadHTML("core", "scripts/project/history-panel.html"));
var elmts = DOM.bind(this._div); var elmts = DOM.bind(this._div);
elmts.or_proj_undo.html($.i18n._('core-project/undo-history')); elmts.or_proj_undo.html($.i18n('core-project/undo-history'));
elmts.or_proj_mistakes.html($.i18n._('core-project/mistakes')); elmts.or_proj_mistakes.html($.i18n('core-project/mistakes'));
elmts.or_proj_learnMore.html($.i18n._('core-project/learn-more')); elmts.or_proj_learnMore.html($.i18n('core-project/learn-more'));
elmts.applyLink.html($.i18n._('core-project/apply')); elmts.applyLink.html($.i18n('core-project/apply'));
elmts.extractLink.html($.i18n._('core-project/extract')); elmts.extractLink.html($.i18n('core-project/extract'));
elmts.or_proj_mistakes.html($.i18n._('core-project/mistakes')); elmts.or_proj_mistakes.html($.i18n('core-project/mistakes'));
elmts.or_proj_filter.html($.i18n._('core-project/filter')); elmts.or_proj_filter.html($.i18n('core-project/filter'));
var renderEntry = function(container, index, entry, lastDoneID, past) { var renderEntry = function(container, index, entry, lastDoneID, past) {
var a = $(DOM.loadHTML("core", "scripts/project/history-entry.html")).appendTo(container); var a = $(DOM.loadHTML("core", "scripts/project/history-entry.html")).appendTo(container);
@ -195,11 +195,11 @@ HistoryPanel.prototype._showExtractOperationsDialog = function(json) {
var frame = $(DOM.loadHTML("core", "scripts/project/history-extract-dialog.html")); var frame = $(DOM.loadHTML("core", "scripts/project/history-extract-dialog.html"));
var elmts = DOM.bind(frame); var elmts = DOM.bind(frame);
elmts.dialogHeader.html($.i18n._('core-project/extract-history')); elmts.dialogHeader.html($.i18n('core-project/extract-history'));
elmts.or_proj_extractSave.html($.i18n._('core-project/extract-save')); elmts.or_proj_extractSave.html($.i18n('core-project/extract-save'));
elmts.selectAllButton.html($.i18n._('core-buttons/select-all')); elmts.selectAllButton.html($.i18n('core-buttons/select-all'));
elmts.unselectAllButton.html($.i18n._('core-buttons/unselect-all')); elmts.unselectAllButton.html($.i18n('core-buttons/unselect-all'));
elmts.closeButton.html($.i18n._('core-buttons/close')); elmts.closeButton.html($.i18n('core-buttons/close'));
var entryTable = elmts.entryTable[0]; var entryTable = elmts.entryTable[0];
var createEntry = function(entry) { var createEntry = function(entry) {
@ -265,11 +265,11 @@ HistoryPanel.prototype._showApplyOperationsDialog = function() {
var frame = $(DOM.loadHTML("core", "scripts/project/history-apply-dialog.html")); var frame = $(DOM.loadHTML("core", "scripts/project/history-apply-dialog.html"));
var elmts = DOM.bind(frame); var elmts = DOM.bind(frame);
elmts.dialogHeader.html($.i18n._('core-project/apply-operation')); elmts.dialogHeader.html($.i18n('core-project/apply-operation'));
elmts.or_proj_pasteJson.html($.i18n._('core-project/paste-json')); elmts.or_proj_pasteJson.html($.i18n('core-project/paste-json'));
elmts.applyButton.html($.i18n._('core-buttons/perform-op')); elmts.applyButton.html($.i18n('core-buttons/perform-op'));
elmts.cancelButton.html($.i18n._('core-buttons/cancel')); elmts.cancelButton.html($.i18n('core-buttons/cancel'));
var fixJson = function(json) { var fixJson = function(json) {
json = json.trim(); json = json.trim();
@ -291,7 +291,7 @@ HistoryPanel.prototype._showApplyOperationsDialog = function() {
json = fixJson(json); json = fixJson(json);
json = JSON.parse(json); json = JSON.parse(json);
} catch (e) { } catch (e) {
alert($.i18n._('core-project/json-invalid')+"."); alert($.i18n('core-project/json-invalid')+".");
return; return;
} }

View File

@ -43,7 +43,7 @@ function ProcessPanel(div) {
this._div.html(DOM.loadHTML("core", "scripts/project/progress-panel.html")); this._div.html(DOM.loadHTML("core", "scripts/project/progress-panel.html"));
this._elmts = DOM.bind(this._div); this._elmts = DOM.bind(this._div);
this._elmts.undoLink.html($.i18n._('core-project/undo')); this._elmts.undoLink.html($.i18n('core-project/undo'));
var self = this; var self = this;
$(window).keypress(function(evt) { $(window).keypress(function(evt) {
@ -153,9 +153,9 @@ ProcessPanel.prototype._render = function(newData) {
var process = processes[i]; var process = processes[i];
if (process.status != "pending") { if (process.status != "pending") {
// TODO: We should be using formatting, not string concatenation here // TODO: We should be using formatting, not string concatenation here
Refine.setTitle(process.progress + "% "+$.i18n._('core-project/complete')); Refine.setTitle(process.progress + "% "+$.i18n('core-project/complete'));
this._elmts.progressDescription.text(process.description); this._elmts.progressDescription.text(process.description);
this._elmts.progressSpan.text(process.progress + '% '+$.i18n._('core-project/complete')); this._elmts.progressSpan.text(process.progress + '% '+$.i18n('core-project/complete'));
} }
if ("onDone" in process) { if ("onDone" in process) {
newProcessMap[process.id] = process; newProcessMap[process.id] = process;
@ -164,16 +164,16 @@ ProcessPanel.prototype._render = function(newData) {
if (processes.length > 1) { if (processes.length > 1) {
var pending = processes.length - 1; var pending = processes.length - 1;
this._elmts.countSpan.text('(' + pending + (pending > 1 ? ' '+$.i18n._('core-project/other-processes')+')' : ' '+$.i18n._('core-project/other-process')+')')); this._elmts.countSpan.text('(' + pending + (pending > 1 ? ' '+$.i18n('core-project/other-processes')+')' : ' '+$.i18n('core-project/other-process')+')'));
} else { } else {
this._elmts.countSpan.empty(); this._elmts.countSpan.empty();
} }
this._elmts.cancelLink this._elmts.cancelLink
.unbind() .unbind()
.text(processes.length > 1 ? $.i18n._('core-project/cancel-all') : $.i18n._('core-project/cancel')) .text(processes.length > 1 ? $.i18n('core-project/cancel-all') : $.i18n('core-project/cancel'))
.click(function() { .click(function() {
self._cancelAll(); self._cancelAll();
$(this).text($.i18n._('core-project/canceling')).unbind(); $(this).text($.i18n('core-project/canceling')).unbind();
}); });
this._div.fadeIn(200); this._div.fadeIn(200);
@ -196,10 +196,10 @@ ProcessPanel.prototype._render = function(newData) {
}).join('\n'); }).join('\n');
if (this._data.processes.length == 0) { if (this._data.processes.length == 0) {
window.alert($.i18n._('core-project/last-op-er')+':\n' + messages); window.alert($.i18n('core-project/last-op-er')+':\n' + messages);
} else { } else {
if (window.confirm($.i18n._('core-project/last-op-er')+':\n' + messages + if (window.confirm($.i18n('core-project/last-op-er')+':\n' + messages +
'\n\n'+$.i18n._('core-project/continue-remaining')+'?')) { '\n\n'+$.i18n('core-project/continue-remaining')+'?')) {
$.post( $.post(
"command/core/apply-operations?" + $.param({ project: theProject.id }), "command/core/apply-operations?" + $.param({ project: theProject.id }),
{ operations: '[]' }, { operations: '[]' },

View File

@ -42,7 +42,7 @@ SummaryBar.prototype._initializeUI = function() {
SummaryBar.prototype.updateResultCount = function() { SummaryBar.prototype.updateResultCount = function() {
var summaryText; var summaryText;
var units = theProject.rowModel.mode == "row-based" ? $.i18n._('core-views/rows') : $.i18n._('core-views/records'); var units = theProject.rowModel.mode == "row-based" ? $.i18n('core-views/rows') : $.i18n('core-views/records');
if (theProject.rowModel.filtered == theProject.rowModel.total) { if (theProject.rowModel.filtered == theProject.rowModel.total) {
summaryText = (theProject.rowModel.total) + ' ' + units; summaryText = (theProject.rowModel.total) + ' ' + units;
} else { } else {

View File

@ -44,13 +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($.i18n._('core-recon/recon-col')+' "' + 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.servicePanelMessage.html($.i18n('core-recon/pick-service'));
this._elmts.serviceListTitle.html($.i18n._('core-recon/service-title')); this._elmts.serviceListTitle.html($.i18n('core-recon/service-title'));
this._elmts.addStandardServiceButton.html($.i18n._('core-buttons/add-std-svc')+"..."); this._elmts.addStandardServiceButton.html($.i18n('core-buttons/add-std-svc')+"...");
this._elmts.reconcileButton.html($.i18n._('core-buttons/start-recon')); this._elmts.reconcileButton.html($.i18n('core-buttons/start-recon'));
this._elmts.cancelButton.html($.i18n._('core-buttons/cancel')); this._elmts.cancelButton.html($.i18n('core-buttons/cancel'));
this._elmts.addStandardServiceButton.click(function() { self._onAddStandardService(); }); this._elmts.addStandardServiceButton.click(function() { self._onAddStandardService(); });
@ -202,10 +202,10 @@ 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.dialogHeader.html($.i18n('core-recon/add-std-srv'));
elmts.or_recon_enterUrl.html($.i18n._('core-recon/enter-url')+":"); elmts.or_recon_enterUrl.html($.i18n('core-recon/enter-url')+":");
elmts.addButton.html($.i18n._('core-buttons/add-service')); elmts.addButton.html($.i18n('core-buttons/add-service'));
elmts.cancelButton.html($.i18n._('core-buttons/cancel')); elmts.cancelButton.html($.i18n('core-buttons/cancel'));
var level = DialogSystem.showDialog(dialog); var level = DialogSystem.showDialog(dialog);
var dismiss = function() { var dismiss = function() {

View File

@ -63,7 +63,7 @@ ReconciliationManager.registerService = function(service) {
}; };
ReconciliationManager.registerStandardService = function(url, f) { ReconciliationManager.registerStandardService = function(url, f) {
var dismissBusy = DialogSystem.showBusy($.i18n._('core-recon/contact-service')+"..."); var dismissBusy = DialogSystem.showBusy($.i18n('core-recon/contact-service')+"...");
$.ajax( $.ajax(
url, url,
@ -91,7 +91,7 @@ ReconciliationManager.registerStandardService = function(url, f) {
}) })
.error(function(jqXHR, textStatus, errorThrown) { .error(function(jqXHR, textStatus, errorThrown) {
dismissBusy(); dismissBusy();
alert($.i18n._('core-recon/error-contact')+': ' + textStatus + ' : ' + errorThrown + ' - ' + url); alert($.i18n('core-recon/error-contact')+': ' + textStatus + ' : ' + errorThrown + ' - ' + url);
}); });
}; };
@ -141,7 +141,7 @@ ReconciliationManager.getOrRegisterServiceFromUrl = function(url, f) {
}; };
ReconciliationManager.ensureDefaultServicePresent = function() { ReconciliationManager.ensureDefaultServicePresent = function() {
var lang = $.i18n._('core-recon/wd-recon-lang'); var lang = $.i18n('core-recon/wd-recon-lang');
var url = "https://tools.wmflabs.org/openrefine-wikidata/"+lang+"/api"; var url = "https://tools.wmflabs.org/openrefine-wikidata/"+lang+"/api";
ReconciliationManager.getOrRegisterServiceFromUrl(url, function(service) { }); ReconciliationManager.getOrRegisterServiceFromUrl(url, function(service) { });
return url; return url;

View File

@ -83,14 +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.or_proc_access.html("&raquo; "+$.i18n('core-recon/access'));
this._elmts.rawServiceLink.html($.i18n._('core-recon/service-api')); this._elmts.rawServiceLink.html($.i18n('core-recon/service-api'));
this._elmts.or_proc_cellType.html($.i18n._('core-recon/cell-type')+":"); 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_colDetail.html($.i18n('core-recon/col-detail')+":");
this._elmts.or_proc_againstType.html($.i18n._('core-recon/against-type')+":"); this._elmts.or_proc_againstType.html($.i18n('core-recon/against-type')+":");
this._elmts.or_proc_noType.html($.i18n._('core-recon/no-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.or_proc_autoMatch.html($.i18n('core-recon/auto-match'));
this._elmts.or_proc_max_candidates.html($.i18n._('core-recon/max-candidates')); this._elmts.or_proc_max_candidates.html($.i18n('core-recon/max-candidates'));
this._elmts.rawServiceLink.attr("href", this._service.url); this._elmts.rawServiceLink.attr("href", this._service.url);
@ -166,7 +166,7 @@ ReconStandardServicePanel.prototype._populatePanel = function() {
} else { } else {
$('<div>') $('<div>')
.addClass("recon-dialog-standard-service-panel-message") .addClass("recon-dialog-standard-service-panel-message")
.text($.i18n._('core-recon/warning-type-sugg')) .text($.i18n('core-recon/warning-type-sugg'))
.appendTo(this._elmts.typeContainer); .appendTo(this._elmts.typeContainer);
this._panel this._panel
@ -185,7 +185,7 @@ ReconStandardServicePanel.prototype._populatePanel = function() {
var detailTable = $( var detailTable = $(
'<table>' + '<table>' +
'<tr><th>'+$.i18n._('core-recon/column')+'</th><th>'+$.i18n._('core-recon/include')+'?</th><th>'+$.i18n._('core-recon/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];

Some files were not shown because too many files have changed in this diff Show More