In App proxy, how to obtain the language manually selected by the customer?

Here is the guide link.

Display dynamic store data with app proxies:

https://shopify.dev/docs/apps/build/online-store/display-dynamic-data

The guide does not explain how to obtain the language manually selected by the customer.

For example, in this URL:

https://example.myshopify.com/fr/apps/sub-path/my-app-path

, I tried using a regular expression to match the language value in the path_prefix field.

This is my regex:

/([^-]+)(-[^/]+)?/apps/sub-path

, but it doesn’t seem to work.

I suspect the path_prefix field may not include the language.

I am wondering if there are other methods available to retrieve the language manually selected by the customer.

I want to display different content to customers based on their selected language. Localized text will provide a better user experience.

Thank you for any response.