]> git.sesse.net Git - vlc/commitdiff
Internationalization now works for the win32 interface (thanks Gildas).
authorOlivier Teulière <ipkiss@videolan.org>
Fri, 28 Feb 2003 04:31:24 +0000 (04:31 +0000)
committerOlivier Teulière <ipkiss@videolan.org>
Fri, 28 Feb 2003 04:31:24 +0000 (04:31 +0000)
I've voluntarily disabled the translation of the toolbar buttons
strings, because it looks really awful...

include/vlc_common.h
modules/gui/win32/misc.cpp

index edf0830b1cc86c9e47631951d6264defb81e047e..2326b9f347d31b06120097602f82254f5b97843d 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.54 2003/02/16 14:10:44 fenrir Exp $
+ * $Id: vlc_common.h,v 1.55 2003/02/28 04:31:24 ipkiss Exp $
  *
  * Authors: Samuel Hocevar <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -657,7 +657,11 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
 #elif defined( ENABLE_NLS ) && defined( HAVE_INCLUDED_GETTEXT )
 #   include "libintl.h"
 #   undef _
+#if defined( __BORLANDC__ )
+#define _(String) vlc_dgettext (PACKAGE_TARNAME, String)
+#else
 #   define _(String) vlc_dgettext (PACKAGE, String)
+#endif
 #   define N_(String) ((char*)(String))
 #elif defined( ENABLE_NLS ) && defined( HAVE_GETTEXT )
 #   include <libintl.h>
index 13367a058842ad73a8c2082ed4c89dd8f27ab2af..00cd7b6feced4856a3dcd28f05978f029a3100e6 100644 (file)
@@ -21,6 +21,7 @@
  *****************************************************************************/\r
 \r
 #include <vcl.h>\r
+#include <comctrls.hpp>\r
 #pragma hdrstop\r
 \r
 #include <vlc/vlc.h>\r
  ****************************************************************************/\r
 void __fastcall Translate( TForm *Form )\r
 {\r
-#if 0\r
-    Form->Hint = _( Form->Hint.c_str() );\r
-    Form->Caption = _( Form->Caption.c_str() );\r
+    // We must test the string because we don't want to get the default one\r
+    if( Form->Hint != "" )\r
+    {\r
+        Form->Hint = _( Form->Hint.c_str() );\r
+    }\r
+    if( Form->Caption != "" )\r
+    {\r
+        Form->Caption = _( Form->Caption.c_str() );\r
+    }\r
 \r
-    int i;\r
-    for( i = 0; i < Form->ComponentCount; i++ )\r
+    for( int i = 0; i < Form->ComponentCount; i++ )\r
     {\r
         // Does this component need a translation ?\r
         if( Form->Components[i]->Tag > 0 )\r
         {\r
             TComponent *Component = Form->Components[i];\r
 \r
+            // Note: the Text property isn't translated, because we don't want\r
+            // to modify the content of TEdit or TComboBox objects, which\r
+            // may have default values\r
+\r
             // Hint property\r
             if( Component->Tag & 1 )\r
             {\r
                 if( Component->InheritsFrom( __classid( TControl ) ) )\r
                 {\r
                     TControl *Object = (TControl *) Component;\r
-                    Object->Hint = _( Object->Hint.c_str() );\r
+                    if( Object->Hint != "" )\r
+                    {\r
+                        Object->Hint = _( Object->Hint.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TMenuItem ) ) )\r
                 {\r
                     TMenuItem *Object = (TMenuItem *) Component;\r
-                    Object->Hint = _( Object->Hint.c_str() );\r
+                    if( Object->Hint != "" )\r
+                    {\r
+                        Object->Hint = _( Object->Hint.c_str() );\r
+                    }\r
                 }\r
             }\r
 \r
@@ -66,74 +82,83 @@ void __fastcall Translate( TForm *Form )
                 if( Component->InheritsFrom( __classid( TMenuItem ) ) )\r
                 {\r
                     TMenuItem *Object = (TMenuItem *) Component;\r
-                    Object->Caption = _( Object->Caption.c_str() );\r
-                }\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
+               }\r
                 else if( Component->InheritsFrom( __classid( TLabel ) ) )\r
                 {\r
                     TLabel *Object = (TLabel *) Component;\r
-                    Object->Caption = _( Object->Caption.c_str() );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TButton ) ) )\r
                 {\r
                     TButton *Object = (TButton *) Component;\r
-                    Object->Caption = _( Object->Caption.c_str() );\r
-                }\r
-                else if( Component->InheritsFrom( __classid( TToolButton ) ) )\r
-                {\r
-                    TToolButton *Object = (TToolButton *) Component;\r
-                    Object->Caption = _( Object->Caption.c_str() );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TRadioButton ) ) )\r
                 {\r
                     TRadioButton *Object = (TRadioButton *) Component;\r
-                    Object->Caption = _( Object->Caption.c_str() );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TCheckBox ) ) )\r
                 {\r
                     TCheckBox *Object = (TCheckBox *) Component;\r
-                    Object->Caption = _( Object->Caption.c_str() );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TRadioGroup ) ) )\r
                 {\r
                     TRadioGroup *Object = (TRadioGroup *) Component;\r
-                    Object->Caption = _( Object->Caption.c_str() );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TGroupBox ) ) )\r
                 {\r
                     TGroupBox *Object = (TGroupBox *) Component;\r
-                    Object->Caption = _( Object->Caption.c_str() );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
-                else if( Component->InheritsFrom( __classid( TTabSheet ) ) )\r
+#if 0\r
+                else if( Component->InheritsFrom( __classid( TToolButton ) ) )\r
                 {\r
-                    TTabSheet *Object = (TTabSheet *) Component;\r
-                    Object->Caption = _( Object->Caption.c_str() );\r
+                    TToolButton *Object = (TToolButton *) Component;\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
+#endif\r
                 else if( Component->InheritsFrom( __classid( TListView ) ) )\r
                 {\r
-                    TListView *Object = (TListView *) Component;\r
-                    int iCol;\r
-                    for( iCol = 0; iCol < Object->Columns->Count; iCol++ )\r
-                        Object->Columns->Items[iCol]->Caption =\r
-                                 _( Object->Columns->Items[iCol]->Caption.c_str() );\r
-                }\r
-            }\r
-\r
-            // Text property\r
-            if( Component->Tag & 4 )\r
-            {\r
-                if( Component->InheritsFrom( __classid( TEdit ) ) )\r
-                {\r
-                    TEdit *Object = (TEdit *) Component;\r
-                    Object->Text = _( Object->Text.c_str() );\r
-                }\r
-                else if( Component->InheritsFrom( __classid( TComboBox ) ) )\r
-                {\r
-                    TComboBox *Object = (TComboBox *) Component;\r
-                    Object->Text = _( Object->Text.c_str() );\r
+                    TListView *ListView = (TListView *) Component;\r
+                    for( int iCol = 0; iCol < ListView->Columns->Count; iCol++ )\r
+                    {\r
+                        TListColumn *Object = ListView->Columns->Items[iCol];\r
+                        if( Object->Caption != "" )\r
+                        {\r
+                            Object->Caption = _( Object->Caption.c_str() );\r
+                        }\r
+                    }\r
                 }\r
             }\r
         }\r
     }\r
-#endif\r
 }\r
  \r