Sitecore Context



I have a page in custom english version(en-foo) which calls api to fill the view. When the request reaches to the endpoint, Sitecore context changes to language (en).


Is there a way to preserve the sitecore context during api call ?

  • In reply to Engin Ilgaz:

    What kind or api endpoint are you using?
    If you do an http request to another domain, you lose the Sitecore Context Language, putting the language in the url is a way to keep the language.

    Registering a custom language is indeed possible on your desktop, but what about Azure PaaS? perhaps you can avoid it to create a custom language?

    In code you can easly switch the language do it:
    with the LanguageSwitcher

    using (new Sitecore.Globalization.LanguageSwitcher("en-foo"))
    myItem = myItem.Database.GetItem(myItem.ID);

    or just getting an specific language for an item