Made it possible to translate content upgrade script.

namespaces
Frode Petterson 2014-06-16 14:04:53 +02:00
parent 928e58c98b
commit f688e1b7ab
1 changed files with 6 additions and 8 deletions

View File

@ -1,8 +1,6 @@
(function ($) { (function ($) {
var info, $container; var info, $container;
// TODO: Translate all strings!
// Initialize // Initialize
$(document).ready(function () { $(document).ready(function () {
// Get library info // Get library info
@ -153,7 +151,7 @@
self.version = new Version(null, libraryId); self.version = new Version(null, libraryId);
// Create throbber with loading text and progress // Create throbber with loading text and progress
self.throbber = new Throbber('Upgrading to ' + self.version + '...'); self.throbber = new Throbber(info.inProgress.replace('%ver', self.version));
// Get the next batch // Get the next batch
self.nextBatch({ self.nextBatch({
@ -226,7 +224,7 @@
}, function (err) { }, function (err) {
// Finished with all parameters that came in // Finished with all parameters that came in
if (err) { if (err) {
return self.setStatus('<p>An error occurred while processing parameters:<br/>' + err + '</p>'); return self.setStatus('<p>' + info.error + '<br/>' + err + '</p>');
} }
// Save upgraded content and get next round of data to process // Save upgraded content and get next round of data to process
@ -292,12 +290,12 @@
dataType: 'json', dataType: 'json',
url: info.libraryBaseUrl + '/' + name + '/' + version.major + '/' + version.minor url: info.libraryBaseUrl + '/' + name + '/' + version.major + '/' + version.minor
}).fail(function () { }).fail(function () {
next('Could not load data for library ' + name + ' ' + version); next(info.errorData.replace('%lib', name + ' ' + version));
}).done(function (library) { }).done(function (library) {
if (library.upgradesScript) { if (library.upgradesScript) {
self.loadScript(library.upgradesScript, function (err) { self.loadScript(library.upgradesScript, function (err) {
if (err) { if (err) {
err = name + ' ' + version + ': ' + err; err = info.errorScript.replace('%lib', name + ' ' + version);
} }
next(err, library); next(err, library);
}); });
@ -320,7 +318,7 @@
cache: true, cache: true,
url: url url: url
}).fail(function () { }).fail(function () {
next('Could not load upgrades script.'); next(true);
}).done(function () { }).done(function () {
next(); next();
}); });