Commit 567eba17 authored by Christophe Massiot's avatar Christophe Massiot

* We now use UTF-8 internally under Mac OS X. This requires a libiconv-

enabled version of gettext. (patch courtesy of the DJ)
parent d59b2b17
......@@ -183,8 +183,7 @@ if test "${nls_cv_force_use_gnu_gettext}" = "yes"; then
else
AC_CHECK_FUNCS(textdomain,,[
AC_CHECK_LIB(intl,textdomain,
LDFLAGS_vlc="${LDFLAGS_vlc} ${LIBINTL}"
LDFLAGS_plugins="${LDFLAGS_plugins} ${LIBINTL}",,
LDFLAGS_vlc="${LDFLAGS_vlc} ${LIBINTL}",,
${LIBINTL}
)
])
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.64 2003/05/20 16:20:33 zorglub Exp $
* $Id: vlc_common.h,v 1.65 2003/05/25 17:27:13 massiot Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -678,8 +678,12 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
(defined(MODULE_NAME_IS_gnome)||defined(MODULE_NAME_IS_gnome_main)||\
defined(MODULE_NAME_IS_gnome2)||defined(MODULE_NAME_IS_gnome2_main))
/* Declare nothing: gnome.h will do it for us */
#elif defined( ENABLE_NLS ) && defined( HAVE_INCLUDED_GETTEXT )
#elif defined( ENABLE_NLS )
#if defined( HAVE_INCLUDED_GETTEXT )
# include "libintl.h"
#else
# include <libintl.h>
#endif
# undef _
#if defined( __BORLANDC__ )
#define _(String) vlc_dgettext (PACKAGE_TARNAME, String)
......@@ -687,11 +691,6 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
# define _(String) vlc_dgettext (PACKAGE, String)
#endif
# define N_(String) ((char*)(String))
#elif defined( ENABLE_NLS ) && defined( HAVE_GETTEXT )
# include <libintl.h>
# undef _
# define _(String) dgettext (PACKAGE, String)
# define N_(String) ((char*)(String))
#else
# define _(String) ((char*)(String))
# define N_(String) ((char*)(String))
......
......@@ -2,7 +2,7 @@
* controls.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: controls.m,v 1.38 2003/05/11 18:41:27 hartman Exp $
* $Id: controls.m,v 1.39 2003/05/25 17:27:13 massiot Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -369,7 +369,7 @@
{
config_PutPsz( p_intf, "filter", "deinterlace" );
config_PutPsz( p_intf, "deinterlace-mode",
[[sender title] lossyCString] );
[[sender title] UTF8String] );
}
else
{
......@@ -536,7 +536,7 @@
if( psz_filter != NULL )
{
if( strcmp( psz_filter, [[o_mi title] lossyCString] ) == 0 )
if( strcmp( psz_filter, [[o_mi title] UTF8String] ) == 0 )
{
[o_mi setState: NSOnState];
}
......
......@@ -2,7 +2,7 @@
* info.m: MacOS X info panel
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: info.m,v 1.5 2003/03/18 02:28:53 hartman Exp $
* $Id: info.m,v 1.6 2003/05/25 17:27:13 massiot Exp $
*
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
*
......@@ -133,7 +133,7 @@
input_info_t * p_info;
/* Add a category */
o_title = [NSString stringWithCString: p_category->psz_name];
o_title = [NSString stringWithUTF8String: p_category->psz_name];
[o_selector addItemWithTitle: o_title];
/* Create empty content string */
......
......@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.85 2003/05/20 18:53:03 hartman Exp $
* $Id: intf.m,v 1.86 2003/05/25 17:27:13 massiot Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -113,34 +113,13 @@ static void Run( intf_thread_t *p_intf )
- (id)init
{
/* default encoding: ISO-8859-1 */
i_encoding = NSISOLatin1StringEncoding;
i_encoding = NSUTF8StringEncoding;
return( [super init] );
}
- (void)initIntlSupport
{
char *psz_lang = getenv( "LANG" );
if( psz_lang == NULL )
{
return;
}
if( strncmp( psz_lang, "pl", 2 ) == 0 )
{
i_encoding = NSISOLatin2StringEncoding;
}
else if( strncmp( psz_lang, "ja", 2 ) == 0 )
{
i_encoding = NSJapaneseEUCStringEncoding;
}
else if( strncmp( psz_lang, "ru", 2 ) == 0 )
{
#define CFSENC2NSSENC(e) CFStringConvertEncodingToNSStringEncoding(e)
i_encoding = CFSENC2NSSENC( kCFStringEncodingKOI8_R );
#undef CFSENC2NSSENC
}
}
- (NSString *)localizedString:(char *)psz
......@@ -149,10 +128,11 @@ static void Run( intf_thread_t *p_intf )
if( psz != NULL )
{
UInt32 uiLength = (UInt32)strlen( psz );
NSData * o_data = [NSData dataWithBytes: psz length: uiLength];
o_str = [[[NSString alloc] initWithData: o_data
encoding: i_encoding] autorelease];
o_str = [[[NSString alloc] initWithUTF8String: psz] autorelease];
}
if ( o_str == NULL )
{
msg_Err( p_intf, "could not translate: %s", psz );
}
return( o_str );
......@@ -764,7 +744,7 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
input_OffsetToTime( p_input, psz_time, p_area->i_tell );
o_time = [NSString stringWithCString: psz_time];
o_time = [NSString stringWithUTF8String: psz_time];
[o_timefield setStringValue: o_time];
}
......@@ -1183,7 +1163,7 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
#undef p_area
o_time = [NSString stringWithCString: psz_time];
o_time = [NSString stringWithUTF8String: psz_time];
[o_timefield setStringValue: o_time];
}
......
......@@ -2,7 +2,7 @@
* open.m: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: open.m,v 1.34 2003/05/20 18:53:03 hartman Exp $
* $Id: open.m,v 1.35 2003/05/25 17:27:13 massiot Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -238,7 +238,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
if (([o_file_sub_ckbox state] == NSOnState) && !([subPath isEqualTo: @""]))
{
config_PutPsz( p_intf, "sub-file", strdup( [subPath cString] ) );
config_PutPsz( p_intf, "sub-file", strdup( [subPath UTF8String] ) );
if ( [o_file_sub_override state] )
{
config_PutInt( p_intf, "sub-delay", (int)( [o_file_sub_delay intValue] * 10 ) );
......
......@@ -2,7 +2,7 @@
* output.m: MacOS X Output Dialog
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: output.m,v 1.5 2003/05/22 14:40:07 hartman Exp $
* $Id: output.m,v 1.6 2003/05/25 17:27:13 massiot Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -179,7 +179,7 @@
- (IBAction)outputCloseSheet:(id)sender
{
intf_thread_t * p_intf = [NSApp getIntf];
config_PutPsz( p_intf, "sout", [o_mrl lossyCString] );
config_PutPsz( p_intf, "sout", [o_mrl UTF8String] );
[o_output_sheet orderOut:sender];
[NSApp endSheet: o_output_sheet];
......
......@@ -2,7 +2,7 @@
* prefs.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: prefs.h,v 1.6 2003/05/20 15:23:25 hartman Exp $
* $Id: prefs.h,v 1.7 2003/05/25 17:27:13 massiot Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
......@@ -160,6 +160,6 @@ INTF_CONTROL_CONFIG(TextField);
{ \
[obj setModuleName: mname]; \
[obj setConfigType: ctype]; \
[obj setConfigName: [NSString stringWithCString: cname]]; \
[obj setConfigName: [NSString stringWithUTF8String: cname]]; \
}
......@@ -2,7 +2,7 @@
* prefs.m: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: prefs.m,v 1.26 2003/05/24 20:54:27 gbazin Exp $
* $Id: prefs.m,v 1.27 2003/05/25 17:27:13 massiot Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <thedj at users.sf.net>
......@@ -129,7 +129,7 @@
int i_type = [o_vlc_config configType];
NSString *o_name = [o_vlc_config configName];
char *psz_name = (char *)[o_name lossyCString];
char *psz_name = (char *)[o_name UTF8String];
switch( i_type )
{
......@@ -141,7 +141,7 @@
o_value = [o_vlc_config titleOfSelectedItem];
psz_value = [o_value isEqualToString: _NS("Auto") ] ? "" :
(char *)[o_value lossyCString];
(char *)[o_value UTF8String];
config_PutPsz( p_intf, psz_name, psz_value );
}
break;
......@@ -154,7 +154,7 @@
NSString *o_value;
o_value = [o_vlc_config stringValue];
psz_value = (char *)[o_value lossyCString];
psz_value = (char *)[o_value UTF8String];
config_PutPsz( p_intf, psz_name, psz_value );
}
......@@ -205,7 +205,7 @@
}
/* Enumerate config options and add corresponding config boxes */
o_module_name = [NSString stringWithCString: p_parser->psz_object_name];
o_module_name = [NSString stringWithUTF8String: p_parser->psz_object_name];
p_item = p_parser->p_config;
i_pos = 0;
......@@ -771,7 +771,7 @@ static VLCTreeItem *o_root_item = nil;
char *psz_module_name;
int i_index;
psz_module_name = (char *)[o_module_name lossyCString];
psz_module_name = (char *)[o_module_name UTF8String];
/* look for module */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
......
......@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.87 2003/05/21 15:40:03 hartman Exp $
* $Id: libvlc.c,v 1.88 2003/05/25 17:27:13 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -346,6 +346,12 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
textdomain( PACKAGE );
#if defined( SYS_BEOS ) || defined ( SYS_DARWIN )
/* BeOS only support UTF8 strings */
/* Mac OS X prefers UTF8 */
bind_textdomain_codeset( PACKAGE, "UTF-8" );
#endif
module_EndBank( p_vlc );
module_InitBank( &libvlc );
module_LoadMain( &libvlc );
......@@ -1061,8 +1067,9 @@ static void SetLanguage ( char const *psz_lang )
/* Set the default domain */
textdomain( PACKAGE );
#ifdef SYS_BEOS
#if defined( SYS_BEOS ) || defined ( SYS_DARWIN )
/* BeOS only support UTF8 strings */
/* Mac OS X prefers UTF8 */
bind_textdomain_codeset( PACKAGE, "UTF-8" );
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment