diff --git a/src/translation/en.json b/src/translation/en.json index d162aef18..99a925029 100644 --- a/src/translation/en.json +++ b/src/translation/en.json @@ -56,7 +56,26 @@ "category": { "all": "All", "popular": "Popular", - "newApps": "New Apps" + "newApps": "New Apps", + "analytics": "Analytics", + "chat": "Chat", + "blog": "Blog", + "document": "Documents", + "crm": "CRM", + "forum": "Forum", + "gallery": "Gallery", + "finance": "Finance", + "git": "Code Hosting", + "email": "Email", + "game": "Games", + "hosting": "Web Hosting", + "media": "Media", + "learning": "Learning", + "notes": "Notes", + "sync": "File Sync", + "project": "Project Management", + "wiki": "Wiki", + "vpn": "VPN" }, "searchPlaceholder": "Search for alternatives like Github, Dropbox, Slack, Trello, ...", "noAppsFound": "No apps found.", diff --git a/src/views/appstore.js b/src/views/appstore.js index 1dd546f4b..5409168ad 100644 --- a/src/views/appstore.js +++ b/src/views/appstore.js @@ -6,7 +6,7 @@ /* global RSTATES */ /* global moment */ -angular.module('Application').controller('AppStoreController', ['$scope', '$location', '$timeout', '$routeParams', 'Client', function ($scope, $location, $timeout, $routeParams, Client) { +angular.module('Application').controller('AppStoreController', ['$scope', '$translate', '$location', '$timeout', '$routeParams', 'Client', function ($scope, $translate, $location, $timeout, $routeParams, Client) { Client.onReady(function () { if (!Client.getUserInfo().isAtLeastAdmin) $location.path('/'); }); $scope.HOST_PORT_MIN = 1024; @@ -40,6 +40,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca $('.modal').modal('hide'); }; + // If new categories added make sure the translation below exists $scope.categories = [ { id: 'analytics', icon: 'fa fa-chart-line', label: 'Analytics'}, { id: 'blog', icon: 'fa fa-font', label: 'Blog'}, @@ -62,6 +63,16 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca { id: 'wiki', icon: 'fab fa-wikipedia-w', label: 'Wiki'}, ]; + // Translation IDs are generated as "appstore.category." + $translate($scope.categories.map(function (c) { return 'appstore.category.' + c.id; })).then(function (tr) { + Object.keys(tr).forEach(function (key) { + if (key === tr[key]) return; // missing translation use default label + + var category = $scope.categories.find(function (c) { return key.endsWith(c.id); }); + if (category) category.label = tr[key]; + }); + }); + $scope.categoryButtonLabel = function (category) { if (category === 'new') return 'Category'; if (category === 'recent') return 'Category';