-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Use fallback languages for analytics summaries #1162
base: main
Are you sure you want to change the base?
Conversation
caluma/extensions/events/form.py
Outdated
def get_translation_with_fallback(value): | ||
lang = get_language() | ||
fallback_langs = ["en", "de"] | ||
fallback_langs.remove(lang) | ||
translated = getattr(value, lang) | ||
if not translated: | ||
for fl in fallback_langs: | ||
translated = getattr(value, fl) | ||
if translated: | ||
break | ||
return translated | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could probably be avoided by configuring localized fields, no?
https://django-localized-fields.readthedocs.io/en/latest/settings.html#localized-fields-fallbacks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what we have already. But they just reported that this is not just a problem with the summaries, but with Analytics in general. I will have another look until continuing with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are two different things. I've made an issue for it in Caluma.
Somehow the LOCALIZED_FIELDS_FALLBACKS
setting doesn't get picked up. We need this, so I'm gonna merge anyway.
a052463
to
6bcf903
Compare
No description provided.