summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-03-27 12:19:57 +0000
committerCarl Hetherington <cth@carlh.net>2013-03-27 12:19:57 +0000
commit419bcdc816802e50fdebb89bc9dd4a73ede103f5 (patch)
tree21f4feca34e28dbd4f1f94234ee69e3134abe0e1 /src/lib/util.cc
parent2f10afc2a4cc2156245a5db593ba7476c6caa4f5 (diff)
More fighting with i18n woes.
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 9a7794ce8..48cb17c26 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -263,22 +263,31 @@ mo_path ()
void
dvdomatic_setup_i18n (string lang)
{
+#ifdef DVDOMATIC_POSIX
+ lang += ".UTF8";
+#endif
+
+ if (!lang.empty ()) {
+ /* Override our environment language; this is essential on
+ Windows.
+ */
+ char cmd[64];
+ snprintf (cmd, sizeof(cmd), "LANGUAGE=%s", lang.c_str ());
+ putenv (cmd);
+ snprintf (cmd, sizeof(cmd), "LANG=%s", lang.c_str ());
+ putenv (cmd);
+ }
+
setlocale (LC_ALL, "");
textdomain ("libdvdomatic");
-
-#ifdef DVDOMATIC_WINDOWS
- string const e = "LANGUAGE=" + lang;
- putenv (e.c_str());
+#ifdef DVDOMATIC_WINDOWS
bindtextdomain ("libdvdomatic", mo_path().string().c_str());
-#else
- /* Hack to silence warning */
- lang.clear ();
#endif
#ifdef DVDOMATIC_POSIX
bindtextdomain ("libdvdomatic", POSIX_LOCALE_PREFIX);
-#endif
+#endif
}
/** @param start Start position for the crop within the image.