From 824f3c295a05d4616b703212a33bf3d645af5da8 Mon Sep 17 00:00:00 2001 From: Alex Bardanov Date: Sun, 20 Jul 2014 01:45:49 +0300 Subject: [PATCH] localized badge labels and tooltips, fixes #28 --- extension/achievements/adobe.js | 6 +++++- extension/achievements/memorial.js | 8 +++++++- extension/achievements/mostDownloads.js | 6 +++++- extension/achievements/mostTrending.js | 6 +++++- extension/achievements/new.js | 6 +++++- extension/locale/en-US.js | 17 +++++++++++++++++ 6 files changed, 44 insertions(+), 5 deletions(-) diff --git a/extension/achievements/adobe.js b/extension/achievements/adobe.js index d19a3ee..27ebc67 100644 --- a/extension/achievements/adobe.js +++ b/extension/achievements/adobe.js @@ -2,6 +2,7 @@ define(function(require, exports, module){ var Achievement = require('./achievement'), config = require('../config'), _ = require('../vendor/lodash.min'), + locale = require('../services/locale'), ExtensionsService = require('../services/extensions'); function AdobeAchievement(){ @@ -15,7 +16,10 @@ define(function(require, exports, module){ } this.getTag = function(rating, element){ - return 'Adobe'; + return _.template('${badge}',{ + badge: locale.get('badgeAdobe'), + title: locale.get('badgeAdobeTitle') + }); } } diff --git a/extension/achievements/memorial.js b/extension/achievements/memorial.js index fb4ad9f..e375595 100644 --- a/extension/achievements/memorial.js +++ b/extension/achievements/memorial.js @@ -2,8 +2,14 @@ define(function(require, exports, module){ var Achievement = require('./achievement'), config = require('../config'), _ = require('../vendor/lodash.min'), + locale = require('../services/locale'), dictionary = { - 'themesforbrackets': { tag: '100k Downloads' } + 'themesforbrackets': { + tag: _.template('${badge}',{ + title: locale.get('badge100kTitle'), + badge: locale.get('badge100k') + }) + } }; function MemorialAchievement(){ diff --git a/extension/achievements/mostDownloads.js b/extension/achievements/mostDownloads.js index b625a8e..ea200b2 100644 --- a/extension/achievements/mostDownloads.js +++ b/extension/achievements/mostDownloads.js @@ -2,6 +2,7 @@ define(function(require, exports, module){ var Achievement = require('./achievement'), config = require('../config'), _ = require('../vendor/lodash.min'), + locale = require('../services/locale'), numberOfTopExtensoins = 7; function MostDownloadsAchievement(){ @@ -21,7 +22,10 @@ define(function(require, exports, module){ } this.getTag = function(rating){ - return 'Top'; + return _.template('${badge}',{ + badge: locale.get('badgeTop'), + title: locale.get('badgeTopTitle') + }); } } diff --git a/extension/achievements/mostTrending.js b/extension/achievements/mostTrending.js index 8a08c52..f0710d3 100644 --- a/extension/achievements/mostTrending.js +++ b/extension/achievements/mostTrending.js @@ -2,6 +2,7 @@ define(function(require, exports, module){ var Achievement = require('./achievement'), config = require('../config'), _ = require('../vendor/lodash.min'), + locale = require('../services/locale'), numberOfTrendingExtensions = 7; function MostTrendingAchievement(){ @@ -21,7 +22,10 @@ define(function(require, exports, module){ } this.getTag = function(rating){ - return 'Trending'; + return _.template('${badge}',{ + badge: locale.get('badgeTrend'), + title: locale.get('badgeTrendTitle') + }); } } diff --git a/extension/achievements/new.js b/extension/achievements/new.js index fb53d25..bb4c3c0 100644 --- a/extension/achievements/new.js +++ b/extension/achievements/new.js @@ -2,6 +2,7 @@ define(function(require, exports, module){ var Achievement = require('./achievement'), config = require('../config'), _ = require('../vendor/lodash.min'), + locale = require('../services/locale'), ExtensionsService = require('../services/extensions'); function UpdatedAchievement(){ @@ -24,7 +25,10 @@ define(function(require, exports, module){ } this.getTag = function(rating, element){ - return 'New'; + return _.template('${badge}',{ + badge: locale.get('badgeNew'), + title: locale.get('badgeNewTitle') + }); } } diff --git a/extension/locale/en-US.js b/extension/locale/en-US.js index 90c4ad7..2e934df 100644 --- a/extension/locale/en-US.js +++ b/extension/locale/en-US.js @@ -16,6 +16,23 @@ define(function (require, exports, module){ name: 'Name', daily: 'downloads yesterday', //0.3.0 + /*BADGES*/ + badgeAdobe: 'Adobe', + badgeAdobeTitle: 'Extension from Adobe', + + badge100k: '100k Downloads', + badge100kTitle: 'First extension that had 100k downloads', + + badgeTop: 'Top', + badgeTopTitle: 'Most popular extension', + + badgeTrend: 'Trending', + badgeTrendTitle: 'Most trending extension', + + badgeNew: 'New', + badgeNewTitle: 'New extension', + /*END of BADGES*/ + //Detailed info about ## 'click-more': 'Detailed info about', //0.3.0