diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | dive.h | 1 | ||||
-rw-r--r-- | linux.c | 5 | ||||
-rw-r--r-- | macos.c | 13 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | windows.c | 5 |
6 files changed, 31 insertions, 1 deletions
@@ -154,6 +154,10 @@ install-macosx: $(NAME) $(INSTALL) $(MACOSXFILES)/Info.plist $(MACOSXINSTALL)/Contents/ $(INSTALL) $(ICONFILE) $(MACOSXINSTALL)/Contents/Resources/ $(INSTALL) $(MACOSXFILES)/Subsurface.icns $(MACOSXINSTALL)/Contents/Resources/ + $(INSTALL) -d -m 755 $(addprefix $(MACOSXINSTALL)/Contents/Resources/,$(dir $(MSGOBJS))) + for MSG in $(MSGOBJS); do\ + install $$MSG $(MACOSXINSTALL)/Contents/Resources/$$MSG;\ + done file.o: file.c dive.h file.h $(CC) $(CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) $(XSLT) $(ZIP) -c file.c @@ -435,6 +435,7 @@ extern const char *star_strings[]; extern const char *default_filename; extern const char *existing_filename; extern const char *subsurface_default_filename(void); +extern const char *subsurface_gettext_domainpath(void); extern void subsurface_command_line_init(gint *, gchar ***); extern void subsurface_command_line_exit(gint *, gchar ***); #define AIR_PERMILLE 209 @@ -84,6 +84,11 @@ const char *subsurface_default_filename() } } +const char *subsurface_gettext_domainpath() +{ + return "./locale"; +} + void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar, GtkWidget *vbox, GtkUIManager *ui_manager) { @@ -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); @@ -225,12 +225,14 @@ int main(int argc, char **argv) { int i; gboolean no_filenames = TRUE; + const char *path; /* set up l18n - the search directory needs to change * so that it uses the correct system directory when * subsurface isn't run from the local directory */ setlocale( LC_ALL, "" ); - bindtextdomain("subsurface", "./locale"); + path = subsurface_gettext_domainpath(); + bindtextdomain("subsurface", path); bind_textdomain_codeset("subsurface", "utf-8"); textdomain("subsurface"); output_units = SI_units; @@ -151,6 +151,11 @@ const char *subsurface_default_filename() } } +const char *subsurface_gettext_domainpath() +{ + return "./locale"; +} + void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar, GtkWidget *vbox, GtkUIManager *ui_manager) { |