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

Api Endpoint returns wrong cultureinfo #16453

Closed
seanhakbb opened this issue May 29, 2024 · 3 comments
Closed

Api Endpoint returns wrong cultureinfo #16453

seanhakbb opened this issue May 29, 2024 · 3 comments
Labels

Comments

@seanhakbb
Copy link

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

13.3.2

Bug summary

Our API worked fine togheter with culture host binding and CultureInfo.CurrentCulture, with latest version this stopped working.

Specifics

In our old v13.1.0 our API worked fine using this setup:
Culture mapping:
domain.se => sv (swedish)
domain.dk => da (danish)
when accesing api via domain.se/api/endpoint, CultureInfo.CurrentCulture returned "sv" as expected

But with latest release (13.3.2) this now returns en-us, seemingly ignoring our culture binding.

Steps to reproduce

create site with two languages
domain.se => sv (swedish)
domain.dk => da (danish)

create an api endpoint that returns CultureInfo.CurrentCulture

Expected result / actual result

domain.se/api/endpoint should return "sv"
domain.dk/api/endpoint should return "dk"

domain.se/api/endpoint returns "en-us"
domain.dk/api/endpoint returns "en-us"

Copy link

Hi there @seanhakbb!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@seanhakbb
Copy link
Author

Small update with more strange things relating to latest 13 lts release.

We have also noticed this error in a custom controller as well now.
variationContextAccessor always returns our default language (sv), even though im visiting domain.com/en which is in bindings set to use english.

This also affects dictionary values, however in this case it always try to load dictionaries using my machine default, en-US.

Outside our custom controller all pages load fine, and when hardcoding culture values the right content is loaded (_variationContextAccessor.VariationContext = new VariationContext("en");) However we need to set CurrentThread.CurrentCulture to have dictionaries working.

Another thing we noticed, Model.GetCultureFromDomains() seems to display the correct language in our views.

@seanhakbb
Copy link
Author

Was related to this:
##16617

13.4.0 solved all our issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant