mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 09:33:39 +01:00
Locale (macOS): queries system-wide locale preference
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
#include "detection/locale/locale.h"
|
||||
#include "common/apple/cf_helpers.h"
|
||||
|
||||
const char* ffDetectLocale(FFstrbuf* result) {
|
||||
// Read the system-wide locale preference (equivalent to `defaults read -g AppleLocale`),
|
||||
// which is NOT affected by user environment variables (LANG, LC_ALL, etc.)
|
||||
FF_CFTYPE_AUTO_RELEASE CFStringRef appleLocale = CFPreferencesCopyAppValue(CFSTR("AppleLocale"), kCFPreferencesAnyApplication);
|
||||
if (!appleLocale) {
|
||||
return "Failed to read AppleLocale";
|
||||
}
|
||||
|
||||
return ffCfStrGetString(appleLocale, result);
|
||||
}
|
||||
Reference in New Issue
Block a user