revision 723:a13e5529c52a
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 723:a13e5529c52a |
parent | 722:1a16b3914508 |
child | 724:f2bc1c7cca14 |
author | nkeynes |
date | Sun Jul 06 03:16:21 2008 +0000 (15 years ago) |
Add apple-specific binding for gettext
src/main.c | view | annotate | diff | log |
1.1 --- a/src/main.c Sat Jul 05 12:16:37 2008 +00001.2 +++ b/src/main.c Sun Jul 06 03:16:21 2008 +00001.3 @@ -33,6 +33,10 @@1.4 #include "maple/maple.h"1.5 #include "sh4/sh4.h"1.7 +#ifdef APPLE_BUILD1.8 +#include <AppKit/AppKit.h>1.9 +#endif1.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.18 +void bind_gettext_domain()1.19 +{1.20 +#ifdef ENABLE_NLS1.21 +#ifdef APPLE_BUILD1.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_CODESET1.26 + bind_textdomain_codeset( PACKAGE, "UTF-8" );1.27 +#endif1.28 + [pool release];1.29 +#else1.30 + bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);1.31 +#endif1.32 + textdomain(PACKAGE);1.33 +1.34 +#endif1.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.43 install_crash_handler();1.44 -#ifdef ENABLE_NLS1.45 - bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);1.46 - textdomain (PACKAGE);1.47 -#endif1.48 + bind_gettext_domain();1.49 display_ok = gui_parse_cmdline(&argc, &argv);1.51 while( (opt = getopt_long( argc, argv, option_list, longopts, NULL )) != -1 ) {
.