diff --git a/gui/default/syncthing/core/languageSelectDirective.js b/gui/default/syncthing/core/languageSelectDirective.js index a6b8e3a3..30fee3ba 100644 --- a/gui/default/syncthing/core/languageSelectDirective.js +++ b/gui/default/syncthing/core/languageSelectDirective.js @@ -6,8 +6,8 @@ angular.module('syncthing.core') template: ''+ '', @@ -26,8 +26,21 @@ angular.module('syncthing.core') availableLocaleNames[a] = '[' + a + ']'; } } - $scope.localesNames = availableLocaleNames; + + var invert = function (obj) { + var new_obj = {}; + + for (var prop in obj) { + if(obj.hasOwnProperty(prop)) { + new_obj[obj[prop]] = prop; + } + } + return new_obj; + }; + $scope.localesNamesInv = invert($scope.localesNames); + $scope.localesNamesInvKeys = Object.keys($scope.localesNamesInv).sort(); + $scope.visible = $scope.localesNames && $scope.localesNames['en']; // using $watch cause LocaleService.currentLocale will be change after receive async query accepted-languages