After some try and error and lot of help from internet and other questions I did it.
If I want to get only the language.
CFLocaleRef cflocale = CFLocaleCopyCurrent();
auto value = (CFStringRef)CFLocaleGetValue(cflocale, kCFLocaleLanguageCode);
std::string str(CFStringGetCStringPtr(value, kCFStringEncodingUTF8));
CFRelease(cflocale);
This way, at str I'll get a std::string with the language. If I need something else, I can replace kCFLocaleLanguageCode
with any other constant from CFLocale
Also I needed the header #include <CoreFoundation/CoreFoundation.h>