2 /*****************************************************************************
3 * darwin_specific.m: Darwin specific features
4 *****************************************************************************
5 * Copyright (C) 2001-2009 VLC authors and VideoLAN
7 * Authors: Sam Hocevar <sam@zoy.org>
8 * Christophe Massiot <massiot@via.ecp.fr>
9 * Pierre d'Herbemont <pdherbemont@free.fr>
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 2.1 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program; if not, write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
30 #include <vlc_common.h>
31 #include "../libvlc.h"
32 #include <dirent.h> /* *dir() */
33 #include <CoreFoundation/CoreFoundation.h>
37 /*****************************************************************************
38 * system_Init: fill in program path & retrieve language
39 *****************************************************************************/
40 void system_Init(void)
43 /* Check if $LANG is set. */
44 if( NULL
== getenv("LANG") )
47 Retrieve the preferred language as chosen in System Preferences.app
48 (note that CFLocaleCopyCurrent() is not used because it returns the
49 preferred locale not language)
51 CFArrayRef all_locales
, preferred_locales
;
54 all_locales
= CFLocaleCopyAvailableLocaleIdentifiers();
56 preferred_locales
= CFBundleCopyLocalizationsForPreferences( all_locales
, NULL
);
58 if ( preferred_locales
)
60 if ( CFArrayGetCount( preferred_locales
) )
62 CFStringRef user_language_string_ref
= CFArrayGetValueAtIndex( preferred_locales
, 0 );
63 CFStringGetCString( user_language_string_ref
, psz_locale
, sizeof(psz_locale
), kCFStringEncodingUTF8
);
64 setenv( "LANG", psz_locale
, 1 );
66 CFRelease( preferred_locales
);
68 CFRelease( all_locales
);
73 /*****************************************************************************
74 * system_Configure: check for system specific configuration options.
75 *****************************************************************************/
76 void system_Configure( libvlc_int_t
*p_this
,
77 int i_argc
, const char *const ppsz_argv
[] )