aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-06-11 21:08:14 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-06-11 21:08:14 +0200
commit43a90e17e224afe09f5877e672a05717a61f442c (patch)
tree6f748402f577ba567811f3d0a6e7f6501b7b1ecb /src
parentMerge branch 'fix/fix-proxy-auth' into release/5.2.0-beta.1 (diff)
downloadferdium-app-43a90e17e224afe09f5877e672a05717a61f442c.tar.gz
ferdium-app-43a90e17e224afe09f5877e672a05717a61f442c.tar.zst
ferdium-app-43a90e17e224afe09f5877e672a05717a61f442c.zip
fix default locale language fallback
Diffstat (limited to 'src')
-rw-r--r--src/features/announcements/store.js5
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';
14import { createReactions } from '../../stores/lib/Reaction'; 14import { createReactions } from '../../stores/lib/Reaction';
15import { gaEvent } from '../../lib/analytics'; 15import { gaEvent } from '../../lib/analytics';
16import { matchRoute } from '../../helpers/routing-helpers'; 16import { matchRoute } from '../../helpers/routing-helpers';
17import { DEFAULT_APP_SETTINGS } from '../../config';
17 18
18const LOCAL_STORAGE_KEY = 'announcements'; 19const 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 }