Runs.
[dcpomatic.git] / src / lib / util.cc
index 593d0e76043953abc1f306ac12c29f33d6ef43db..0247408679f172a3ae29b5737083e8e625b0debc 100644 (file)
@@ -263,19 +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());
-#endif
+#endif 
 
 #ifdef DVDOMATIC_POSIX
        bindtextdomain ("libdvdomatic", POSIX_LOCALE_PREFIX);
-#endif 
+#endif
 }
 
 /** @param start Start position for the crop within the image.
@@ -335,11 +347,11 @@ md5_digest (void const * data, int size)
  *  @return MD5 digest of file's contents.
  */
 string
-md5_digest (string file)
+md5_digest (boost::filesystem::path file)
 {
-       ifstream f (file.c_str(), ios::binary);
+       ifstream f (file.string().c_str(), ios::binary);
        if (!f.good ()) {
-               throw OpenFileError (file);
+               throw OpenFileError (file.string());
        }
        
        f.seekg (0, ios::end);
@@ -914,12 +926,12 @@ audio_channel_name (int c)
           enhancement channel (sub-woofer)./
        */
        string const channels[] = {
-               "Left",
-               "Right",
-               "Centre",
-               "Lfe (sub)",
-               "Left surround",
-               "Right surround",
+               _("Left"),
+               _("Right"),
+               _("Centre"),
+               _("Lfe (sub)"),
+               _("Left surround"),
+               _("Right surround"),
        };
 
        return channels[c];