Search
lxdream.org :: lxdream :: r723:a13e5529c52a
lxdream 0.9.1
released Jun 29
Download Now
changeset723:a13e5529c52a
parent722:1a16b3914508
child724:f2bc1c7cca14
authornkeynes
dateSun Jul 06 03:16:21 2008 +0000 (11 years ago)
Add apple-specific binding for gettext
src/main.c
1.1 --- a/src/main.c Sat Jul 05 12:16:37 2008 +0000
1.2 +++ b/src/main.c Sun Jul 06 03:16:21 2008 +0000
1.3 @@ -33,6 +33,10 @@
1.4 #include "maple/maple.h"
1.5 #include "sh4/sh4.h"
1.6
1.7 +#ifdef APPLE_BUILD
1.8 +#include <AppKit/AppKit.h>
1.9 +#endif
1.10 +
1.11 char *option_list = "a:A:c:dhHl:m:npt:T:uvV:x?";
1.12 struct option longopts[] = {
1.13 { "aica", required_argument, NULL, 'a' },
1.14 @@ -89,6 +93,25 @@
1.15 printf( " -x %s\n", _("Disable the SH4 translator") );
1.16 }
1.17
1.18 +void bind_gettext_domain()
1.19 +{
1.20 +#ifdef ENABLE_NLS
1.21 +#ifdef APPLE_BUILD
1.22 + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1.23 + NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
1.24 + bindtextdomain( PACKAGE, [resourcePath UTF8String] );
1.25 +#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
1.26 + bind_textdomain_codeset( PACKAGE, "UTF-8" );
1.27 +#endif
1.28 + [pool release];
1.29 +#else
1.30 + bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
1.31 +#endif
1.32 + textdomain(PACKAGE);
1.33 +
1.34 +#endif
1.35 +}
1.36 +
1.37 int main (int argc, char *argv[])
1.38 {
1.39 int opt;
1.40 @@ -97,10 +120,7 @@
1.41 uint32_t time_secs, time_nanos;
1.42
1.43 install_crash_handler();
1.44 -#ifdef ENABLE_NLS
1.45 - bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
1.46 - textdomain (PACKAGE);
1.47 -#endif
1.48 + bind_gettext_domain();
1.49 display_ok = gui_parse_cmdline(&argc, &argv);
1.50
1.51 while( (opt = getopt_long( argc, argv, option_list, longopts, NULL )) != -1 ) {
.