-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
Description
Which Umbraco version are you using?
v16
Bug summary
In my project, I have a piece of code responsible for building a language switcher. To generate this language switcher, I loop through all available languages and call the IPublishedContent.Url(culture: <culture>) function for each one. This allows me to retrieve the URL in the corresponding language so that the language switcher can display all available URLs per language.
What I’ve noticed, however, is that the .Url() function occasionally modifies the VariationContext to the specified culture. I assume this is unintended behavior, as the function is expected to be a getter rather than a modifier.
Specifics
No response
Steps to reproduce
- Create a template (.cshtml)
- Use the
ILanguageServiceto loop through all available languages. - On the
IPublishedContentof the current page, call the.Url(culture)function. - Observe that, sporadically, the culture is changed to a different language after the loop has finished executing.
Expected result / actual result
Expected:
- The user’s language should not be changed by calling the
.Url()function, and the entire page should be rendered in the same language.
Actual:
- The user’s language (
VariationContext) is modified when using the.Url()function. - The page is rendered in multiple languages.