How to detect store locale for multi-language app support?

How to detect store locale for multi-language app support?

RonnyACohen
Shopify Partner
7 0 1

HI

We are in the process of making our apps multi language, how do I detect when the customer installing the app what is the store locale on the redirected url or header,

In order for me to set the correct language  in my app 

Thanks

Ronny

 

Reply 1 (1)

Van_Nguyen_GSG
Shopify Partner
161 23 44

Hi @RonnyACohen ,

You can make a request to `https://{store_name}.myshopify.com/admin/api/2023-04/shop.json?fields=primary_locale` to get the Store's primary locale.

If it's a Shopify Plus store you can get the current user's locale: https://shopify.dev/docs/api/admin-rest/2023-04/resources/user#get-users-current

Helping Shopify merchants build stores that convert.
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- If you still need help, feel free to reach out to me at: van@glue.sg
Cheers!