From ef039c9d32e998af3ceab21673a51169f6e4f1ed Mon Sep 17 00:00:00 2001 From: Henrik Brautaset Aronsen Date: Mon, 15 Oct 2012 14:44:01 +0200 Subject: Support for gettext in MacOSX application bundle The MacOSX applications bundle needs to be told where to bind the text domain from. Also copy the gettext .mo files in the install-macosx target. [Dirk Hohndel: minor change in main(): move the path declaration to the beginning of the function] Signed-off-by: Henrik Brautaset Aronsen Signed-off-by: Dirk Hohndel --- macos.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'macos.c') diff --git a/macos.c b/macos.c index 3cc4ddf1e..3d9c9b5cd 100644 --- a/macos.c +++ b/macos.c @@ -104,6 +104,19 @@ const char *subsurface_default_filename() } } +const char *subsurface_gettext_domainpath() +{ + CFBundleRef mainBundle = CFBundleGetMainBundle(); + CFURLRef localeURL = CFBundleCopyResourceURL(mainBundle, CFSTR("locale"), CFSTR(""), NULL); + if (localeURL) { + CFStringRef localePath = CFURLCopyFileSystemPath(localeURL, kCFURLPOSIXPathStyle); + CFStringEncoding encodingMethod = CFStringGetSystemEncoding(); + const char *path = CFStringGetCStringPtr(localePath, encodingMethod); + return path; + } + return "./locale"; +} + static void show_main_window(GtkWidget *w, gpointer data) { gtk_widget_show(main_window); -- cgit v1.2.3-70-g09d2