International domains and shop.published_locales

Hi

Does anyone know how to loop through all published locales when you have different sub domains and use the international domain feature of Shopify?

For example:
I have a primary domain “www.xyz.tld” with published language “German”. And I have a third-party domain “en.xyz.tld” with published language “English”.

If I’m on www.xyz.tld and go through “shop.published_locales” in my Liquid code then I only get the German language locale. And the same is true for en.xyz.tld with English.

But if I publish German AND English for www.xyz.tld then both locales will be found in shop.published_locales…

My goal is to implement a language dropdown field in my theme and use different sub domains for different languages within the same country/region. Our shop is already multi language and it works well with 1 domain, different languages and language dropdown. But not with international domains.

Fun fact:

If I browse to “en.xyz.tld” directly and look at section in the source code, then all hreflang tags are correct. But this is generated by “content_for_header”. So, there must be a way to get all published languages as objects. :grinning_face_with_smiling_eyes:

Thank you for any hint in the right direction.

Kind regards
Simone