summaryrefslogtreecommitdiffstats
path: root/src/detection/locale/locale_linux.c
blob: 4c04f26eb278d74f8dff80dd5da383713b6d7113 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "detection/locale/locale.h"

#include <locale.h>

const char* ffDetectLocale(FFstrbuf* result) {
    ffStrbufAppendS(result, getenv("LC_ALL"));
    if (result->length > 0) {
        return NULL;
    }

    ffStrbufAppendS(result, getenv("LANG"));
    if (result->length > 0) {
        return NULL;
    }

    ffStrbufAppendS(result, setlocale(LC_TIME, NULL));
    if (result->length > 0) {
        return NULL;
    }

    return "Failed to detect locale";
}