start passing around the (possibly-bundle-modified) localedir so that we call bindtextdomain() correctly, and thus (hopefully) find message catalogs correctly inside a bundle

git-svn-id: svn://localhost/ardour2/branches/3.0@13965 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2013-01-21 23:14:00 +00:00
parent c09dc77dfc
commit 2a2b48ef66
7 changed files with 27 additions and 11 deletions

View file

@ -131,7 +131,7 @@ sigc::signal<void> ARDOUR_UI::RapidScreenUpdate;
sigc::signal<void> ARDOUR_UI::SuperRapidScreenUpdate; sigc::signal<void> ARDOUR_UI::SuperRapidScreenUpdate;
sigc::signal<void, framepos_t, bool, framepos_t> ARDOUR_UI::Clock; sigc::signal<void, framepos_t, bool, framepos_t> ARDOUR_UI::Clock;
ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
: Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp) : Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp)
@ -167,7 +167,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
, _feedback_exists (false) , _feedback_exists (false)
{ {
Gtkmm2ext::init(); Gtkmm2ext::init(localedir);
about = 0; about = 0;
splash = 0; splash = 0;
@ -266,7 +266,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
/* lets get this party started */ /* lets get this party started */
try { try {
if (ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization)) { if (ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization, localedir)) {
throw failed_constructor (); throw failed_constructor ();
} }

View file

@ -116,7 +116,7 @@ namespace ARDOUR {
class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
{ {
public: public:
ARDOUR_UI (int *argcp, char **argvp[]); ARDOUR_UI (int *argcp, char **argvp[], const char* localedir);
~ARDOUR_UI(); ~ARDOUR_UI();
bool run_startup (bool should_be_new, std::string load_template); bool run_startup (bool should_be_new, std::string load_template);

View file

@ -148,6 +148,14 @@ fixup_bundle_environment (int, char* [])
bundle_dir = Glib::path_get_dirname (exec_dir); bundle_dir = Glib::path_get_dirname (exec_dir);
/* force localedir into the bundle */
vector<string> lpath;
lpath.push_back (bundle_dir);
lpath.push_back ("share");
lpath.push_back ("locale");
localedir = strdup (Glib::build_filename (lpath).c_str());
export_search_path (bundle_dir, "ARDOUR_DLL_PATH", "/lib"); export_search_path (bundle_dir, "ARDOUR_DLL_PATH", "/lib");
/* inside an OS X .app bundle, there is no difference /* inside an OS X .app bundle, there is no difference
@ -224,6 +232,14 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
std::string dir_path = Glib::path_get_dirname (Glib::path_get_dirname (argv[0])); std::string dir_path = Glib::path_get_dirname (Glib::path_get_dirname (argv[0]));
std::string userconfigdir = user_config_directory(); std::string userconfigdir = user_config_directory();
/* force localedir into the bundle */
vector<string> lpath;
lpath.push_back (dir_path);
lpath.push_back ("share");
lpath.push_back ("locale");
localedir = strdup (Glib::build_filename (lpath).c_str());
/* note that this function is POSIX/Linux specific, so using / as /* note that this function is POSIX/Linux specific, so using / as
a dir separator in this context is just fine. a dir separator in this context is just fine.
*/ */
@ -446,7 +462,7 @@ int main (int argc, char *argv[])
} }
try { try {
ui = new ARDOUR_UI (&argc, &argv); ui = new ARDOUR_UI (&argc, &argv, localedir);
} catch (failed_constructor& err) { } catch (failed_constructor& err) {
error << _("could not create ARDOUR GUI") << endmsg; error << _("could not create ARDOUR GUI") << endmsg;
exit (1); exit (1);

View file

@ -50,7 +50,7 @@ namespace ARDOUR {
extern PBD::Signal1<void,std::string> BootMessage; extern PBD::Signal1<void,std::string> BootMessage;
extern PBD::Signal0<void> GUIIdle; extern PBD::Signal0<void> GUIIdle;
int init (bool with_vst, bool try_optimization); int init (bool with_vst, bool try_optimization, const char* localedir);
void init_post_engine (); void init_post_engine ();
int cleanup (); int cleanup ();
bool no_auto_connect (); bool no_auto_connect ();

View file

@ -215,7 +215,7 @@ lotsa_files_please ()
} }
int int
ARDOUR::init (bool use_windows_vst, bool try_optimization) ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir)
{ {
if (!Glib::thread_supported()) { if (!Glib::thread_supported()) {
Glib::thread_init(); Glib::thread_init();
@ -224,7 +224,7 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization)
// this really should be in PBD::init..if there was one // this really should be in PBD::init..if there was one
Gio::init (); Gio::init ();
(void) bindtextdomain(PACKAGE, LOCALEDIR); (void) bindtextdomain(PACKAGE, localedir);
PBD::ID::init (); PBD::ID::init ();
SessionEvent::init_event_pool (); SessionEvent::init_event_pool ();

View file

@ -45,7 +45,7 @@ namespace Gtk {
} }
namespace Gtkmm2ext { namespace Gtkmm2ext {
void init (); void init (const char*);
std::string fit_to_pixels (const std::string&, int pixel_width, Pango::FontDescription& font, int& actual_width, bool with_ellipses = false); std::string fit_to_pixels (const std::string&, int pixel_width, Pango::FontDescription& font, int& actual_width, bool with_ellipses = false);
std::pair<std::string, double> fit_to_pixels (cairo_t *, std::string, double); std::pair<std::string, double> fit_to_pixels (cairo_t *, std::string, double);

View file

@ -37,10 +37,10 @@
using namespace std; using namespace std;
void void
Gtkmm2ext::init () Gtkmm2ext::init (const char* localedir)
{ {
// Necessary for gettext // Necessary for gettext
(void) bindtextdomain(PACKAGE, LOCALEDIR); (void) bindtextdomain(PACKAGE, localedir);
} }
void void