Updated translation support

This commit is contained in:
Andris Reinman 2017-03-07 16:30:56 +02:00
parent b1e8cd68cd
commit d25565b6f8
114 changed files with 42095 additions and 1902 deletions

View file

@ -2,6 +2,7 @@
let db = require('../db');
let tools = require('../tools');
let _ = require('../translate')._;
let allowedKeys = ['description', 'editor_name', 'editor_data', 'html', 'text'];
@ -47,7 +48,7 @@ module.exports.get = (id, callback) => {
id = Number(id) || 0;
if (id < 1) {
return callback(new Error('Missing Template ID'));
return callback(new Error(_('Missing Template ID')));
}
db.getConnection((err, connection) => {
@ -76,7 +77,7 @@ module.exports.create = (template, callback) => {
let data = tools.convertKeys(template);
if (!(data.name || '').toString().trim()) {
return callback(new Error('Template Name must be set'));
return callback(new Error(_('Template Name must be set')));
}
let name = (template.name || '').toString().trim();
@ -118,11 +119,11 @@ module.exports.update = (id, updates, callback) => {
let data = tools.convertKeys(updates);
if (id < 1) {
return callback(new Error('Missing Template ID'));
return callback(new Error(_('Missing Template ID')));
}
if (!(data.name || '').toString().trim()) {
return callback(new Error('Template Name must be set'));
return callback(new Error(_('Template Name must be set')));
}
let name = (updates.name || '').toString().trim();
@ -159,7 +160,7 @@ module.exports.delete = (id, callback) => {
id = Number(id) || 0;
if (id < 1) {
return callback(new Error('Missing Template ID'));
return callback(new Error(_('Missing Template ID')));
}
db.getConnection((err, connection) => {