Fix EZP-22233: switch language does not handle PathPrefix

This PR intends to fix a rare issue described here : https://jira.ez.no/browse/EZP-22233