mirror of https://github.com/djcb/mu.git
parent
0fe8f9a613
commit
015a7ee0cb
|
@ -49,6 +49,8 @@
|
||||||
#include "mu-error.hh"
|
#include "mu-error.hh"
|
||||||
#include "mu-option.hh"
|
#include "mu-option.hh"
|
||||||
|
|
||||||
|
#include "message/mu-message-file.hh"
|
||||||
|
|
||||||
using namespace Mu;
|
using namespace Mu;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -642,20 +644,21 @@ Mu::TempDir::~TempDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Mu::locale_workaround()
|
Mu::locale_workaround() try
|
||||||
{
|
{
|
||||||
// quite horrible... but some systems break otherwise with
|
// quite horrible... but some systems break otherwise with
|
||||||
// https://github.com/djcb/mu/issues/2252
|
// https://github.com/djcb/mu/issues/2252
|
||||||
|
|
||||||
for (auto&& loc : {"", "en_US.UTF-8", "C" }) {
|
try {
|
||||||
try {
|
std::locale::global(std::locale(""));
|
||||||
std::locale::global(std::locale(loc));
|
} catch (const std::runtime_error& re) {
|
||||||
return true;
|
g_setenv("LC_ALL", "C", 1);
|
||||||
} catch (const std::runtime_error& re) {
|
std::locale::global(std::locale(""));
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} catch (...) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,6 +270,16 @@ test_to_from_lexnum()
|
||||||
g_assert_cmpuint(from_lexnum(to_lexnum(9876543)), ==, 9876543);
|
g_assert_cmpuint(from_lexnum(to_lexnum(9876543)), ==, 9876543);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_locale_workaround()
|
||||||
|
{
|
||||||
|
g_assert_true(locale_workaround());
|
||||||
|
|
||||||
|
g_setenv("LC_ALL", "BOO", 1);
|
||||||
|
|
||||||
|
g_assert_true(locale_workaround());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char* argv[])
|
main(int argc, char* argv[])
|
||||||
|
@ -287,6 +297,7 @@ main(int argc, char* argv[])
|
||||||
g_test_add_func("/utils/join", test_join);
|
g_test_add_func("/utils/join", test_join);
|
||||||
g_test_add_func("/utils/define-bitmap", test_define_bitmap);
|
g_test_add_func("/utils/define-bitmap", test_define_bitmap);
|
||||||
g_test_add_func("/utils/to-from-lexnum", test_to_from_lexnum);
|
g_test_add_func("/utils/to-from-lexnum", test_to_from_lexnum);
|
||||||
|
g_test_add_func("/utils/locale-workaround", test_locale_workaround);
|
||||||
|
|
||||||
return g_test_run();
|
return g_test_run();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue