Set default language from configuration and get locale list from the server
parent
97767e5d3a
commit
ea1c3c19b9
|
@ -3,6 +3,7 @@ window.taigaConfig = {
|
||||||
"api": "http://localhost:8000/api/v1/",
|
"api": "http://localhost:8000/api/v1/",
|
||||||
"eventsUrl": null,
|
"eventsUrl": null,
|
||||||
"debug": true,
|
"debug": true,
|
||||||
|
"defaultLanguage": "en",
|
||||||
"publicRegisterEnabled": true,
|
"publicRegisterEnabled": true,
|
||||||
"feedbackEnabled": true,
|
"feedbackEnabled": true,
|
||||||
"privacyPolicyUrl": null,
|
"privacyPolicyUrl": null,
|
||||||
|
|
|
@ -241,7 +241,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
|
||||||
suffix: '.json'
|
suffix: '.json'
|
||||||
})
|
})
|
||||||
|
|
||||||
$translateProvider.preferredLanguage('en')
|
$translateProvider.preferredLanguage(window.taigaConfig.defaultLanguage || 'en')
|
||||||
|
|
||||||
init = ($log, $config, $rootscope, $auth, $events, $analytics, $translate) ->
|
init = ($log, $config, $rootscope, $auth, $events, $analytics, $translate) ->
|
||||||
$log.debug("Initialize application")
|
$log.debug("Initialize application")
|
||||||
|
|
|
@ -123,6 +123,9 @@ urls = {
|
||||||
"userstories-csv": "/userstories/csv?uuid=%s"
|
"userstories-csv": "/userstories/csv?uuid=%s"
|
||||||
"tasks-csv": "/tasks/csv?uuid=%s"
|
"tasks-csv": "/tasks/csv?uuid=%s"
|
||||||
"issues-csv": "/issues/csv?uuid=%s"
|
"issues-csv": "/issues/csv?uuid=%s"
|
||||||
|
|
||||||
|
# locales
|
||||||
|
"locales": "/locales"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialize api urls service
|
# Initialize api urls service
|
||||||
|
@ -168,5 +171,6 @@ module.run([
|
||||||
"$tgModulesResourcesProvider",
|
"$tgModulesResourcesProvider",
|
||||||
"$tgWebhooksResourcesProvider",
|
"$tgWebhooksResourcesProvider",
|
||||||
"$tgWebhookLogsResourcesProvider",
|
"$tgWebhookLogsResourcesProvider",
|
||||||
|
"$tgLocalesResourcesProvider",
|
||||||
initResources
|
initResources
|
||||||
])
|
])
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
###
|
||||||
|
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be>
|
||||||
|
# Copyright (C) 2015 Jesús Espino Garcia <jespinog@gmail.com>
|
||||||
|
# Copyright (C) 2015 David Barragán Merino <bameda@dbarragan.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# File: modules/resources/locales.coffee
|
||||||
|
###
|
||||||
|
|
||||||
|
|
||||||
|
taiga = @.taiga
|
||||||
|
sizeFormat = @.taiga.sizeFormat
|
||||||
|
|
||||||
|
|
||||||
|
resourceProvider = ($repo) ->
|
||||||
|
service = {
|
||||||
|
list: -> return $repo.queryMany("locales")
|
||||||
|
}
|
||||||
|
|
||||||
|
return (instance) ->
|
||||||
|
instance.locales = service
|
||||||
|
|
||||||
|
|
||||||
|
module = angular.module("taigaResources")
|
||||||
|
module.factory("$tgLocalesResourcesProvider", ["$tgRepo", resourceProvider])
|
||||||
|
|
|
@ -66,12 +66,18 @@ class UserSettingsController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
@scope.$emit('project:loaded', project)
|
@scope.$emit('project:loaded', project)
|
||||||
return project
|
return project
|
||||||
|
|
||||||
|
loadLocales: ->
|
||||||
|
return @rs.locales.list().then (locales) =>
|
||||||
|
@scope.locales = locales
|
||||||
|
return locales
|
||||||
|
|
||||||
loadInitialData: ->
|
loadInitialData: ->
|
||||||
promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
|
promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
|
||||||
@scope.projectId = data.project
|
@scope.projectId = data.project
|
||||||
return data
|
return data
|
||||||
|
|
||||||
return promise.then(=> @.loadProject())
|
return @q.all([promise.then(=> @.loadProject()),
|
||||||
|
@.loadLocales()])
|
||||||
|
|
||||||
openDeleteLightbox: ->
|
openDeleteLightbox: ->
|
||||||
@rootscope.$broadcast("deletelightbox:new", @scope.user)
|
@rootscope.$broadcast("deletelightbox:new", @scope.user)
|
||||||
|
|
|
@ -841,7 +841,8 @@
|
||||||
"PLACEHOLDER_FULL_NAME": "Set your full name (ex. Íñigo Montoya)",
|
"PLACEHOLDER_FULL_NAME": "Set your full name (ex. Íñigo Montoya)",
|
||||||
"BIO": "Bio",
|
"BIO": "Bio",
|
||||||
"PLACEHOLDER_BIO": "Tell us something about you",
|
"PLACEHOLDER_BIO": "Tell us something about you",
|
||||||
"LANGUAGE": "Language"
|
"LANGUAGE": "Language",
|
||||||
|
"LANGUAGE_DEFAULT": "-- use default language --"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"WIZARD": {
|
"WIZARD": {
|
||||||
|
@ -865,8 +866,5 @@
|
||||||
"LAST_EDIT": "last <br />edit",
|
"LAST_EDIT": "last <br />edit",
|
||||||
"LAST_MODIFICATION": "last modification"
|
"LAST_MODIFICATION": "last modification"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"LANGUAGES": {
|
|
||||||
"ENGLISH": "English"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,8 @@ div.wrapper(tg-user-profile, ng-controller="UserSettingsController as ctrl",
|
||||||
|
|
||||||
fieldset
|
fieldset
|
||||||
label(for="full-name", translate="USER_PROFILE.FIELD.LANGUAGE")
|
label(for="full-name", translate="USER_PROFILE.FIELD.LANGUAGE")
|
||||||
select(data-required="true", ng-model="lang")
|
select(ng-model="lang", ng-options="locale.code as locale.name for locale in locales")
|
||||||
option(value="en", translate="LANGUAGES.ENGLISH")
|
option(value="", translate="USER_PROFILE.FIELD.LANGUAGE_DEFAULT")
|
||||||
|
|
||||||
fieldset
|
fieldset
|
||||||
label(for="bio", translate="USER_PROFILE.FIELD.BIO")
|
label(for="bio", translate="USER_PROFILE.FIELD.BIO")
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
"api": "http://localhost:8000/api/v1/",
|
"api": "http://localhost:8000/api/v1/",
|
||||||
"eventsUrl": null,
|
"eventsUrl": null,
|
||||||
"debug": true,
|
"debug": true,
|
||||||
|
"debugInfo": false,
|
||||||
|
"defaultLanguage": "en",
|
||||||
"publicRegisterEnabled": true,
|
"publicRegisterEnabled": true,
|
||||||
"feedbackEnabled": true,
|
"feedbackEnabled": true,
|
||||||
"privacyPolicyUrl": null,
|
"privacyPolicyUrl": null,
|
||||||
"termsOfServiceUrl": null,
|
"termsOfServiceUrl": null,
|
||||||
"maxUploadFileSize": null,
|
"maxUploadFileSize": null,
|
||||||
"contribPlugins": [],
|
"contribPlugins": []
|
||||||
"debugInfo": false
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue