From 05089dc370eef18a58c2f9242af30a22b375baf1 Mon Sep 17 00:00:00 2001 From: gorhill Date: Thu, 7 May 2015 18:38:29 -0400 Subject: [PATCH] preparing for i18n + better defaults --- src/_locales/en/messages.json | 20 ++++++++++++++++++++ src/js/background.js | 4 ++-- src/js/browsercache.js | 2 +- src/js/cookies.js | 8 ++++---- src/js/storage.js | 2 +- src/js/useragent.js | 6 +++++- 6 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 6e52992..011ff04 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -587,6 +587,26 @@ "message": "filter expression(s)", "description": "Appears in the input filed where filter expressions are entered" }, + "loggerEntryUserAgentSpoofing" : { + "message": "spoofing user agent with: {{value}}", + "description": "An entry for when a new user agent string is selected" + }, + "loggerEntryCookieDeleted" : { + "message": "cookie deleted: {{value}}", + "description": "An entry for when a cookie is deleted" + }, + "loggerEntryDeleteCookieError" : { + "message": "browser cache cleared", + "description": "An entry for when the browser cache is cleared" + }, + "loggerEntryBrowserCacheCleared" : { + "message": "failed to delete cookie: {{value}}", + "description": "An entry for when a cookie can't be deleted" + }, + "loggerEntryAssetUpdated" : { + "message": "asset updated: {{value}}", + "description": "An entry for when an asset was updated" + }, "mainBlockedPrompt1": { "message": "uMatrix has prevented the following page from loading:", diff --git a/src/js/background.js b/src/js/background.js index d1bc7e1..7ffdc87 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -61,8 +61,8 @@ return { deleteLocalStorage: false, displayTextSize: '13px', externalHostsFiles: '', - iconBadgeEnabled: true, - maxLoggedRequests: 2000, + iconBadgeEnabled: false, + maxLoggedRequests: 1000, popupCollapseDomains: false, popupCollapseSpecificDomains: {}, popupHideBlacklisted: false, diff --git a/src/js/browsercache.js b/src/js/browsercache.js index e02c8fe..defb155 100644 --- a/src/js/browsercache.js +++ b/src/js/browsercache.js @@ -50,7 +50,7 @@ var clearCache = function() { µm.browserCacheClearedCounter++; // TODO: i18n - µm.logger.writeOne('', 'info', 'browser cache cleared'); + µm.logger.writeOne('', 'info', vAPI.i18n('loggerEntryBrowserCacheCleared')); //console.debug('clearBrowserCacheCallback()> vAPI.browserData.clearCache() called'); }; diff --git a/src/js/cookies.js b/src/js/cookies.js index ebacfb0..0887c24 100644 --- a/src/js/cookies.js +++ b/src/js/cookies.js @@ -296,18 +296,18 @@ var chromeCookieRemove = function(url, name) { var success = !!details; if ( removeCookieFromDict(sessionCookieKey) ) { if ( success ) { - µm.logger.writeOne('', 'info', 'cookie deleted: ' + sessionCookieKey); + µm.logger.writeOne('', 'info', vAPI.i18n('loggerEntryCookieDeleted').replace('{{value}}', sessionCookieKey)); µm.cookieRemovedCounter += 1; } else { - µm.logger.writeOne('', 'error', 'failed to delete cookie: ' + sessionCookieKey); + µm.logger.writeOne('', 'error', vAPI.i18n('loggerEntryDeleteCookieError').replace('{{value}}', sessionCookieKey)); } } if ( removeCookieFromDict(persistCookieKey) ) { if ( success ) { - µm.logger.writeOne('', 'info', 'cookie deleted: ' + persistCookieKey); + µm.logger.writeOne('', 'info', vAPI.i18n('loggerEntryCookieDeleted').replace('{{value}}', persistCookieKey)); µm.cookieRemovedCounter += 1; } else { - µm.logger.writeOne('', 'error', 'failed to delete cookie: ' + persistCookieKey); + µm.logger.writeOne('', 'error', vAPI.i18n('loggerEntryDeleteCookieError').replace('{{value}}', persistCookieKey)); } } }; diff --git a/src/js/storage.js b/src/js/storage.js index 1e301da..e140456 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -408,7 +408,7 @@ var path = details.path || ''; if ( path !== '' ) { - this.logger.writeOne('', 'info', 'asset updated: ' + path); + this.logger.writeOne('', 'info', vAPI.i18n('loggerEntryAssetUpdated').replace('{{value}}', path)); } if ( this.liveHostsFiles.hasOwnProperty(path) === false ) { diff --git a/src/js/useragent.js b/src/js/useragent.js index 7ca264c..98ed672 100644 --- a/src/js/useragent.js +++ b/src/js/useragent.js @@ -60,7 +60,11 @@ var userAgentSpoofer = function(force) { if ( uaStr === '' ) { µm.userAgentReplaceStr = userAgentRandomPicker(); µm.userAgentReplaceStrBirth = Date.now(); - µm.logger.writeOne('', 'info', 'spoofing user agent with: ' + µm.userAgentReplaceStr); + µm.logger.writeOne( + '', + 'info', + vAPI.i18n('loggerEntryUserAgentSpoofing').replace('{{value}}', µm.userAgentReplaceStr) + ); } };