Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

open-dynaMIX
Copy link
Member

No description provided.

Comment on lines 106 to 120
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


Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member Author

@open-dynaMIX open-dynaMIX Nov 28, 2024

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.

@open-dynaMIX open-dynaMIX marked this pull request as draft November 28, 2024 15:26
@open-dynaMIX open-dynaMIX marked this pull request as ready for review November 28, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants