Add i18n
review16321002
This commit is contained in:
+53
-14
@@ -1,24 +1,59 @@
|
||||
module.exports = function(grunt) {
|
||||
|
||||
var _ = grunt.util._;
|
||||
var locales = ["bg_BG", "ca_ES", "cs_CZ", "de_DE", "es_AR", "es_CO", "es_EC",
|
||||
"es_ES", "fr_FR", "ja_JP", "lt_LT", "nl_NL", "ru_RU", "sl_SI"];
|
||||
var jsfiles = [
|
||||
'src/sao.js',
|
||||
'src/rpc.js',
|
||||
'src/pyson.js',
|
||||
'src/session.js',
|
||||
'src/model.js',
|
||||
'src/tab.js',
|
||||
'src/screen.js',
|
||||
'src/view.js',
|
||||
'src/action.js',
|
||||
'src/common.js',
|
||||
'src/window.js',
|
||||
'src/wizard.js'
|
||||
];
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
xgettext: {
|
||||
locale: {
|
||||
files: {
|
||||
javascript: jsfiles
|
||||
},
|
||||
options: {
|
||||
functionName: "Sao.i18n.gettext",
|
||||
potFile: "locale/messages.pot"
|
||||
},
|
||||
}
|
||||
},
|
||||
shell: {
|
||||
options: {
|
||||
failOnError: true
|
||||
},
|
||||
msgmerge: {
|
||||
command: _.map(locales, function(locale) {
|
||||
var po = "locale/" + locale + ".po";
|
||||
return "msgmerge -U " + po + " locale/messages.pot;";
|
||||
}).join("")
|
||||
},
|
||||
po2json: {
|
||||
command: _.map(locales, function(locale) {
|
||||
var po = "locale/" + locale + ".po";
|
||||
var json = "locale/" + locale + ".json";
|
||||
return "./node_modules/.bin/po2json-gettextjs " +
|
||||
po + " " + json + ";";
|
||||
}).join("")
|
||||
}
|
||||
},
|
||||
concat: {
|
||||
dist: {
|
||||
src: [
|
||||
'src/sao.js',
|
||||
'src/rpc.js',
|
||||
'src/pyson.js',
|
||||
'src/session.js',
|
||||
'src/model.js',
|
||||
'src/tab.js',
|
||||
'src/screen.js',
|
||||
'src/view.js',
|
||||
'src/action.js',
|
||||
'src/common.js',
|
||||
'src/window.js',
|
||||
'src/wizard.js'
|
||||
],
|
||||
src: jsfiles,
|
||||
dest: 'dist/<%= pkg.name %>.js'
|
||||
}
|
||||
},
|
||||
@@ -85,6 +120,8 @@ module.exports = function(grunt) {
|
||||
|
||||
// Load the plugin that provides the "uglify" task.
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-xgettext');
|
||||
grunt.loadNpmTasks('grunt-shell');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-less');
|
||||
@@ -93,5 +130,7 @@ module.exports = function(grunt) {
|
||||
// Default task(s).
|
||||
grunt.registerTask('default', ['concat', 'jshint', 'uglify', 'less:default']);
|
||||
grunt.registerTask('dev', ['concat', 'jshint', 'less:dev']);
|
||||
grunt.registerTask('msgmerge', ['shell:msgmerge']);
|
||||
grunt.registerTask('po2json', ['shell:po2json']);
|
||||
|
||||
};
|
||||
|
||||
+2
-1
@@ -20,7 +20,8 @@
|
||||
"moment": "~2.10.2",
|
||||
"eonasdan-bootstrap-datetimepicker": "~4.7.14",
|
||||
"typeahead.js": "~0.10.5",
|
||||
"typeahead.js-bootstrap3.less": "~0"
|
||||
"typeahead.js-bootstrap3.less": "~0",
|
||||
"gettext.js": "~0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"qunit": "~1.18.0"
|
||||
|
||||
+1
-44
@@ -11,6 +11,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<script type="text/javascript" src="bower_components/moment/min/moment.min.js"></script>
|
||||
<script type="text/javascript" src="bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" src="bower_components/typeahead.js/dist/typeahead.bundle.js"></script>
|
||||
<script type="text/javascript" src="bower_components/gettext.js/dist/gettext.js"></script>
|
||||
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">
|
||||
<link rel="stylesheet" href="bower_components/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css">
|
||||
<link rel="stylesheet" href="bower_components/typeahead.js-bootstrap3.less/typeahead.css"/>
|
||||
@@ -76,49 +77,5 @@ this repository contains the full copyright notices and license terms. -->
|
||||
Sao.login();
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="login">
|
||||
<div class="modal-dialog">
|
||||
<form class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Login</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="login-database">Database</label>
|
||||
<select class="form-control" id="login-database"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="login-login">Login</label>
|
||||
<input class="form-control" id="login-login" placeholder="Login">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="login-password">Password</label>
|
||||
<input type="password" class="form-control" id="login-password" placeholder="Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="password">
|
||||
<div class="modal-dialog">
|
||||
<form class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Password</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="password-password">Password</label>
|
||||
<input type="password" class="form-control" id="password-password" placeholder="Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">OK</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+3
-1
@@ -28,7 +28,9 @@
|
||||
"grunt-contrib-less": "^1.0.1",
|
||||
"grunt-contrib-nodeunit": "~0.4.1",
|
||||
"grunt-contrib-uglify": "^0.9.1",
|
||||
"grunt-contrib-watch": "~0.6.1"
|
||||
"grunt-contrib-watch": "~0.6.1",
|
||||
"grunt-shell": "^1.1.2",
|
||||
"grunt-xgettext": "^0.3.5"
|
||||
},
|
||||
"keywords": [
|
||||
"tryton"
|
||||
|
||||
+4
-5
@@ -132,15 +132,14 @@
|
||||
var action = actions[i];
|
||||
keyact[action.name.replace(/_/g, '')] = action;
|
||||
}
|
||||
// TODO translation
|
||||
var prm = Sao.common.selection('Select your action', keyact,
|
||||
alwaysask);
|
||||
var prm = Sao.common.selection(
|
||||
Sao.i18n.gettext('Select your action'),
|
||||
keyact, alwaysask);
|
||||
return prm.then(function(action) {
|
||||
Sao.Action.exec_action(action, data, context);
|
||||
}, function() {
|
||||
if (jQuery.isEmptyObject(keyact) && warning) {
|
||||
// TODO translation
|
||||
alert('No action defined!');
|
||||
alert(Sao.i18n.gettext('No action defined!'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
+56
-48
@@ -98,7 +98,8 @@
|
||||
return prm;
|
||||
}
|
||||
var dialog = new Sao.Dialog(
|
||||
title || 'Your selection:', 'selection-dialog');
|
||||
title || Sao.i18n.gettext('Your selection:'),
|
||||
'selection-dialog');
|
||||
|
||||
keys.forEach(function(k, i) {
|
||||
jQuery('<div/>', {
|
||||
@@ -117,14 +118,14 @@
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button'
|
||||
}).append('Cancel').click(function() {
|
||||
}).append(Sao.i18n.gettext('Cancel')).click(function() {
|
||||
dialog.modal.modal('hide');
|
||||
prm.fail();
|
||||
}).appendTo(dialog.footer);
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'button'
|
||||
}).append('OK').click(function() {
|
||||
}).append(Sao.i18n.gettext('OK')).click(function() {
|
||||
var i = dialog.body.find('input:checked').attr('value');
|
||||
dialog.modal.modal('hide');
|
||||
prm.resolve(values[keys[i]]);
|
||||
@@ -259,15 +260,14 @@
|
||||
Sao.common.timedelta.DEFAULT_CONVERTER.Y =
|
||||
Sao.common.timedelta.DEFAULT_CONVERTER.d * 365;
|
||||
Sao.common.timedelta._get_separator = function() {
|
||||
// TODO translate
|
||||
return {
|
||||
Y: 'Y',
|
||||
M: 'M',
|
||||
w: 'w',
|
||||
d: 'd',
|
||||
h: 'h',
|
||||
m: 'm',
|
||||
s: 's'
|
||||
Y: Sao.i18n.gettext('Y'),
|
||||
M: sao.i18n.gettext('M'),
|
||||
w: sao.i18n.gettext('w'),
|
||||
d: sao.i18n.gettext('d'),
|
||||
h: sao.i18n.gettext('h'),
|
||||
m: sao.i18n.gettext('m'),
|
||||
s: sao.i18n.gettext('s')
|
||||
};
|
||||
};
|
||||
Sao.common.timedelta.format = function(value, converter) {
|
||||
@@ -1672,7 +1672,11 @@
|
||||
var converts = {
|
||||
'boolean': function() {
|
||||
if (typeof value == 'string') {
|
||||
return ['y', 'yes', 'true', 't', '1'].some(
|
||||
return [Sao.i18n.gettext('y'),
|
||||
Sao.i18n.gettext('yes'),
|
||||
Sao.i18n.gettext('true'),
|
||||
Sao.i18n.gettext('t'),
|
||||
'1'].some(
|
||||
function(test) {
|
||||
return test.toLowerCase().startsWith(
|
||||
value.toLowerCase());
|
||||
@@ -1789,9 +1793,9 @@
|
||||
var converts = {
|
||||
'boolean': function() {
|
||||
if (value) {
|
||||
return 'True'; // TODO translate
|
||||
return Sao.i18n.gettext('True');
|
||||
} else {
|
||||
return 'False';
|
||||
return Sao.i18n.gettext('False');
|
||||
}
|
||||
},
|
||||
'integer': function() {
|
||||
@@ -2519,12 +2523,12 @@
|
||||
'aria-hidden': true
|
||||
})).append(jQuery('<span/>', {
|
||||
'class': 'sr-only'
|
||||
}).append('Message: ')
|
||||
}).append(Sao.i18n.gettext('Message: '))
|
||||
).append(message));
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'button'
|
||||
}).append('OK').click(function() {
|
||||
}).append(Sao.i18n.gettext('OK')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.resolve('ok');
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
@@ -2551,12 +2555,12 @@
|
||||
'aria-hidden': true
|
||||
})).append(jQuery('<span/>', {
|
||||
'class': 'sr-only'
|
||||
}).append('Warning: ')
|
||||
}).append(Sao.i18n.gettext('Warning: '))
|
||||
).append(message));
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'button'
|
||||
}).append('OK').click(function() {
|
||||
}).append(Sao.i18n.gettext('OK')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.resolve('ok');
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
@@ -2578,21 +2582,23 @@
|
||||
.append(jQuery('<input/>', {
|
||||
'type': 'checkbox'
|
||||
}).change(this._set_always.bind(this)))
|
||||
.append(jQuery('<span/>').text('Always ignore this warning.'))
|
||||
.append(jQuery('<span/>')
|
||||
.text(Sao.i18n.gettext('Always ignore this warning.')))
|
||||
);
|
||||
dialog.body.append(jQuery('<p/>').text('Do you want to proceed?'));
|
||||
dialog.body.append(jQuery('<p/>')
|
||||
.text(Sao.i18n.gettext('Do you want to proceed?')));
|
||||
dialog.footer.children().remove();
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button'
|
||||
}).append('No').click(function() {
|
||||
}).append(Sao.i18n.gettext('No')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.reject();
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'button'
|
||||
}).append('Yes').click(function() {
|
||||
}).append(Sao.i18n.gettext('Yes')).click(function() {
|
||||
this.close(dialog);
|
||||
if (this.always) {
|
||||
prm.resolve('always');
|
||||
@@ -2618,7 +2624,7 @@
|
||||
'aria-hidden': true
|
||||
})).append(jQuery('<span/>', {
|
||||
'class': 'sr-only'
|
||||
}).append('Confirmation: ')
|
||||
}).append(Sao.i18n.gettext('Confirmation: '))
|
||||
).append(message));
|
||||
return dialog;
|
||||
}
|
||||
@@ -2631,14 +2637,14 @@
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button'
|
||||
}).append('Cancel').click(function() {
|
||||
}).append(Sao.i18n.gettext('Cancel')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.reject();
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'button'
|
||||
}).append('OK').click(function() {
|
||||
}).append(Sao.i18n.gettext('OK')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.resolve();
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
@@ -2654,21 +2660,21 @@
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button'
|
||||
}).append('Cancel').click(function() {
|
||||
}).append(Sao.i18n.gettext('Cancel')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.resolve('cancel');
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-default',
|
||||
'type': 'button'
|
||||
}).append('No').click(function() {
|
||||
}).append(Sao.i18n.gettext('No')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.resolve('ko');
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'button'
|
||||
}).append('Yes').click(function() {
|
||||
}).append(Sao.i18n.gettext('Yes')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.resolve('ok');
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
@@ -2703,14 +2709,14 @@
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button'
|
||||
}).append('Cancel').click(function() {
|
||||
}).append(Sao.i18n.gettext('Cancel')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.reject();
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'button'
|
||||
}).append('OK').click(function() {
|
||||
}).append(Sao.i18n.gettext('OK')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.resolve(entry.val());
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
@@ -2726,7 +2732,7 @@
|
||||
this);
|
||||
dialog.modal.find('.modal-dialog'
|
||||
).removeClass('modal-sm').addClass('modal-lg');
|
||||
dialog.add_title('Concurrency Exception');
|
||||
dialog.add_title(Sao.i18n.gettext('Concurrency Exception'));
|
||||
dialog.body.append(jQuery('<div/>', {
|
||||
'class': 'alert alert-warning',
|
||||
role: 'alert'
|
||||
@@ -2736,29 +2742,31 @@
|
||||
'aria-hidden': true
|
||||
})).append(jQuery('<span/>', {
|
||||
'class': 'sr-only'
|
||||
}).append('Write Concurrency Warning: ')
|
||||
).append('This record has been modified ' +
|
||||
'while you were editing it.'))
|
||||
.append(jQuery('<p/>').text('Choose:'))
|
||||
}).append(Sao.i18n.gettext('Write Concurrency Warning: '))
|
||||
).append(Sao.i18n.gettext('This record has been modified ' +
|
||||
'while you were editing it.')))
|
||||
.append(jQuery('<p/>').text(Sao.i18n.gettext('Choose:')))
|
||||
.append(jQuery('<ul/>')
|
||||
.append(jQuery('<li/>')
|
||||
.text('"Cancel" to cancel saving;'))
|
||||
.text(Sao.i18n.gettext('"Cancel" to cancel saving;')))
|
||||
.append(jQuery('<li/>')
|
||||
.text('"Compare" to see the modified version;'))
|
||||
.text(Sao.i18n.gettext(
|
||||
'"Compare" to see the modified version;')))
|
||||
.append(jQuery('<li/>')
|
||||
.text('"Write Anyway" to save your current version.')))
|
||||
.text(Sao.i18n.gettext(
|
||||
'"Write Anyway" to save your current version.'))))
|
||||
);
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button'
|
||||
}).append('Cancel').click(function() {
|
||||
}).append(Sao.i18n.gettext('Cancel')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.reject();
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-default',
|
||||
'type': 'button'
|
||||
}).append('Compare').click(function() {
|
||||
}).append(Sao.i18n.gettext('Compare')).click(function() {
|
||||
this.close(dialog);
|
||||
Sao.Tab.create({
|
||||
'model': model,
|
||||
@@ -2772,7 +2780,7 @@
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-default',
|
||||
'type': 'button'
|
||||
}).append('Write Anyway').click(function() {
|
||||
}).append(Sao.i18n.gettext('Write Anyway')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.resolve();
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
@@ -2788,7 +2796,7 @@
|
||||
this);
|
||||
dialog.modal.find('.modal-dialog'
|
||||
).removeClass('modal-sm').addClass('modal-lg');
|
||||
dialog.add_title('Application Error');
|
||||
dialog.add_title(Sao.i18n.gettext('Application Error'));
|
||||
dialog.body.append(jQuery('<div/>', {
|
||||
'class': 'alert alert-warning',
|
||||
role: 'alert'
|
||||
@@ -2797,7 +2805,7 @@
|
||||
'aria-hidden': true
|
||||
})).append(jQuery('<span/>', {
|
||||
'class': 'sr-only'
|
||||
}).append('Warning: ')
|
||||
}).append(Sao.i18n.gettext('Warning: '))
|
||||
).append(jQuery('<p/>')
|
||||
.append(jQuery('<pre/>')
|
||||
.text(details)))
|
||||
@@ -2806,11 +2814,11 @@
|
||||
'class': 'btn btn-link',
|
||||
href: Sao.config.roundup.url,
|
||||
target: '_blank'
|
||||
}).text('Report Bug'))));
|
||||
}).text(Sao.i18n.gettext('Report Bug')))));
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'button'
|
||||
}).append('Close').click(function() {
|
||||
}).append(Sao.i18n.gettext('Close')).click(function() {
|
||||
this.close(dialog);
|
||||
prm.resolve();
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
@@ -2829,7 +2837,7 @@
|
||||
});
|
||||
this.el.append(jQuery('<span/>', {
|
||||
'class': 'label label-info',
|
||||
'text': 'Processing…'
|
||||
'text': 'Processing...'
|
||||
}));
|
||||
this.el.hide();
|
||||
jQuery(function() {
|
||||
@@ -2871,14 +2879,14 @@
|
||||
if (entry.data('search')) {
|
||||
results.push({
|
||||
'id': 'search',
|
||||
'action': 'Search …',
|
||||
'action': Sao.i18n.gettext('Search...'),
|
||||
'query': query
|
||||
});
|
||||
}
|
||||
if (entry.data('create')) {
|
||||
results.push({
|
||||
'id': 'create',
|
||||
'action': 'Create …',
|
||||
'action': Sao.i18n.gettext('Create...'),
|
||||
'query': query
|
||||
});
|
||||
}
|
||||
|
||||
+2
-1
@@ -28,7 +28,8 @@
|
||||
|
||||
var ajax_success = function(data) {
|
||||
if (data === null) {
|
||||
Sao.common.warning.run('', 'Unable to reach the server');
|
||||
Sao.common.warning.run('',
|
||||
Sao.i18n.gettext('Unable to reach the server'));
|
||||
dfd.reject();
|
||||
} else if (data.error) {
|
||||
var name, msg, description;
|
||||
|
||||
+24
-4
@@ -166,6 +166,19 @@ var Sao = {};
|
||||
Sao.config.roundup = {};
|
||||
Sao.config.roundup.url = 'http://bugs.tryton.org/roundup/';
|
||||
|
||||
Sao.i18n = i18n();
|
||||
Sao.i18n.setlang = function(lang) {
|
||||
Sao.i18n.setLocale(lang);
|
||||
return jQuery.getJSON('locale/' + lang + '.json', function(data) {
|
||||
Sao.i18n.loadJSON(data);
|
||||
});
|
||||
};
|
||||
Sao.i18n.setlang(
|
||||
(navigator.language ||
|
||||
navigator.browserLanguge ||
|
||||
navigator.userLanguage ||
|
||||
'en_US').replace('-', '_'));
|
||||
|
||||
Sao.get_preferences = function() {
|
||||
var session = Sao.Session.current_session;
|
||||
return Sao.rpc({
|
||||
@@ -186,8 +199,15 @@ var Sao = {};
|
||||
title += ' - ' + preferences.status_bar;
|
||||
}
|
||||
document.title = title;
|
||||
// TODO language
|
||||
return jQuery.when(preferences);
|
||||
var new_lang = preferences.language != Sao.i18n.getLocale();
|
||||
var prm = jQuery.Deferred();
|
||||
Sao.i18n.setlang(preferences.language).always(function() {
|
||||
if (new_lang) {
|
||||
Sao.user_menu(preferences);
|
||||
}
|
||||
prm.resolve(preferences);
|
||||
});
|
||||
return prm;
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -236,7 +256,7 @@ var Sao = {};
|
||||
}).click(Sao.preferences).append(preferences.status_bar));
|
||||
jQuery('#user-logout').append(jQuery('<a/>', {
|
||||
'href': '#'
|
||||
}).click(Sao.logout).append('Logout'));
|
||||
}).click(Sao.logout).append(Sao.i18n.gettext('Logout')));
|
||||
};
|
||||
|
||||
Sao.menu = function(preferences) {
|
||||
@@ -314,7 +334,7 @@ var Sao = {};
|
||||
});
|
||||
this.search_entry = jQuery('<input>', {
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Search…'
|
||||
'placeholder': Sao.i18n.gettext('Search...')
|
||||
});
|
||||
this.el.append(this.search_entry);
|
||||
this.search_entry.typeahead({
|
||||
|
||||
+27
-18
@@ -22,11 +22,11 @@
|
||||
this.filter_button = jQuery('<button/>', {
|
||||
type: 'button',
|
||||
'class': 'btn btn-default'
|
||||
}).append('Filters'); // TODO translation
|
||||
}).append(Sao.i18n.gettext('Filters'));
|
||||
this.filter_button.click(this.search_box.bind(this));
|
||||
this.search_entry = jQuery('<input/>', {
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Search'
|
||||
'placeholder': Sao.i18n.gettext('Search')
|
||||
});
|
||||
this.search_entry.keypress(this.key_press.bind(this));
|
||||
this.but_bookmark = jQuery('<button/>', {
|
||||
@@ -34,7 +34,7 @@
|
||||
'class': 'btn btn-default dropdown-toggle',
|
||||
'data-toggle': 'dropdown',
|
||||
'aria-expanded': false,
|
||||
'aria-label': 'Bookmarks',
|
||||
'aria-label': Sao.i18n.gettext('Bookmarks'),
|
||||
'id': 'bookmarks'
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-bookmark',
|
||||
@@ -97,7 +97,7 @@
|
||||
this.but_prev = jQuery('<button/>', {
|
||||
type: 'button',
|
||||
'class': 'btn btn-default',
|
||||
'aria-label': 'Previous'
|
||||
'aria-label': Sao.i18n.gettext('Previous')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-menu-left',
|
||||
'aria-hidden': true
|
||||
@@ -106,7 +106,7 @@
|
||||
this.but_next = jQuery('<button/>', {
|
||||
type: 'button',
|
||||
'class': 'btn btn-default',
|
||||
'aria-label': 'Next'
|
||||
'aria-label': Sao.i18n.gettext('Next')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-menu-right',
|
||||
'aria-hidden': true
|
||||
@@ -181,11 +181,13 @@
|
||||
if (star) {
|
||||
glyphicon.removeClass('glyphicon-star-empty');
|
||||
glyphicon.addClass('glyphicon-star');
|
||||
this.but_star.attr('aria-label', 'Remove this bookmark');
|
||||
this.but_star.attr('aria-label',
|
||||
Sao.i18n.gettext('Remove this bookmark'));
|
||||
} else {
|
||||
glyphicon.removeClass('glyphicon-star');
|
||||
glyphicon.addClass('glyphicon-star-empty');
|
||||
this.but_star.attr('aria-label', 'Bookmark this filter');
|
||||
this.but_star.attr('aria-label',
|
||||
Sao.i18n.gettext('Bookmark this filter'));
|
||||
}
|
||||
},
|
||||
get_star: function() {
|
||||
@@ -205,7 +207,7 @@
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
Sao.common.ask.run('Bookmark Name:')
|
||||
Sao.common.ask.run(Sao.i18n.gettext('Bookmark Name:'))
|
||||
.then(function(name) {
|
||||
if (!name) {
|
||||
return;
|
||||
@@ -349,7 +351,8 @@
|
||||
}.bind(this));
|
||||
}.bind(this);
|
||||
if (!this.search_modal) {
|
||||
var dialog = new Sao.Dialog('Filters', '', 'lg');
|
||||
var dialog = new Sao.Dialog(
|
||||
Sao.i18n.gettext('Filters'), '', 'lg');
|
||||
this.search_modal = dialog.modal;
|
||||
this.search_form = dialog.content;
|
||||
this.search_form.addClass('form-horizontal');
|
||||
@@ -401,8 +404,9 @@
|
||||
'class': 'form-control input-sm',
|
||||
id: prefix + field.name
|
||||
});
|
||||
// TODO translate
|
||||
['', 'True', 'False'].forEach(
|
||||
['',
|
||||
Sao.i18n.gettext('True'),
|
||||
Sao.i18n.gettext('False')].forEach(
|
||||
boolean_option(input));
|
||||
break;
|
||||
case 'selection':
|
||||
@@ -449,7 +453,8 @@
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
type: 'submit'
|
||||
}).append('Find').click(search).appendTo(dialog.footer);
|
||||
}).append(Sao.i18n.gettext('Find'))
|
||||
.click(search).appendTo(dialog.footer);
|
||||
}
|
||||
this.search_modal.modal('show');
|
||||
if (this.last_search_text.trim() !== this.get_text().trim()) {
|
||||
@@ -1070,11 +1075,15 @@
|
||||
dom_fields[name] = fields[name];
|
||||
});
|
||||
[
|
||||
['id', 'ID', 'integer'],
|
||||
['create_uid', 'Creation User', 'many2one'],
|
||||
['create_date', 'Creation Date', 'datetime'],
|
||||
['write_uid', 'Modification User', 'many2one'],
|
||||
['write_date', 'Modification Date', 'datetime']
|
||||
['id', Sao.i18n.gettext('ID'), 'integer'],
|
||||
['create_uid', Sao.i18n.gettext('Creation User'),
|
||||
'many2one'],
|
||||
['create_date', Sao.i18n.gettext('Creation Date'),
|
||||
'datetime'],
|
||||
['write_uid', Sao.i18n.gettext('Modification User'),
|
||||
'many2one'],
|
||||
['write_date', Sao.i18n.gettext('Modification Date'),
|
||||
'datetime']
|
||||
] .forEach(function(e) {
|
||||
var name = e[0];
|
||||
var string = e[1];
|
||||
@@ -1092,7 +1101,7 @@
|
||||
});
|
||||
if (!('id' in fields)) {
|
||||
fields.id = {
|
||||
'string': 'ID', // TODO translate
|
||||
'string': Sao.i18n.gettext('ID'),
|
||||
'name': 'id',
|
||||
'type': 'integer'
|
||||
};
|
||||
|
||||
+98
-32
@@ -30,7 +30,8 @@
|
||||
|
||||
var ajax_success = function(data) {
|
||||
if (data === null) {
|
||||
Sao.common.warning.run('', 'Unable to reach the server.');
|
||||
Sao.common.warning.run('',
|
||||
Sao.i18n.gettext('Unable to reach the server.'));
|
||||
dfd.reject();
|
||||
} else if (data.error) {
|
||||
Sao.common.error.run(data.error[0], data.error[1]);
|
||||
@@ -81,21 +82,63 @@
|
||||
}
|
||||
});
|
||||
|
||||
Sao.Session.login_dialog = function() {
|
||||
var dialog = new Sao.Dialog(Sao.i18n.gettext('Login'), 'lg');
|
||||
dialog.database_select = jQuery('<select/>', {
|
||||
'class': 'form-control',
|
||||
'id': 'login-database'
|
||||
});
|
||||
dialog.login_input = jQuery('<input/>', {
|
||||
'class': 'form-control',
|
||||
'id': 'login-login',
|
||||
'placeholder': Sao.i18n.gettext('Login')
|
||||
});
|
||||
dialog.password_input = jQuery('<input/>', {
|
||||
'class': 'form-control',
|
||||
'type': 'password',
|
||||
'id': 'login-password',
|
||||
'placeholder': Sao.i18n.gettext('Password')
|
||||
});
|
||||
dialog.body.append(jQuery('<div/>', {
|
||||
'class': 'form-group'
|
||||
}).append(jQuery('<label/>', {
|
||||
'for': 'login-database'
|
||||
}).append(Sao.i18n.gettext('Database')))
|
||||
.append(dialog.database_select)
|
||||
).append(jQuery('<div/>', {
|
||||
'class': 'form-group'
|
||||
}).append(jQuery('<label/>', {
|
||||
'for': 'login-login'
|
||||
}).append(Sao.i18n.gettext('Login')))
|
||||
.append(dialog.login_input)
|
||||
).append(jQuery('<div/>', {
|
||||
'class': 'form-group'
|
||||
}).append(jQuery('<label/>', {
|
||||
'for': 'login-password'
|
||||
}).append(Sao.i18n.gettext('Password')))
|
||||
.append(dialog.password_input));
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'submit'
|
||||
}).append(Sao.i18n.gettext('Login')).appendTo(dialog.footer);
|
||||
dialog.modal.on('hidden.bs.modal', function(event) {
|
||||
jQuery(this).remove();
|
||||
});
|
||||
return dialog;
|
||||
};
|
||||
|
||||
Sao.Session.get_credentials = function() {
|
||||
var dfd = jQuery.Deferred();
|
||||
var database = window.location.hash.replace(
|
||||
/^(#(!|))/, '') || null;
|
||||
var database_select = jQuery('#login-database');
|
||||
var login_input = jQuery('#login-login');
|
||||
var password_input = jQuery('#login-password');
|
||||
var login_modal = jQuery('#login');
|
||||
var dialog = Sao.Session.login_dialog();
|
||||
|
||||
var ok_func = function() {
|
||||
var login = login_input.val();
|
||||
var password = password_input.val();
|
||||
var login = dialog.login_input.val();
|
||||
var password = dialog.password_input.val();
|
||||
// clear the password as the input will stay in the DOM
|
||||
password_input.val('');
|
||||
var database = database || database_select.val();
|
||||
dialog.password_input.val('');
|
||||
var database = database || dialog.database_select.val();
|
||||
if (!(login && password)) {
|
||||
return;
|
||||
}
|
||||
@@ -104,79 +147,102 @@
|
||||
.then(function() {
|
||||
dfd.resolve(session);
|
||||
}, function() {
|
||||
login_modal.modal('show');
|
||||
dialog.modal.modal('show');
|
||||
});
|
||||
login_modal.modal('hide');
|
||||
dialog.modal.modal('hide');
|
||||
};
|
||||
|
||||
login_modal.modal({
|
||||
dialog.modal.modal({
|
||||
backdrop: false,
|
||||
keyboard: false
|
||||
});
|
||||
login_modal.on('shown.bs.modal', function() {
|
||||
dialog.modal.on('shown.bs.modal', function() {
|
||||
if (database) {
|
||||
if (!login_input.val()) {
|
||||
login_input.focus();
|
||||
if (!dialog.login_input.val()) {
|
||||
dialog.login_input.focus();
|
||||
} else {
|
||||
password_input.focus();
|
||||
dialog.password_input.focus();
|
||||
}
|
||||
} else {
|
||||
database_select.focus();
|
||||
dialog.database_select.focus();
|
||||
}
|
||||
});
|
||||
login_modal.find('form').unbind().submit(function(e) {
|
||||
dialog.modal.find('form').unbind().submit(function(e) {
|
||||
ok_func();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
jQuery.when(Sao.DB.list()).then(function(databases) {
|
||||
databases.forEach(function(database) {
|
||||
database_select.append(jQuery('<option/>', {
|
||||
dialog.database_select.append(jQuery('<option/>', {
|
||||
'value': database,
|
||||
'text': database
|
||||
}));
|
||||
});
|
||||
if (database) {
|
||||
database_select.val(database);
|
||||
dialog.database_select.val(database);
|
||||
}
|
||||
login_modal.modal('show');
|
||||
dialog.modal.modal('show');
|
||||
});
|
||||
return dfd.promise();
|
||||
};
|
||||
|
||||
Sao.Session.password_dialog = function() {
|
||||
var dialog = new Sao.Dialog(Sao.i18n.gettext('Password'), 'lg');
|
||||
dialog.password_input = jQuery('<input/>', {
|
||||
'class': 'form-control',
|
||||
'tye': 'password',
|
||||
'id': 'password-password',
|
||||
'placeholder': Sao.i18n.gettext('Password')
|
||||
});
|
||||
dialog.body.append(jQuery('<div/>', {
|
||||
'class': 'form-group'
|
||||
}).append(jQuery('<label/>', {
|
||||
'for': 'password-password'
|
||||
}).append(Sao.i18n.gettext('Password')))
|
||||
.append(dialog.password_input));
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'submit'
|
||||
}).append(Sao.i18n.gettext('OK')).appendTo(dialog.footer);
|
||||
dialog.modal.on('hidden.bs.modal', function(event) {
|
||||
jQuery(this).remove();
|
||||
});
|
||||
return dialog;
|
||||
};
|
||||
|
||||
Sao.Session.renew = function(session) {
|
||||
var dfd = jQuery.Deferred();
|
||||
var password_modal = jQuery('#password');
|
||||
var password_input = jQuery('#password-password');
|
||||
var dialog = Sao.Session.password_dialog();
|
||||
if (!session.login) {
|
||||
return dfd.reject();
|
||||
}
|
||||
|
||||
var ok_func = function() {
|
||||
var password = password_input.val();
|
||||
var password = dialog.password_input.val();
|
||||
// clear the password as the input will stay in the DOM
|
||||
password_input.val('');
|
||||
dialog.password_input.val('');
|
||||
session.do_login(session.login, password)
|
||||
.then(function() {
|
||||
dfd.resolve();
|
||||
}, function() {
|
||||
password_modal.modal('show');
|
||||
dialog.modal.modal('show');
|
||||
});
|
||||
password_modal.modal('hide');
|
||||
dialog.modal.modal('hide');
|
||||
};
|
||||
|
||||
password_modal.modal({
|
||||
dialog.modal.modal({
|
||||
backdrop: false,
|
||||
keyboard: false
|
||||
});
|
||||
password_modal.on('shown.bs.modal', function() {
|
||||
password_input.focus();
|
||||
dialog.modal.on('shown.bs.modal', function() {
|
||||
dialog.password_input.focus();
|
||||
});
|
||||
password_modal.find('form').unbind().submit(function(e) {
|
||||
dialog.modal.find('form').unbind().submit(function(e) {
|
||||
ok_func();
|
||||
e.preventDefault();
|
||||
});
|
||||
password_modal.modal('show');
|
||||
dialog.modal.modal('show');
|
||||
return dfd.promise();
|
||||
};
|
||||
|
||||
|
||||
+74
-51
@@ -45,7 +45,9 @@
|
||||
'<button type="button" class="navbar-toggle collapsed" ' +
|
||||
'data-toggle="collapse" ' +
|
||||
'data-target="#navbar-' + this.id + '">' +
|
||||
'<span class="sr-only">Toggle navigation</span>' +
|
||||
'<span class="sr-only">' +
|
||||
Sao.i18n.gettext('Toggle navigation') +
|
||||
'</span>' +
|
||||
'<span class="icon-bar"></span>' +
|
||||
'<span class="icon-bar"></span>' +
|
||||
'<span class="icon-bar"></span>' +
|
||||
@@ -59,7 +61,9 @@
|
||||
'aria-expanded="false">' +
|
||||
'<span class="glyphicon glyphicon-wrench" ' +
|
||||
'aria-hidden="true"></span>' +
|
||||
'<span class="visible-xs">Menu</span>' +
|
||||
'<span class="visible-xs">' +
|
||||
Sao.i18n.gettext('Menu') +
|
||||
'</span>' +
|
||||
'<span class="caret"></span>' +
|
||||
'</a>' +
|
||||
'<ul class="dropdown-menu" role="menu">' +
|
||||
@@ -123,10 +127,11 @@
|
||||
Sao.Tab.tabs.close = function(warning) {
|
||||
if (warning && Sao.Tab.tabs.length) {
|
||||
return Sao.common.sur.run(
|
||||
'The following action requires to close all tabs.\n' +
|
||||
'Do you want to continue?').then(function() {
|
||||
return Sao.Tab.tabs.close(false);
|
||||
});
|
||||
Sao.i18n.gettext(
|
||||
'The following action requires to close all tabs.\n' +
|
||||
'Do you want to continue?')).then(function() {
|
||||
return Sao.Tab.tabs.close(false);
|
||||
});
|
||||
}
|
||||
if (Sao.Tab.tabs.length) {
|
||||
var tab = Sao.Tab.tabs[0];
|
||||
@@ -182,7 +187,7 @@
|
||||
'aria-hidden': true
|
||||
}).append('×')).append(jQuery('<span/>', {
|
||||
'class': 'sr-only'
|
||||
}).append('Close')).click(function() {
|
||||
}).append(Sao.i18n.gettext('Close'))).click(function() {
|
||||
tab.close();
|
||||
}))
|
||||
.append(tab.name_el);
|
||||
@@ -246,36 +251,48 @@
|
||||
this.update_revision();
|
||||
}.bind(this));
|
||||
},
|
||||
// TODO translate labels
|
||||
toolbar_def: [
|
||||
['new', 'glyphicon-edit', 'New', 'Create a new record', 'new_'],
|
||||
['save', 'glyphicon-save', 'Save', 'Save this record', 'save'],
|
||||
['switch', 'glyphicon-list-alt', 'Switch', 'Switch view',
|
||||
'switch_'],
|
||||
['reload', 'glyphicon-refresh', 'Reload', 'Reload', 'reload'],
|
||||
['previous', 'glyphicon-chevron-left', 'Previous',
|
||||
'Previous Record', 'previous'],
|
||||
['next', 'glyphicon-chevron-right', 'Next', 'Next Record', 'next'],
|
||||
['attach', 'glyphicon-paperclip', 'Attachment',
|
||||
'Add an attachment to the record', 'attach']
|
||||
['new', 'glyphicon-edit',
|
||||
Sao.i18n.gettext('New'),
|
||||
Sao.i18n.gettext('Create a new record'), 'new_'],
|
||||
['save', 'glyphicon-save',
|
||||
Sao.i18n.gettext('Save'),
|
||||
Sao.i18n.gettext('Save this record'), 'save'],
|
||||
['switch', 'glyphicon-list-alt',
|
||||
Sao.i18n.gettext('Switch'),
|
||||
Sao.i18n.gettext('Switch view'), 'switch_'],
|
||||
['reload', 'glyphicon-refresh',
|
||||
Sao.i18n.gettext('Reload'),
|
||||
Sao.i18n.gettext('Reload'), 'reload'],
|
||||
['previous', 'glyphicon-chevron-left',
|
||||
Sao.i18n.gettext('Previous'),
|
||||
Sao.i18n.gettext('Previous Record'), 'previous'],
|
||||
['next', 'glyphicon-chevron-right',
|
||||
Sao.i18n.gettext('Next'),
|
||||
Sao.i18n.gettext('Next Record'), 'next'],
|
||||
['attach', 'glyphicon-paperclip',
|
||||
Sao.i18n.gettext('Attachment'),
|
||||
Sao.i18n.gettext('Add an attachment to the record'), 'attach']
|
||||
],
|
||||
menu_def: [
|
||||
['glyphicon-edit', 'New', 'new_'],
|
||||
['glyphicon-save', 'Save', 'save'],
|
||||
['glyphicon-list-alt', 'Switch', 'switch_'],
|
||||
['glyphicon-refresh', 'Reload/Undo', 'reload'],
|
||||
['glyphicon-duplicate', 'Duplicate', 'copy'],
|
||||
['glyphicon-trash', 'Delete', 'delete_'],
|
||||
['glyphicon-chevron-left', 'Previous', 'previous'],
|
||||
['glyphicon-chevron-right', 'Next', 'next'],
|
||||
['glyphicon-search', 'Search', 'search'],
|
||||
['glyphicon-time', 'View Logs...', 'logs'],
|
||||
['glyphicon-time', 'Show revisions...', 'revision'],
|
||||
['glyphicon-remove', 'Close Tab', 'close'],
|
||||
['glyphicon-paperclip', 'Attachment', 'attach'],
|
||||
['glyphicon-cog', 'Action', 'action'],
|
||||
['glyphicon-share-alt', 'Relate', 'relate'],
|
||||
['glyphicon-print', 'Print', 'print']
|
||||
['glyphicon-edit', Sao.i18n.gettext('New'), 'new_'],
|
||||
['glyphicon-save', Sao.i18n.gettext('Save'), 'save'],
|
||||
['glyphicon-list-alt', Sao.i18n.gettext('Switch'), 'switch_'],
|
||||
['glyphicon-refresh', Sao.i18n.gettext('Reload/Undo'), 'reload'],
|
||||
['glyphicon-duplicate', Sao.i18n.gettext('Duplicate'), 'copy'],
|
||||
['glyphicon-trash', Sao.i18n.gettext('Delete'), 'delete_'],
|
||||
['glyphicon-chevron-left', Sao.i18n.gettext('Previous'),
|
||||
'previous'],
|
||||
['glyphicon-chevron-right', Sao.i18n.gettext('Next'), 'next'],
|
||||
['glyphicon-search', Sao.i18n.gettext('Search'), 'search'],
|
||||
['glyphicon-time', Sao.i18n.gettext('View Logs...'), 'logs'],
|
||||
['glyphicon-time', Sao.i18n.gettext('Show revisions...'),
|
||||
'revision'],
|
||||
['glyphicon-remove', Sao.i18n.gettext('Close Tab'), 'close'],
|
||||
['glyphicon-paperclip', Sao.i18n.gettext('Attachment'), 'attach'],
|
||||
['glyphicon-cog', Sao.i18n.gettext('Action'), 'action'],
|
||||
['glyphicon-share-alt', Sao.i18n.gettext('Relate'), 'relate'],
|
||||
['glyphicon-print', Sao.i18n.gettext('Print'), 'print']
|
||||
],
|
||||
create_toolbar: function() {
|
||||
var toolbar = Sao.Tab.Form._super.create_toolbar.call(this);
|
||||
@@ -284,12 +301,16 @@
|
||||
var prm = screen.model.execute('view_toolbar_get', [],
|
||||
screen.context);
|
||||
prm.done(function(toolbars) {
|
||||
// TODO translation
|
||||
[
|
||||
['action', 'glyphicon-cog', 'Action', 'Launch action'],
|
||||
['relate', 'glyphicon-share-alt', 'Relate',
|
||||
'Open related records'],
|
||||
['print', 'glyphicon-print', 'Print', 'Print report']
|
||||
['action', 'glyphicon-cog',
|
||||
Sao.i18n.gettext('Action'),
|
||||
Sao.i18n.gettext('Launch action')],
|
||||
['relate', 'glyphicon-share-alt',
|
||||
Sao.i18n.gettext('Relate'),
|
||||
Sao.i18n.gettext('Open related records')],
|
||||
['print', 'glyphicon-print',
|
||||
Sao.i18n.gettext('Print'),
|
||||
Sao.i18n.gettext('Print report')]
|
||||
].forEach(function(menu_action) {
|
||||
var button = jQuery('<li/>', {
|
||||
'class': 'dropdown'
|
||||
@@ -387,8 +408,9 @@
|
||||
this.screen.save_tree_state();
|
||||
this.screen.current_view.set_value();
|
||||
if (this.screen.modified()) {
|
||||
return Sao.common.sur_3b.run('This record has been modified\n' +
|
||||
'do you want to save it?')
|
||||
return Sao.common.sur_3b.run(
|
||||
Sao.i18n.gettext('This record has been modified\n' +
|
||||
'do you want to save it?'))
|
||||
.then(function(result) {
|
||||
switch(result) {
|
||||
case 'ok':
|
||||
@@ -462,9 +484,9 @@
|
||||
}
|
||||
var msg;
|
||||
if (this.screen.current_view.view_type == 'form') {
|
||||
msg = 'Are you sure to remove this record?'; // TODO translate
|
||||
msg = Soa.i18n.gettext('Are you sure to remove this record?');
|
||||
} else {
|
||||
msg = 'Are you sure to remove those records?';
|
||||
msg = Sao.i18n.gettext('Are you sure to remove those records?');
|
||||
}
|
||||
Sao.common.sur.run(msg).done(function() {
|
||||
this.screen.remove(true, false, true).done(function() {
|
||||
@@ -498,13 +520,14 @@
|
||||
// TODO message
|
||||
return;
|
||||
}
|
||||
// TODO translation
|
||||
var fields = [
|
||||
['id', 'ID:'],
|
||||
['create_uid.rec_name', 'Creation User:'],
|
||||
['create_date', 'Creation Date:'],
|
||||
['write_uid.rec_name', 'Latest Modification by:'],
|
||||
['write_date', 'Latest Modification Date:']
|
||||
['id', Sao.i18n.gettext('ID:')],
|
||||
['create_uid.rec_name',
|
||||
Sao.i18n.gettext('Creation User:')],
|
||||
['create_date', Sao.i18n.gettext('Creation Date:')],
|
||||
['write_uid.rec_name',
|
||||
Sao.i18n.gettext('Latest Modification by:')],
|
||||
['write_date', Sao.i18n.gettext('Latest Modification Date:')]
|
||||
];
|
||||
|
||||
this.screen.model.execute('read', [[record.id],
|
||||
@@ -527,7 +550,7 @@
|
||||
}
|
||||
message += label + ' ' + value + '\n';
|
||||
});
|
||||
message += 'Model: ' + this.screen.model.name;
|
||||
message += Sao.i18n.gettext('Model: ') + this.screen.model.name;
|
||||
Sao.common.message.run(message);
|
||||
}.bind(this));
|
||||
},
|
||||
@@ -611,7 +634,7 @@
|
||||
}
|
||||
},
|
||||
attachment_count: function(count) {
|
||||
var label = 'Attachment(' + count + ')'; // TODO translate
|
||||
var label = Sao.i18n.gettext('Attachment(%1)', count);
|
||||
this.buttons.attach.text(label);
|
||||
var record_id = this.screen.get_id();
|
||||
this.buttons.attach.prop('disabled',
|
||||
|
||||
+17
-16
@@ -149,7 +149,7 @@
|
||||
'class': 'treefooter'
|
||||
});
|
||||
this.more = jQuery('<button/>').button({
|
||||
'label': 'More' // TODO translation
|
||||
'label': Sao.i18n.gettext('More')
|
||||
}).click(function() {
|
||||
this.display_size += Sao.config.display_size;
|
||||
this.display();
|
||||
@@ -1443,7 +1443,7 @@
|
||||
}
|
||||
}
|
||||
if (!text) {
|
||||
text = 'No String Attr.'; // TODO translate
|
||||
text = Sao.i18n.gettext('No String Attr.');
|
||||
}
|
||||
var page = this.parse(model, node);
|
||||
page = new Sao.View.Form.Page(container.add(page.el, text),
|
||||
@@ -2907,7 +2907,7 @@
|
||||
//
|
||||
this.but_add = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'aria-label': 'Add'
|
||||
'aria-label': Sao.i18n.gettext('Add')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-plus'
|
||||
})).appendTo(buttons);
|
||||
@@ -2915,7 +2915,7 @@
|
||||
|
||||
this.but_remove = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'aria-label': 'Remove'
|
||||
'aria-label': Sao.i18n.gettext('Remove')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-minus'
|
||||
})).appendTo(buttons);
|
||||
@@ -2924,7 +2924,7 @@
|
||||
|
||||
this.but_new = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'aria-label': 'New'
|
||||
'aria-label': Sao.i18n.gettext('New')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-edit'
|
||||
})).appendTo(buttons);
|
||||
@@ -2932,7 +2932,7 @@
|
||||
|
||||
this.but_open = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'aria-label': 'Open'
|
||||
'aria-label': Sao.i18n.gettext('Open')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-folder-open'
|
||||
})).appendTo(buttons);
|
||||
@@ -2940,7 +2940,7 @@
|
||||
|
||||
this.but_del = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'aria-label': 'Delete'
|
||||
'aria-label': Sao.i18n.gettext('Delete')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-trash'
|
||||
})).appendTo(buttons);
|
||||
@@ -2948,7 +2948,7 @@
|
||||
|
||||
this.but_undel = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'aria-label': 'Undelete'
|
||||
'aria-label': Sao.i18n.gettext('Undelete')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-repeat'
|
||||
})).appendTo(buttons);
|
||||
@@ -2956,7 +2956,7 @@
|
||||
|
||||
this.but_previous = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'aria-label': 'Previous'
|
||||
'aria-label': Sao.i18n.gettext('Previous')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-chevron-left'
|
||||
})).appendTo(buttons);
|
||||
@@ -2969,7 +2969,7 @@
|
||||
|
||||
this.but_next = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'aria-label': 'Next'
|
||||
'aria-label': Sao.i18n.gettext('Next')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-chevron-right'
|
||||
})).appendTo(buttons);
|
||||
@@ -2977,7 +2977,7 @@
|
||||
|
||||
this.but_switch = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'aria-label': 'Switch'
|
||||
'aria-label': Sao.i18n.gettext('Switch')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-list-alt'
|
||||
})).appendTo(buttons);
|
||||
@@ -3297,7 +3297,7 @@
|
||||
}).appendTo(group);
|
||||
this.but_add = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'aria-label': 'Add'
|
||||
'aria-label': Sao.i18n.gettext('Add')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-plus'
|
||||
})).appendTo(buttons);
|
||||
@@ -3305,7 +3305,7 @@
|
||||
|
||||
this.but_remove = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'aria-label': 'Remove'
|
||||
'aria-label': Sao.i18n.gettext('Remove')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-minus'
|
||||
})).appendTo(buttons);
|
||||
@@ -3637,15 +3637,16 @@
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
var file_dialog = new Sao.Dialog('Select a file', 'file-dialog');
|
||||
var file_dialog = new Sao.Dialog(
|
||||
Sao.i18n.gettext('Select a file'), 'file-dialog');
|
||||
file_dialog.footer.append(jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button'
|
||||
}).append('Cancel').click(close))
|
||||
}).append(Sao.i18n.gettext('Cancel')).click(close))
|
||||
.append(jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'submit'
|
||||
}).append('OK').click(save_file));
|
||||
}).append(Sao.i18n.gettext('OK')).click(save_file));
|
||||
file_dialog.content.submit(function(e) {
|
||||
save_file();
|
||||
e.preventDefault();
|
||||
|
||||
+23
-22
@@ -46,7 +46,7 @@
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button'
|
||||
}).append(!kwargs.new_ && this.screen.current_record.id < 0 ?
|
||||
'Delete' : 'Cancel')
|
||||
Sao.i18n.gettext('Delete') : Sao.i18n.gettext('Cancel'))
|
||||
.click(function() {
|
||||
this.response('RESPONSE_CANCEL');
|
||||
}.bind(this)));
|
||||
@@ -56,7 +56,7 @@
|
||||
dialog.footer.append(jQuery('<button/>', {
|
||||
'class': 'btn btn-default',
|
||||
'type': 'button'
|
||||
}).append('New').click(function() {
|
||||
}).append(Sao.i18n.gettext('New')).click(function() {
|
||||
this.response('RESPONSE_ACCEPT');
|
||||
}.bind(this)));
|
||||
}
|
||||
@@ -65,12 +65,12 @@
|
||||
dialog.footer.append(jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'submit'
|
||||
}).append('Save'));
|
||||
}).append(Sao.i18n.gettext('Save')));
|
||||
} else {
|
||||
dialog.footer.append(jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'submit'
|
||||
}).append('OK'));
|
||||
}).append(Sao.i18n.gettext('OK')));
|
||||
}
|
||||
dialog.content.submit(function(e) {
|
||||
this.response('RESPONSE_OK');
|
||||
@@ -98,7 +98,7 @@
|
||||
this.but_add = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'type': 'button',
|
||||
'aria-label': 'Add'
|
||||
'aria-label': Sao.i18n.gettext('Add')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-plus'
|
||||
})).appendTo(buttons);
|
||||
@@ -108,7 +108,7 @@
|
||||
this.but_remove = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'type': 'button',
|
||||
'aria-label': 'Remove'
|
||||
'aria-label': Sao.i18n.gettext('Remove')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-minus'
|
||||
})).appendTo(buttons);
|
||||
@@ -119,7 +119,7 @@
|
||||
this.but_new = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'type': 'button',
|
||||
'aria-label': 'New'
|
||||
'aria-label': Sao.i18n.gettext('New')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-edit'
|
||||
})).appendTo(buttons);
|
||||
@@ -129,7 +129,7 @@
|
||||
this.but_del = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'type': 'button',
|
||||
'aria-label': 'Delete'
|
||||
'aria-label': Sao.i18n.gettext('Delete')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-trash'
|
||||
})).appendTo(buttons);
|
||||
@@ -139,7 +139,7 @@
|
||||
this.but_undel = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'type': 'button',
|
||||
'aria-label': 'Undelete'
|
||||
'aria-label': Sao.i18n.gettext('Undelete')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-repeat'
|
||||
})).appendTo(buttons);
|
||||
@@ -149,7 +149,7 @@
|
||||
this.but_previous = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'type': 'button',
|
||||
'aria-label': 'Previous'
|
||||
'aria-label': Sao.i18n.gettext('Previous')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-chevron-left'
|
||||
})).appendTo(buttons);
|
||||
@@ -163,7 +163,7 @@
|
||||
this.but_next = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'type': 'button',
|
||||
'aria-label': 'Next'
|
||||
'aria-label': Sao.i18n.gettext('Next')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-chevron-right'
|
||||
})).appendTo(buttons);
|
||||
@@ -172,7 +172,7 @@
|
||||
this.but_switch = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm',
|
||||
'type': 'button',
|
||||
'aria-label': 'Switch'
|
||||
'aria-label': Sao.i18n.gettext('Switch')
|
||||
}).append(jQuery('<span/>', {
|
||||
'class': 'glyphicon glyphicon-list-alt'
|
||||
})).appendTo(buttons);
|
||||
@@ -355,27 +355,27 @@
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button'
|
||||
}).append('Cancel').click(function() {
|
||||
}).append(Sao.i18n.gettext('Cancel')).click(function() {
|
||||
this.response('RESPONSE_CANCEL');
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-default',
|
||||
'type': 'button'
|
||||
}).append('Find').click(function() {
|
||||
}).append(Sao.i18n.gettext('Find')).click(function() {
|
||||
this.response('RESPONSE_APPLY');
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
if (kwargs.new_ && Sao.common.MODELACCESS.get(model).create) {
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-default',
|
||||
'type': 'button'
|
||||
}).append('New').click(function() {
|
||||
}).append(Sao.i18n.gettext('New')).click(function() {
|
||||
this.response('RESPONSE_ACCEPT');
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
}
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'submit'
|
||||
}).append('OK').appendTo(dialog.footer);
|
||||
}).append(Sao.i18n.gettext('OK')).appendTo(dialog.footer);
|
||||
dialog.content.submit(function(e) {
|
||||
this.response('RESPONSE_OK');
|
||||
e.preventDefault();
|
||||
@@ -457,13 +457,13 @@
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button'
|
||||
}).append('Cancel').click(function() {
|
||||
}).append(Sao.i18n.gettext('Cancel')).click(function() {
|
||||
this.response('RESPONSE_CANCEL');
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'submit'
|
||||
}).append('OK').appendTo(dialog.footer);
|
||||
}).append(Sao.i18n.gettext('OK')).appendTo(dialog.footer);
|
||||
dialog.content.submit(function(e) {
|
||||
this.response('RESPONSE_OK');
|
||||
e.preventDefault();
|
||||
@@ -540,19 +540,20 @@
|
||||
Sao.Window.Revision = Sao.class_(Object, {
|
||||
init: function(revisions, callback) {
|
||||
this.callback = callback;
|
||||
var dialog = new Sao.Dialog('Revision', '', 'lg');
|
||||
var dialog = new Sao.Dialog(
|
||||
Sao.i18n.gettext('Revision'), '', 'lg');
|
||||
this.el = dialog.modal;
|
||||
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button'
|
||||
}).append('Cancel').click(function() {
|
||||
}).append(Sao.i18n.gettext('Cancel')).click(function() {
|
||||
this.response('RESPONSE_CANCEL');
|
||||
}.bind(this)).appendTo(dialog.footer);
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'submit'
|
||||
}).append('OK').appendTo(dialog.footer);
|
||||
}).append(Sao.i18n.gettext('OK')).appendTo(dialog.footer);
|
||||
dialog.content.submit(function(e) {
|
||||
this.response('RESPONSE_OK');
|
||||
e.preventDefault();
|
||||
@@ -568,7 +569,7 @@
|
||||
this.select = jQuery('<select/>', {
|
||||
'class': 'form-control',
|
||||
id: 'revision',
|
||||
'placeholder': 'Revision'
|
||||
'placeholder': Sao.i18n.gettext('Revision')
|
||||
}).appendTo(group);
|
||||
var date_format = Sao.common.date_format();
|
||||
var time_format = '%H:%M:%S.%f';
|
||||
|
||||
+1
-1
@@ -199,7 +199,7 @@
|
||||
Sao.Wizard.Dialog = Sao.class_(Sao.Wizard, { // TODO nomodal
|
||||
init: function(name) {
|
||||
if (!name) {
|
||||
name = 'Wizard'; // TODO translate
|
||||
name = Sao.i18n.gettext('Wizard');
|
||||
}
|
||||
Sao.Wizard.Dialog._super.init.call(this);
|
||||
var dialog = new Sao.Dialog(name, 'wizard-dialog', 'lg');
|
||||
|
||||
Reference in New Issue
Block a user