diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-03-21 16:31:48 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-03-21 16:31:48 +0000 |
| commit | 1c207805aef4443c5fb6c102e5be8a5b50002868 (patch) | |
| tree | 97748387388a2a7a644daa0d54a0dfc06bc35f1e /src/lib | |
| parent | f94ed8f663a5ce6e55484c10dcade6d7b7d2e5ed (diff) | |
Add Manual Acevedo's initial Spanish translation. Hopefully finally fix up translations on Windows.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 7 | ||||
| -rw-r--r-- | src/lib/config.h | 1 | ||||
| -rw-r--r-- | src/lib/util.cc | 27 | ||||
| -rw-r--r-- | src/lib/util.h | 4 |
4 files changed, 35 insertions, 4 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index ad132437a..5dce3748d 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -167,3 +167,10 @@ Config::default_directory_or (string a) const return _default_directory; } + +void +Config::drop () +{ + delete _instance; + _instance = 0; +} diff --git a/src/lib/config.h b/src/lib/config.h index 0e9c4a60a..ee46166e6 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -169,6 +169,7 @@ public: void write () const; static Config* instance (); + static void drop (); private: Config (); diff --git a/src/lib/util.cc b/src/lib/util.cc index 03c1f43dd..593d0e760 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -246,17 +246,36 @@ dvdomatic_setup () 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) { + setlocale (LC_ALL, ""); + textdomain ("libdvdomatic"); + #ifdef DVDOMATIC_WINDOWS string const e = "LANGUAGE=" + lang; putenv (e.c_str()); + + bindtextdomain ("libdvdomatic", mo_path().string().c_str()); #endif - - setlocale (LC_ALL, ""); - textdomain ("libdvdomatic"); - bindtextdomain ("libdvdomatic", LOCALE_PREFIX); + +#ifdef DVDOMATIC_POSIX + bindtextdomain ("libdvdomatic", POSIX_LOCALE_PREFIX); +#endif } /** @param start Start position for the crop within the image. diff --git a/src/lib/util.h b/src/lib/util.h index 60498be5a..3d251cf06 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -30,6 +30,7 @@ #include <boost/shared_ptr.hpp> #include <boost/asio.hpp> #include <boost/optional.hpp> +#include <boost/filesystem.hpp> #include <libdcp/util.h> extern "C" { #include <libavcodec/avcodec.h> @@ -60,6 +61,9 @@ extern std::string md5_digest (std::string); extern std::string md5_digest (void const *, int); extern void ensure_ui_thread (); extern std::string audio_channel_name (int); +#ifdef DVDOMATIC_WINDOWS +extern boost::filesystem::path mo_path (); +#endif typedef int SourceFrame; |
