If user change language user should stay on current page

i want to change logic in switch language when we switch the language it should not redirect to home page i want it to stay on current page i checked the logic and try to edit but i am not able to get the current page i have also checked WorkContext.CurrentPage its giving me null i am trying to access it in UrlFilters.cs and method name is full url. in full url and absolute url i am always getting url of homepage and request url is also of home page so how i can access the current page so that i can create a logic whenever user changes language user stay on the same page does not redirect to home page

Which version of storefront do you use?

Latest, Virto Commerce Storefront 6.x and Vue B2B Theme already implemented this scenario

Test on demo:

we are not using vue b2b theme we are using platform 3.66 and in theme we are using liquid and angular js

By default, WorkContext.CurrentPage is initialized for Static Content (StaticContentController). If you want access to CurrentPage, you would need extending WorkContext Middleware and initialize WorkContext.CurrentPage or any WorkContext attribute, after this you can access to variable.

Also, you can try to use

        /// <summary>
        /// Current request url example: http:/host/app/store/en-us/search?page=2
        /// </summary>
        public Uri RequestUrl { get; set; }