diff options
author | 2019-06-11 21:08:14 +0200 | |
---|---|---|
committer | 2019-06-11 21:08:14 +0200 | |
commit | 43a90e17e224afe09f5877e672a05717a61f442c (patch) | |
tree | 6f748402f577ba567811f3d0a6e7f6501b7b1ecb /src/features/announcements/store.js | |
parent | Merge branch 'fix/fix-proxy-auth' into release/5.2.0-beta.1 (diff) | |
download | ferdium-app-43a90e17e224afe09f5877e672a05717a61f442c.tar.gz ferdium-app-43a90e17e224afe09f5877e672a05717a61f442c.tar.zst ferdium-app-43a90e17e224afe09f5877e672a05717a61f442c.zip |
fix default locale language fallback
Diffstat (limited to 'src/features/announcements/store.js')
-rw-r--r-- | src/features/announcements/store.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/features/announcements/store.js b/src/features/announcements/store.js index ad78a0979..de7ed2596 100644 --- a/src/features/announcements/store.js +++ b/src/features/announcements/store.js | |||
@@ -14,6 +14,7 @@ import { createActionBindings } from '../utils/ActionBinding'; | |||
14 | import { createReactions } from '../../stores/lib/Reaction'; | 14 | import { createReactions } from '../../stores/lib/Reaction'; |
15 | import { gaEvent } from '../../lib/analytics'; | 15 | import { gaEvent } from '../../lib/analytics'; |
16 | import { matchRoute } from '../../helpers/routing-helpers'; | 16 | import { matchRoute } from '../../helpers/routing-helpers'; |
17 | import { DEFAULT_APP_SETTINGS } from '../../config'; | ||
17 | 18 | ||
18 | const LOCAL_STORAGE_KEY = 'announcements'; | 19 | const LOCAL_STORAGE_KEY = 'announcements'; |
19 | 20 | ||
@@ -30,12 +31,12 @@ export class AnnouncementsStore extends FeatureStore { | |||
30 | 31 | ||
31 | @computed get announcement() { | 32 | @computed get announcement() { |
32 | if (!this.stores || !getAnnouncementRequest.result) return null; | 33 | if (!this.stores || !getAnnouncementRequest.result) return null; |
33 | const { locale, defaultLocale } = this.stores.app; | 34 | const { locale } = this.stores.app; |
34 | const announcement = getAnnouncementRequest.result; | 35 | const announcement = getAnnouncementRequest.result; |
35 | // User locale | 36 | // User locale |
36 | if (announcement[locale]) return announcement[locale]; | 37 | if (announcement[locale]) return announcement[locale]; |
37 | // Default locale | 38 | // Default locale |
38 | if (announcement[defaultLocale]) return announcement[defaultLocale]; | 39 | if (announcement[DEFAULT_APP_SETTINGS.fallbackLocale]) return announcement[DEFAULT_APP_SETTINGS.fallbackLocale]; |
39 | // No locales specified | 40 | // No locales specified |
40 | return announcement; | 41 | return announcement; |
41 | } | 42 | } |