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

Configured region not honored with de-informal language #3947

Open
stapelberg opened this issue Feb 29, 2024 · 3 comments
Open

Configured region not honored with de-informal language #3947

stapelberg opened this issue Feb 29, 2024 · 3 comments

Comments

@stapelberg
Copy link
Contributor

Problem and impact

When setting my user account’s language to de-informal, the configured region (CH) is no longer honored for formatting money values, e.g. in the orders page.

Expected behaviour

No response

Steps to reproduce

  1. Configure region to CH
  2. Configure language to de; orders page lists “CHF 97.56” (with dots)
  3. Configure language to de-informal; orders page lists “97,56 CHF” (with commas)

Looking at the code, I think the problem is that the language function treats “informal” as a region:

_lng = translation.get_language()
lng = lng or settings.LANGUAGE_CODE
if '-' not in lng and region:
lng += '-' + region.lower()
translation.activate(lng)
try:
yield
finally:
translation.activate(_lng)

Screenshots

No response

Link

No response

Browser (software, desktop or mobile?) and version

No response

Operating system, dependency versions

No response

Version

2024.2

@raphaelm
Copy link
Member

I'll look into it but it might be not fixable the way the informal variant is implemented, it's basically a fake region in itself :/

@stapelberg
Copy link
Contributor Author

Wouldn’t just removing “-informal” before trying to determine the region fix the problem?

@raphaelm
Copy link
Member

No, the region will not be added to the language in the first place if de-informal is used since "informal" is implemented like a region (think de-de, de-at, de-ch and de-informal)

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

No branches or pull requests

2 participants