Redirect to order status page (order_status_url) with specific locale

7 0 6

I'm using the order status page as the track shipment updates page on our website and in email notifications and I'm having difficulties being able to set the specific locale that the order status page should be displayed. Our store (actually 2 stores) supports 7 locales, so it's kind of important to be able to use this ability.

I found when visiting the URL in `{{ order.order_status_url }}` (or just `{{ order_status_url }}` when customising emails) that if I replace the domain with one that has the locale code as the first folder path following the domain, it doesn't work:


{% assign tracking_url = order.order_status_url %}
{% if request.locale.iso_code != "en" %}
  {% assign shop_domain_with_locale = shop.domain | append: "/" | append: request.locale.iso_code %}
  {% assign tracking_url = tracking_url | replace: shop.domain, shop_domain_with_locale %}
{% endif %}


For example, if my `shop.domain` is `` and the customer was viewing the website in French (fr), then the above would replace with ``

That didn't seem to work, but then I found after the page is loaded that if I used `?locale=fr` in the URL for the order status page, it does change the language to French.

So then I tried this:


{% assign tracking_url = order.order_status_url %}
{% if request.locale.iso_code != "en" %}
  {% assign tracking_url = tracking_url | append: "&locale=" | append: request.locale.iso_code %}
{% endif %}


Since the `order_status_url` page has an `?authenticate=...` in the URL, that's why I add `&locale=...` at the end.

This doesn't seem to work though, as it redirects to the `order_status_url` without any URL params -- `&locale=...` is missing and the order status page is displayed in the default locale.

Am I missing something here? Has anyone else gotten this to work?

EDIT: actually, after switching language to FR ( on the website I notice that the `order_status_url` now has `` in the URL, however after clicking it always takes me to a 404 page. Seems like the locale code in the URL is added by default and then equally not supported by Shopify.