39
Views
3
Comments
Retrieving Device Preferred Language and Country in Mobile App
Question
Application Type
Mobile

Hi all,

I am currently implementing a mobile app and need assistance with two functionalities:

1. Finding the device's preferred language.

2. Retrieving the device's Selected country.

Could anyone provide guidance or point me to relevant resources/documentation for achieving these tasks in OutSystems?


Thank you!

Best regards,  

Sai.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

To get the currentLocale (language) use the following action, which is not only available as server action but for your case also as client action:

https://success.outsystems.com/documentation/11/reference/outsystems_language/logic/built_in_functions/environment/#GetCurrentLocale

To get the country where the device is you first need to get the GeoLocation, you can do that with the following plugin:

https://www.outsystems.com/forge/component-overview/1395/location-plugin-o11

After that you need to do some reverse geocoding with the latitude and longtitude values to derive the country in which the device is located.

r that do reverse geocoding that will provide you the location address.Here is the google documentation link how to do reverse geocoding with the latitude and longitude values https://developers.google.com/maps/documentation/geocoding/start?csw=1#ReverseGeocoding 

-- Daniel

2021-06-26 17-42-52
Jeevan Sai Sabbavarapu


Hi @Daniël Kuhlmann  ,

Thanks for the response.

We have a solution for the language issue, but for the country, we need the selected country from the device, not from the latitude and longitude.

Sai.

2021-11-12 04-59-31
Manikandan Sambasivam

To retrieve the device's selected country, which is generally tied to the device's locale settings, you need to access the device's locale information. While OutSystems doesn't offer a built-in plugin for fetching locale settings directly, you can accomplish this by integrating a Cordova plugin that retrieves the device's locale settings. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.