Skip to content

Commit

Permalink
Merge pull request #9138 from sairina/il8n
Browse files Browse the repository at this point in the history
Add check for `notification` to avoid il8n error in `CoreBase`
  • Loading branch information
rtibbles authored Mar 4, 2022
2 parents 74afa48 + 9f12b8b commit 2f97980
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions kolibri/core/assets/src/views/CoreBase/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

<GlobalSnackbar />
<UpdateNotification
v-if="!loading && showNotification"
v-if="!loading && showNotification && mostRecentNotification"
:id="mostRecentNotification.id"
:title="mostRecentNotification.title"
:msg="mostRecentNotification.msg"
Expand Down Expand Up @@ -400,18 +400,21 @@
let languageCode = defaultLanguage.id;
// notifications should already be ordered by timestamp
const notification = this.notifications[0];
// check if translated message is available for current language
if (notification.i18n[currentLanguage] !== undefined) {
languageCode = currentLanguage;
if (notification) {
// check if translated message is available for current language
if (notification.i18n[currentLanguage] !== undefined) {
languageCode = currentLanguage;
}
// i18n data structure generated by nutritionfacts_i18n.py
return {
id: notification.id,
title: notification.i18n[languageCode].title,
msg: notification.i18n[languageCode].msg,
linkText: notification.i18n[languageCode].link_text,
linkUrl: notification.link_url,
};
}
// i18n data structure generated by nutritionfacts_i18n.py
return {
id: notification.id,
title: notification.i18n[languageCode].title,
msg: notification.i18n[languageCode].msg,
linkText: notification.i18n[languageCode].link_text,
linkUrl: notification.link_url,
};
return null;
},
contentComponentName() {
return this.$slots.default[0].context.$options.name;
Expand Down

0 comments on commit 2f97980

Please sign in to comment.