X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmisc%2Fdarwin_specific.m;h=9906681ad79862a94fa52c24785554f0921f1091;hb=30efcc2bae6e7968b1c87f9cb6dc29404232e08a;hp=c2154da8040fecdf07f6a86ab8a96e2d161745bf;hpb=50eabda652cd9581b0d0c8e94017faa092db0d50;p=vlc diff --git a/src/misc/darwin_specific.m b/src/misc/darwin_specific.m index c2154da804..9906681ad7 100644 --- a/src/misc/darwin_specific.m +++ b/src/misc/darwin_specific.m @@ -1,17 +1,17 @@ /***************************************************************************** - * darwin_specific.m: Darwin specific features + * darwin_specific.m: Darwin specific features ***************************************************************************** - * Copyright (C) 2001 VideoLAN - * $Id: darwin_specific.m,v 1.9 2003/02/04 20:45:24 hartman Exp $ + * Copyright (C) 2001-2004 VideoLAN + * $Id$ * - * Authors: Samuel Hocevar + * Authors: Sam Hocevar * Christophe Massiot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -28,47 +28,54 @@ #include +#ifdef HAVE_LOCALE_H +# include +#endif + /***************************************************************************** * system_Init: fill in program path & retrieve language *****************************************************************************/ static int FindLanguage( const char * psz_lang ) { - const char * psz_short = NULL; - - if ( !strcmp(psz_lang, "German") ) + const char ** ppsz_parser; + const char * ppsz_all[] = { - psz_short = "de"; - } - else if ( !strcmp(psz_lang, "British") ) - { - psz_short = "en_GB"; - } - else if ( !strcmp(psz_lang, "French") ) + "Bengali", "bn", + "Catalan", "ca", + "Danish", "da", + "German", "de", + "Modern Greek", "el", + "British", "en_GB", + "English", "en", + "Spanish", "es", + "French", "fr", + "Hindi", "hi", + "Hungarian", "hu", + "Italian", "it", + "Japanese", "ja", + "Burmese", "my", + "Nepali", "ne", + "Dutch", "nl", + "Norwegian", "no", + "Polish", "pl", + "Pashto", "ps", + "Brazillian Portuguese", "pt_BR", + "Russian", "ru", + "Swedish", "sv", + "Tetum", "tet", + "Tagalog", "tl", + "Chinese Traditional", "zh_TW", + NULL + }; + + for( ppsz_parser = ppsz_all ; ppsz_parser[0] ; ppsz_parser += 2 ) { - psz_short = "fr"; - } - else if ( !strcmp(psz_lang, "Italian") ) - { - psz_short = "it"; - } - else if ( !strcmp(psz_lang, "Japanese") ) - { - psz_short = "ja"; - } - else if ( !strcmp(psz_lang, "Dutch") ) - { - psz_short = "nl"; - } - else - { - /* Just in case gettext knows about this. */ - psz_short = psz_lang; - } - - if ( psz_short != NULL ) - { - setenv("LANG", psz_short, 1); - return 1; + if( !strcmp( psz_lang, ppsz_parser[0] ) + || !strcmp( psz_lang, ppsz_parser[1] ) ) + { + setenv( "LANG", ppsz_parser[1], 1 ); + return 1; + } } return 0; @@ -98,24 +105,23 @@ void system_Init( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] ) /* Check if $LANG is set. */ if ( (p_char = getenv("LANG")) == NULL ) { - vlc_bool_t b_found = 0; NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; /* Retrieve user's preferences. */ - NSUserDefaults * o_defs = [NSUserDefaults standardUserDefaults]; - NSArray * o_languages = [o_defs objectForKey:@"AppleLanguages"]; - NSEnumerator * o_enumerator = [o_languages objectEnumerator]; + NSUserDefaults * o_defs = [NSUserDefaults standardUserDefaults]; + NSArray * o_languages = [o_defs objectForKey:@"AppleLanguages"]; + NSEnumerator * o_enumerator = [o_languages objectEnumerator]; NSString * o_lang; - while ( (o_lang = [o_enumerator nextObject]) && ( !b_found ) ) - { + while ( (o_lang = [o_enumerator nextObject]) ) + { const char * psz_string = [o_lang lossyCString]; if ( FindLanguage( psz_string ) ) { - b_found = 1; + break; } } - + [o_pool release]; } } @@ -123,7 +129,7 @@ void system_Init( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] ) /***************************************************************************** * system_Configure: check for system specific configuration options. *****************************************************************************/ -void system_Configure( vlc_t *p_this ) +void system_Configure( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] ) { }