From a073bf8a178df1b0d595dbfcaf66446491e5562a Mon Sep 17 00:00:00 2001 From: Miguel Angel Mulero Martinez Date: Thu, 28 Dec 2017 11:34:34 +0100 Subject: [PATCH] i180 release checker and changelog action --- _locales/en/messages.json | 14 +++++++++++++- js/release_checker.js | 8 ++++---- tabs/landing.js | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 4dd13e23..f96ccce4 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -220,6 +220,18 @@ "infoVersions": { "message" : "Running - OS: $1, Chrome: $2, Configurator: $3" }, + "releaseCheckLoaded": { + "message" : "Loaded release information for $1 from GitHub." + }, + "releaseCheckFailed": { + "message" : "GitHub query for $1 releases failed, using cached information. Reason: $2" + }, + "releaseCheckCached": { + "message" : "Using cached release information for $1 releases." + }, + "releaseCheckNoInfo": { + "message" : "No release information available for $1." + }, "tabSwitchConnectionRequired": { "message": "You need to connect before you can view any of the tabs." }, @@ -331,7 +343,7 @@ }, "defaultChangelogAction": { "message": "Changelog" - }, + }, "defaultChangelogHead": { "message": "Configurator - Changelog" }, diff --git a/js/release_checker.js b/js/release_checker.js index 6e2076a8..4c6e5ada 100644 --- a/js/release_checker.js +++ b/js/release_checker.js @@ -19,7 +19,7 @@ ReleaseChecker.prototype.loadReleaseData = function (processFunction) { var cachedReleaseLastUpdate = result[self._releaseLastUpdateTag]; if (!cacheReleaseData || !cachedReleaseLastUpdate || releaseDataTimestamp - cachedReleaseLastUpdate > 3600 * 1000) { $.get(self._releaseUrl, function (releaseData) { - GUI.log(`Loaded release information for ${self._releaseName} from GitHub.`); + GUI.log(chrome.i18n.getMessage('releaseCheckLoaded',[self._releaseName])); var data = {}; data[self._releaseDataTag] = releaseData @@ -32,13 +32,13 @@ ReleaseChecker.prototype.loadReleaseData = function (processFunction) { if (data['responseJSON']) { message = data['responseJSON'].message; } - GUI.log(`GitHub query for ${self._releaseName} releases failed, using cached information. Reason: ${message}`); + GUI.log(chrome.i18n.getMessage('releaseCheckFailed',[self._releaseName,message])); self._processReleaseData(cacheReleaseData, processFunction); }); } else { if (cacheReleaseData) { - GUI.log(`Using cached release information for ${self._releaseName} releases.`); + GUI.log(chrome.i18n.getMessage('releaseCheckCached',[self._releaseName])); } self._processReleaseData(cacheReleaseData, processFunction); @@ -51,7 +51,7 @@ ReleaseChecker.prototype._processReleaseData = function (releaseData, processFun if (releaseData) { processFunction(releaseData); } else { - GUI.log(`No release information available for ${self._releaseName}.`); + GUI.log(chrome.i18n.getMessage('releaseCheckNoInfo',[self._releaseName])); processFunction(); } diff --git a/tabs/landing.js b/tabs/landing.js index e690a6d0..ed2560ad 100644 --- a/tabs/landing.js +++ b/tabs/landing.js @@ -28,7 +28,7 @@ TABS.landing.initialize = function (callback) { $("#content").addClass('log_open'); state = true; } - $(this).text(state ? 'Close' : 'Changelog'); + $(this).text(state ? chrome.i18n.getMessage('close') : chrome.i18n.getMessage('defaultChangelogAction')); $(this).data('state2', state); });