diff options
-rw-r--r-- | apt-private/private-main.cc | 6 | ||||
-rw-r--r-- | methods/aptmethod.h | 6 | ||||
-rwxr-xr-x | test/integration/test-00-commands-have-help | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/apt-private/private-main.cc b/apt-private/private-main.cc index 0075f813f..d6517dd2a 100644 --- a/apt-private/private-main.cc +++ b/apt-private/private-main.cc @@ -18,7 +18,11 @@ void InitLocale(APT_CMD const binary) /*{{{*/ { - std::locale::global(std::locale("")); + try { + std::locale::global(std::locale("")); + } catch (...) { + setlocale(LC_ALL, ""); + } switch(binary) { case APT_CMD::APT: diff --git a/methods/aptmethod.h b/methods/aptmethod.h index cf3496e45..bef61a8bc 100644 --- a/methods/aptmethod.h +++ b/methods/aptmethod.h @@ -46,7 +46,11 @@ public: aptMethod(char const * const Binary, char const * const Ver, unsigned long const Flags) : pkgAcqMethod(Ver, Flags), Binary(Binary) { - std::locale::global(std::locale("")); + try { + std::locale::global(std::locale("")); + } catch (...) { + setlocale(LC_ALL, ""); + } } }; diff --git a/test/integration/test-00-commands-have-help b/test/integration/test-00-commands-have-help index 9d66f9221..c7d794b34 100755 --- a/test/integration/test-00-commands-have-help +++ b/test/integration/test-00-commands-have-help @@ -11,6 +11,8 @@ configarchitecture 'amd64' # but it also checks if the binary can find all methods in the library. # The later is quite handy for manual testing of non-abibreaking changes export LD_BIND_NOW=1 +# german variant of klingon used for testing usage of non-existent l10n +export LC_ALL=tlh_DE.UTF-8 checkversionmessage() { testsuccess grep '^apt .* (' ${1}-help.output |