Skip to content

Commit

Permalink
Merge branch 'use-system-dateformat'
Browse files Browse the repository at this point in the history
  • Loading branch information
davibe committed Apr 12, 2017
2 parents 28e709d + c193a7e commit e2e4dc5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/ui/dispatcher.coffee
Expand Up @@ -452,8 +452,9 @@ handle 'unreadtotal', (total, orMore) ->
handle 'showconvmin', (doshow) ->
viewstate.setShowConvMin doshow

handle 'setdateformatfollowlanguage', (val) ->
viewstate.setDateformatFollowLanguage(val)
handle 'setusesystemdateformat', (val) ->

viewstate.setUseSystemDateFormat(val)

handle 'showconvthumbs', (doshow) ->
viewstate.setShowConvThumbs doshow
Expand Down
8 changes: 4 additions & 4 deletions src/ui/models/viewstate.coffee
Expand Up @@ -42,7 +42,7 @@ module.exports = exp = {
muteSoundNotification: tryparse(localStorage.muteSoundNotification) ? false
forceCustomSound: tryparse(localStorage.forceCustomSound) ? false
language: localStorage.language ? 'en'
dateformatFollowLanguage: localStorage.dateformatFollowLanguage is "true"
useSystemDateFormat: localStorage.useSystemDateFormat is "true"
# non persistent!
messageMemory: {} # stores input when swithching conversations
cachedInitialsCode: {} # code used for colored initials, if no avatar
Expand All @@ -51,9 +51,9 @@ module.exports = exp = {
startupScreenVisible: true
openOnSystemStartup: false

setDateformatFollowLanguage: (val) ->
@dateformatFollowLanguage = val
localStorage.dateformatFollowLanguage = val
setUseSystemDateFormat: (val) ->
@useSystemDateFormat = val
localStorage.useSystemDateFormat = val
updated 'language'

setContacts: (state) ->
Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/convlist.coffee
Expand Up @@ -8,7 +8,7 @@ module.exports = view (models) ->
clz.push 'showconvthumbs' if viewstate.showConvThumbs
clz.push 'showanimatedthumbs' if viewstate.showAnimatedThumbs
div class:clz.join(' '), ->
if viewstate.dateformatFollowLanguage
if !viewstate.useSystemDateFormat
moment.locale(i18n.getLocale())
else
moment.locale(window.navigator.language)
Expand Down
6 changes: 3 additions & 3 deletions src/ui/views/menu.coffee
Expand Up @@ -136,11 +136,11 @@ templateEdit = (viewstate) ->
submenu: languages
}
{
label: i18n.__('menu.edit.dateformat:Localize date format')
label: i18n.__('menu.edit.dateformat:Use system date format')
type: 'checkbox'
checked: viewstate.dateformatFollowLanguage
checked: viewstate.useSystemDateFormat
enabled: true
click: (it) -> action 'setdateformatfollowlanguage', it.checked
click: (it) -> action 'setusesystemdateformat', it.checked
}

].filter (n) -> n != undefined
Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/messages.coffee
Expand Up @@ -130,7 +130,7 @@ module.exports = view (models) ->
if c.requestinghistory
pass 'Requesting history…', -> span class:'material-icons spin', 'donut_large'

if viewstate.dateformatFollowLanguage
if !viewstate.useSystemDateFormat
moment.locale(i18n.getLocale())
else
moment.locale(window.navigator.language)
Expand Down

0 comments on commit e2e4dc5

Please sign in to comment.