The unified diff between revisions [5587f68e..] and [95cbeaa8..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'ui.cc'
#
#
# patch "ui.cc"
# from [2c9b65e320b66d6b104bee5885723c4f97f36e8b]
# to [0fa61fa5c584e05a187d6c7e29c8336e4d7f3455]
#
============================================================
--- ui.cc 2c9b65e320b66d6b104bee5885723c4f97f36e8b
+++ ui.cc 0fa61fa5c584e05a187d6c7e29c8336e4d7f3455
@@ -380,10 +380,23 @@ guess_terminal_width()
return w;
}
-// a cache used to avoid initialising locale("") on every call to boost::format
-const locale
+const locale &
get_user_locale()
{
- static const locale user_locale("");
+ // this is awkward because if LC_CTYPE is set to something the
+ // runtime doesn't know about, it will fail. in that case,
+ // the default will have to do.
+ static bool init = false;
+ static locale user_locale;
+ if (!init)
+ {
+ init = true;
+ try
+ {
+ user_locale = locale("");
+ }
+ catch( ... )
+ {}
+ }
return user_locale;
}