How to get Region setting from OS?

I’ve figured out how to get this region selection, but only for Windows. I still need to figure out how to do this for Android, iOS and MacOS

Here is the code for Windows:

#if PLATFORM_WINDOWS
#include "Windows/AllowWindowsPlatformTypes.h" 
#include <Windows.h>
#include "Windows/HideWindowsPlatformTypes.h" 
#endif

In a function:

#if PLATFORM_WINDOWS
	int geoId = GetUserGeoID(16);
	int lcid = GetUserDefaultLCID();
	wchar_t locationBuffer[3];
	GetGeoInfo(geoId, 4, locationBuffer, 3, lcid);

	return FString(locationBuffer);
#elif
	UE_LOG(LogTemp, Warning, TEXT("App is not running on windows, cannot get user country from Windows platform."));
	return FString();
#endif
1 Like