If the language code was missing in the URI, switch_locale(locale) didn't add it (it worked fine if it was present). That means that it produced the same URL for all locales, each missing the language code in the URL.
Description
I added an additional check that checks if the language is set in the URI, and it is changed only in that case. Otherwise if it was missing, it was producing a URL that doesn't contain it - but now it does add the launguage code to the URL if it was missing.
Motivation and Context
Fixes #870
Screenshots (if appropriate):
Notice the current URL for a collection named "test" (not containing any language code in the URL). I hovered the mouse over the link to change the locale to "hr" (top right), and the URL that is in that link is shown on bottom left - it doesn't contain "hr". Same happens when I hover over "en".
Types of changes
[ ] Replay fix (fixes a replay specific issue)
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[ ] My change requires a change to the documentation.
[ ] I have updated the documentation accordingly.
[ ] I have added or updated tests to cover my changes.
If the language code was missing in the URI, switch_locale(locale) didn't add it (it worked fine if it was present). That means that it produced the same URL for all locales, each missing the language code in the URL.
Description
I added an additional check that checks if the language is set in the URI, and it is changed only in that case. Otherwise if it was missing, it was producing a URL that doesn't contain it - but now it does add the launguage code to the URL if it was missing.
Motivation and Context
Fixes #870
Screenshots (if appropriate):
Notice the current URL for a collection named "test" (not containing any language code in the URL). I hovered the mouse over the link to change the locale to "hr" (top right), and the URL that is in that link is shown on bottom left - it doesn't contain "hr". Same happens when I hover over "en".
Types of changes
Checklist:
I don't know how to run the tests.