Fixing i18n in front

stable
Alejandro Alonso 2015-06-16 11:32:57 +02:00
parent 0afb804a61
commit d024162d6e
2 changed files with 4 additions and 3 deletions

View File

@ -22,9 +22,9 @@
taiga = @.taiga taiga = @.taiga
class HttpService extends taiga.Service class HttpService extends taiga.Service
@.$inject = ["$http", "$q", "$tgStorage", "$rootScope", "$cacheFactory"] @.$inject = ["$http", "$q", "$tgStorage", "$rootScope", "$cacheFactory", "$translate"]
constructor: (@http, @q, @storage, @rootScope, @cacheFactory) -> constructor: (@http, @q, @storage, @rootScope, @cacheFactory, @translate) ->
super() super()
@.cache = @cacheFactory("httpget"); @.cache = @cacheFactory("httpget");
@ -37,7 +37,7 @@ class HttpService extends taiga.Service
headers["Authorization"] = "Bearer #{token}" headers["Authorization"] = "Bearer #{token}"
# Accept-Language # Accept-Language
lang = @rootScope.user?.lang lang = @rootScope.user?.lang || @translate.preferredLanguage()
if lang if lang
headers["Accept-Language"] = lang headers["Accept-Language"] = lang

View File

@ -96,6 +96,7 @@ UserProfileDirective = ($confirm, $auth, $repo, $translate) ->
changeEmail = $scope.user.isAttributeModified("email") changeEmail = $scope.user.isAttributeModified("email")
$scope.user.lang = $scope.lang $scope.user.lang = $scope.lang
$translate.preferredLanguage($scope.lang)
onSuccess = (data) => onSuccess = (data) =>
$auth.setUser(data) $auth.setUser(data)