Added Moment i18n support

This commit is contained in:
Ruben Vereecken 2014-07-30 23:19:21 +02:00
parent 2e3234fc58
commit 41729f9700

View file

@ -31,6 +31,7 @@ init = ->
app.initialize()
Backbone.history.start({ pushState: true })
handleNormalUrls()
setUpMoment() # Set up i18n for moment
treemaExt = require 'treema-ext'
treemaExt.setup()
@ -64,6 +65,12 @@ setUpDefinitions = ->
for definition of definitionSchemas
Backbone.Mediator.addDefSchemas definitionSchemas[definition]
setUpMoment = ->
{me} = require 'lib/auth'
moment.lang me.lang(), {}
me.on 'change', (me) ->
moment.lang me.lang(), {} if me._previousAttributes.preferredLanguage isnt me.get 'preferredLanguage'
initializeServices = ->
services = [
'./lib/services/filepicker'
@ -92,4 +99,4 @@ watchForErrors = ->
#msg += "\nStack: #{stack}" if stack = error?.stack
noty text: msg, layout: 'topCenter', type: 'error', killer: false, timeout: 5000, dismissQueue: true, maxVisible: 3, callback: {onClose: -> --currentErrors}
$ -> init()
$ -> init()