Fix disabling l10n under Linux

This commit is contained in:
Václav Šmilauer 2022-10-09 08:26:52 +02:00 committed by Paul Davis
parent c04b05f497
commit 6ad3dc1e43
1 changed files with 8 additions and 0 deletions

View File

@ -275,6 +275,14 @@ int main (int argc, char *argv[])
if (!setlocale (LC_ALL, "")) {
std::cerr << "localization call failed, " << PROGRAM_NAME << " will not be translated\n";
}
} else {
/* Force-disable localization if the user wishes so;
just calling setlocale (...,"C") is not sufficient for this;
it is probably the LANG env var which gets picked up later somewhere.
*/
setenv ("LC_ALL", "C", 1);
setenv ("LC_MESSAGES", "C", 1);
setenv ("LANG", "C", 1);
}
#endif