]> git.sesse.net Git - vlc/commitdiff
* We now use UTF-8 internally under Mac OS X. This requires a libiconv-
authorChristophe Massiot <massiot@videolan.org>
Sun, 25 May 2003 17:27:13 +0000 (17:27 +0000)
committerChristophe Massiot <massiot@videolan.org>
Sun, 25 May 2003 17:27:13 +0000 (17:27 +0000)
enabled version of gettext. (patch courtesy of the DJ)

configure.ac.in
include/vlc_common.h
modules/gui/macosx/controls.m
modules/gui/macosx/info.m
modules/gui/macosx/intf.m
modules/gui/macosx/open.m
modules/gui/macosx/output.m
modules/gui/macosx/prefs.h
modules/gui/macosx/prefs.m
src/libvlc.c

index 8fee7b28918e4d4ef57f2d869d627303ee936e5d..72b4f4edd5b5b3c0ab1757cd498e91cc43092d04 100644 (file)
@@ -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}
     )
   ])
index 26359ed38809e602cb9ca39b1238b33c37a62782..bca6a853778144a00f17ce18e5340349f090cb03 100644 (file)
@@ -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))
index ec83c4a1ecac748aaf57e79b38d679db1e728aa3..6769346184ab00383f1686e2282f5a7aed8e6af4 100644 (file)
@@ -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>
     {
         config_PutPsz( p_intf, "filter", "deinterlace" );
        config_PutPsz( p_intf, "deinterlace-mode",
-                    [[sender title] lossyCString] );
+                    [[sender title] UTF8String] );
     }
     else
     {
 
         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];
             }
index 9bbe217ed89a754f63ac97c5a9b90e8a0c085dad..4393b5b4de053716b03682c2853b2442b55dee2a 100644 (file)
@@ -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>
  *
     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 */
index a07b1450ed0c664b08dd42f551da0306419a1e12..886959a9266064a96e78adca4c0486d3b47bd89f 100644 (file)
@@ -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]; 
     }
 
index 9194b30f473b3aaf88f649ecd8e466676ed949e5..d45581791b46fca5bbdcd4958290fa67c0386812 100644 (file)
@@ -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 ) );
index c118145f345424a19b3fe0a9cd2394a79728876c..c8e16a4050f5db4ecc02a2d15127a40771aaa57c 100644 (file)
@@ -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>
 - (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];
index e43ad244e17316331cc6f96a81dc9d5274cb2fd1..ef74ffbdb724d9833be035c739e672ee2e70a48f 100644 (file)
@@ -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]]; \
     }
 
index 44e966a86c28fdf789fa85f1d25fef2a062b1ee9..728617be5dbb4e02f0a5c67cecffe36e24219777 100644 (file)
@@ -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>
 
     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 )
     {
 
             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;
             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 );
         }
     }
     
     /* 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 );
index 6179907e9ed42287ac4eb2b419c735162ed2dca1..79c2c23cfc9b0e2307a99d89cc0d3a0ea6bebf7c 100644 (file)
@@ -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