void
dvdomatic_setup ()
{
- bindtextdomain ("libdvdomatic", LOCALE_PREFIX);
- setlocale (LC_ALL, "");
-
avfilter_register_all ();
Format::setup_formats ();
ui_thread = this_thread::get_id ();
}
+#ifdef DVDOMATIC_WINDOWS
+boost::filesystem::path
+mo_path ()
+{
+ wchar_t buffer[512];
+ GetModuleFileName (0, buffer, 512 * sizeof(wchar_t));
+ boost::filesystem::path p (buffer);
+ p = p.parent_path ();
+ p = p.parent_path ();
+ p /= "locale";
+ return p;
+}
+#endif
+
+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
+ bindtextdomain ("libdvdomatic", mo_path().string().c_str());
+#endif
+
+#ifdef DVDOMATIC_POSIX
+ bindtextdomain ("libdvdomatic", POSIX_LOCALE_PREFIX);
+#endif
+}
+
/** @param start Start position for the crop within the image.
* @param size Size of the cropped area.
* @return FFmpeg crop filter string.
* @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);
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];
change_speed = !about_equal (source * factor(), dcp);
if (!skip && !repeat && !change_speed) {
- explanation = _("DCP and source have the same rate.\n");
+ description = _("DCP and source have the same rate.\n");
} else {
if (skip) {
- explanation = _("DCP will use every other frame of the source.\n");
+ description = _("DCP will use every other frame of the source.\n");
} else if (repeat) {
- explanation = _("Each source frame will be doubled in the DCP.\n");
+ description = _("Each source frame will be doubled in the DCP.\n");
}
if (change_speed) {
- float const pc = (source * factor()) * 100 / dcp;
- explanation += String::compose (_("DCP will run at %1%% of the source speed."), pc);
+ float const pc = dcp * 100 / (source * factor());
+ description += String::compose (_("DCP will run at %1%% of the source speed."), pc);
}
}
}