From 868598fe7f7039fe7627988a4370efae285bcc76 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Fri, 31 Aug 2018 01:08:07 +0900
Subject: [PATCH] refs #527 Set locale for moment
---
.../Contents/Cards/Notification/Favourite.vue | 4 +++-
.../TimelineSpace/Contents/Cards/Notification/Reblog.vue | 4 +++-
.../components/TimelineSpace/Contents/Cards/Toot.vue | 4 +++-
src/renderer/store/App.js | 8 +++++++-
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/renderer/components/TimelineSpace/Contents/Cards/Notification/Favourite.vue b/src/renderer/components/TimelineSpace/Contents/Cards/Notification/Favourite.vue
index 92ce5778..056a0286 100644
--- a/src/renderer/components/TimelineSpace/Contents/Cards/Notification/Favourite.vue
+++ b/src/renderer/components/TimelineSpace/Contents/Cards/Notification/Favourite.vue
@@ -108,7 +108,8 @@ export default {
computed: {
...mapState({
displayNameStyle: state => state.App.displayNameStyle,
- timeFormat: state => state.App.timeFormat
+ timeFormat: state => state.App.timeFormat,
+ language: state => state.App.language
}),
shortcutEnabled: function () {
return this.focused && !this.overlaid
@@ -145,6 +146,7 @@ export default {
case TimeFormat.Absolute.value:
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
case TimeFormat.Relative.value:
+ moment.locale(this.language)
return moment(datetime).fromNow()
}
},
diff --git a/src/renderer/components/TimelineSpace/Contents/Cards/Notification/Reblog.vue b/src/renderer/components/TimelineSpace/Contents/Cards/Notification/Reblog.vue
index 802d3e7c..98353ee9 100644
--- a/src/renderer/components/TimelineSpace/Contents/Cards/Notification/Reblog.vue
+++ b/src/renderer/components/TimelineSpace/Contents/Cards/Notification/Reblog.vue
@@ -107,7 +107,8 @@ export default {
},
computed: {
...mapState({
- timeFormat: state => state.App.timeFormat
+ timeFormat: state => state.App.timeFormat,
+ language: state => state.App.language
}),
shortcutEnabled: function () {
return this.focused && !this.overlaid
@@ -144,6 +145,7 @@ export default {
case TimeFormat.Absolute.value:
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
case TimeFormat.Relative.value:
+ moment.locale(this.language)
return moment(datetime).fromNow()
}
},
diff --git a/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue b/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue
index ffceff7b..dff849e1 100644
--- a/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue
+++ b/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue
@@ -152,7 +152,8 @@ export default {
computed: {
...mapState({
displayNameStyle: state => state.App.displayNameStyle,
- timeFormat: state => state.App.timeFormat
+ timeFormat: state => state.App.timeFormat,
+ language: state => state.App.language
}),
shortcutEnabled: function () {
return this.focused && !this.overlaid
@@ -216,6 +217,7 @@ export default {
case TimeFormat.Absolute.value:
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
case TimeFormat.Relative.value:
+ moment.locale(this.language)
return moment(datetime).fromNow()
}
},
diff --git a/src/renderer/store/App.js b/src/renderer/store/App.js
index 357e81d5..54370106 100644
--- a/src/renderer/store/App.js
+++ b/src/renderer/store/App.js
@@ -5,6 +5,7 @@ import Visibility from '~/src/constants/visibility'
import DisplayStyle from '~/src/constants/displayStyle'
import Theme from '~/src/constants/theme'
import TimeFormat from '~/src/constants/timeFormat'
+import Language from '~/src/constants/language'
const App = {
namespaced: true,
@@ -19,7 +20,8 @@ const App = {
favourite: true,
follow: true
},
- timeFormat: TimeFormat.Absolute.value
+ timeFormat: TimeFormat.Absolute.value,
+ language: Language.en.key
},
mutations: {
updateTheme (state, themeKey) {
@@ -49,6 +51,9 @@ const App = {
},
updateTimeFormat (state, format) {
state.timeFormat = format
+ },
+ updateLanguage (state, key) {
+ state.language = key
}
},
actions: {
@@ -75,6 +80,7 @@ const App = {
commit('updateTootVisibility', conf.general.tootVisibility)
commit('updateNotify', conf.notification.notify)
commit('updateTimeFormat', conf.general.timeFormat)
+ commit('updateLanguage', conf.language.language)
resolve(conf)
})
})