specific.c 3.13 KB
Newer Older
1

Sam Hocevar's avatar
 
Sam Hocevar committed
2
/*****************************************************************************
3
 * darwin_specific.m: Darwin specific features
Sam Hocevar's avatar
 
Sam Hocevar committed
4
 *****************************************************************************
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
5
 * Copyright (C) 2001-2009 VLC authors and VideoLAN
Derk-Jan Hartman's avatar
-  
Derk-Jan Hartman committed
6
 * $Id$
Sam Hocevar's avatar
 
Sam Hocevar committed
7
 *
8
 * Authors: Sam Hocevar <sam@zoy.org>
9
 *          Christophe Massiot <massiot@via.ecp.fr>
10
 *          Pierre d'Herbemont <pdherbemont@free.fr>
Sam Hocevar's avatar
 
Sam Hocevar committed
11
 *
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
12 13 14
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
Sam Hocevar's avatar
 
Sam Hocevar committed
15
 * (at your option) any later version.
16
 *
Sam Hocevar's avatar
 
Sam Hocevar committed
17 18
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
19 20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
Sam Hocevar's avatar
 
Sam Hocevar committed
21
 *
Jean-Baptiste Kempf's avatar
LGPL  
Jean-Baptiste Kempf committed
22 23 24
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
Sam Hocevar's avatar
 
Sam Hocevar committed
25 26
 *****************************************************************************/

27 28 29 30
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

31
#include <vlc_common.h>
32
#include "../libvlc.h"
33
#include <dirent.h>                                                /* *dir() */
34
#include <CoreFoundation/CoreFoundation.h>
35

36 37 38 39
#ifdef HAVE_LOCALE_H
#   include <locale.h>
#endif

40 41 42
/*****************************************************************************
 * system_Init: fill in program path & retrieve language
 *****************************************************************************/
43
void system_Init(void)
Sam Hocevar's avatar
 
Sam Hocevar committed
44
{
45
#ifdef ENABLE_NLS
46
    /* Check if $LANG is set. */
Jean-Paul Saman's avatar
Jean-Paul Saman committed
47
    if( NULL == getenv("LANG") )
48
    {
49 50 51
        /*
           Retrieve the preferred language as chosen in  System Preferences.app
           (note that CFLocaleCopyCurrent() is not used because it returns the
Sam Hocevar's avatar
Sam Hocevar committed
52
            preferred locale not language)
53 54 55 56
        */
        CFArrayRef all_locales, preferred_locales;
        char psz_locale[50];

57
        all_locales = CFLocaleCopyAvailableLocaleIdentifiers();
58 59 60 61

        preferred_locales = CFBundleCopyLocalizationsForPreferences( all_locales, NULL );

        if ( preferred_locales )
62
        {
63
            if ( CFArrayGetCount( preferred_locales ) )
64
            {
65 66 67
                CFStringRef user_language_string_ref = CFArrayGetValueAtIndex( preferred_locales, 0 );
                CFStringGetCString( user_language_string_ref, psz_locale, sizeof(psz_locale), kCFStringEncodingUTF8 );
                setenv( "LANG", psz_locale, 1 );
68
            }
69
            CFRelease( preferred_locales );
70
        }
71
        CFRelease( all_locales );
72
    }
73
#endif
Sam Hocevar's avatar
 
Sam Hocevar committed
74 75
}

76 77 78
/*****************************************************************************
 * system_Configure: check for system specific configuration options.
 *****************************************************************************/
79 80
void system_Configure( libvlc_int_t *p_this,
                       int i_argc, const char *const ppsz_argv[] )
81
{
82
    (void)p_this;
83
    (void)i_argc;
84
    (void)ppsz_argv;
85
}