Skip to content

Commit

Permalink
Locale (Linux): use environment variable if available
Browse files Browse the repository at this point in the history
In some machine `setlocale(LC_MESSAGES, NULL)` returns `C` for some reason.
  • Loading branch information
CarterLi committed Feb 5, 2024
1 parent 48d1980 commit ce6b2b8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/detection/locale/locale_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

void ffDetectLocale(FFstrbuf* result)
{
ffStrbufAppendS(result, getenv("LC_MESSAGES"));
if(result->length > 0)
return;

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

#ifdef LC_MESSAGES
ffStrbufAppendS(result, setlocale(LC_MESSAGES, NULL));

Expand Down

0 comments on commit ce6b2b8

Please sign in to comment.