How to display an app in the user's selected admin language 2.0?

Solved

How to display an app in the user's selected admin language 2.0?

Webwizzy
Shopify Partner
18 1 3

I need the user selected locale for the admin panel, in this post: https://community.shopify.com/c/shopify-apps/how-to-display-an-app-in-the-user-s-selected-admin-lang...

They suggest using 2 helper hooks "useShopifyUserLocale" and "useLocale"

 

However, none of those hooks are available in my application, so how do I get the user-selected locale, kind regards 🙂

Fullstack Developer - Founder of the cryptocurrency market data aggregator, https://www.bitculator.com
Accepted Solution (1)

Webwizzy
Shopify Partner
18 1 3

This is an accepted solution.

I found the answer rather quickly, its now called:

import { useAppBridge } from '@shopify/app-bridge-react';

 

You then have a settings object where you can access the locale: 

const appBridge = useAppBridge();
appBridge.config.locale
Fullstack Developer - Founder of the cryptocurrency market data aggregator, https://www.bitculator.com

View solution in original post

Reply 1 (1)

Webwizzy
Shopify Partner
18 1 3

This is an accepted solution.

I found the answer rather quickly, its now called:

import { useAppBridge } from '@shopify/app-bridge-react';

 

You then have a settings object where you can access the locale: 

const appBridge = useAppBridge();
appBridge.config.locale
Fullstack Developer - Founder of the cryptocurrency market data aggregator, https://www.bitculator.com