Correctly detect locale on ubuntu systems

This commit is contained in:
Linus Dierheimer
2022-05-29 16:17:36 +02:00
parent 044e5496fd
commit 743bc07bad
+12 -2
View File
@@ -28,10 +28,20 @@ void ffPrintLocale(FFinstance* instance)
FFstrbuf locale;
ffStrbufInit(&locale);
ffParsePropFile(FASTFETCH_TARGET_DIR_ROOT"/etc/locale.conf", "LANG =", &locale);
//Ubuntu (and deriviates) use a non standard locale file.
//Parse it first, because on distributions where it exists, it takes precedence.
//Otherwise use the standard /etc/locale.conf file.
ffParsePropFile(FASTFETCH_TARGET_DIR_ROOT"/etc/default/locale", "LANG =", &locale);
if (locale.length == 0)
if(locale.length == 0)
{
ffParsePropFile(FASTFETCH_TARGET_DIR_ROOT"/etc/locale.conf", "LANG =", &locale);
}
if(locale.length == 0)
{
getLocaleFromEnv(&locale);
}
if(locale.length == 0)
{