mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-26 17:58:19 +03:00
Specify a locale if none is set
Sometimes users had not properly configured their system locale and thus qbt will specify a default locale just in case. Closes #16127. Closes #19609. Closes #19834. PR #20203.
This commit is contained in:
parent
a56b3edc58
commit
77d907c2aa
1 changed files with 10 additions and 0 deletions
|
@ -94,6 +94,7 @@ void showSplashScreen();
|
|||
|
||||
#ifdef Q_OS_UNIX
|
||||
void adjustFileDescriptorLimit();
|
||||
void adjustLocale();
|
||||
#endif
|
||||
|
||||
// Main
|
||||
|
@ -104,6 +105,7 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
adjustLocale();
|
||||
adjustFileDescriptorLimit();
|
||||
#endif
|
||||
|
||||
|
@ -392,4 +394,12 @@ void adjustFileDescriptorLimit()
|
|||
limit.rlim_cur = limit.rlim_max;
|
||||
setrlimit(RLIMIT_NOFILE, &limit);
|
||||
}
|
||||
|
||||
void adjustLocale()
|
||||
{
|
||||
// specify the default locale just in case if user has not set any other locale
|
||||
// only `C` locale is available universally without installing locale packages
|
||||
if (qEnvironmentVariableIsEmpty("LANG"))
|
||||
qputenv("LANG", "C.UTF-8");
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue