Commit 7520e171 authored by Olivier Teulière's avatar Olivier Teulière

Internationalization now works for the win32 interface (thanks Gildas).

I've voluntarily disabled the translation of the toolbar buttons
strings, because it looks really awful...
parent b901bcae
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * 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> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -657,7 +657,11 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) ); ...@@ -657,7 +657,11 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
#elif defined( ENABLE_NLS ) && defined( HAVE_INCLUDED_GETTEXT ) #elif defined( ENABLE_NLS ) && defined( HAVE_INCLUDED_GETTEXT )
# include "libintl.h" # include "libintl.h"
# undef _ # undef _
#if defined( __BORLANDC__ )
#define _(String) vlc_dgettext (PACKAGE_TARNAME, String)
#else
# define _(String) vlc_dgettext (PACKAGE, String) # define _(String) vlc_dgettext (PACKAGE, String)
#endif
# define N_(String) ((char*)(String)) # define N_(String) ((char*)(String))
#elif defined( ENABLE_NLS ) && defined( HAVE_GETTEXT ) #elif defined( ENABLE_NLS ) && defined( HAVE_GETTEXT )
# include <libintl.h> # include <libintl.h>
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*****************************************************************************/ *****************************************************************************/
#include <vcl.h> #include <vcl.h>
#include <comctrls.hpp>
#pragma hdrstop #pragma hdrstop
#include <vlc/vlc.h> #include <vlc/vlc.h>
...@@ -33,32 +34,47 @@ ...@@ -33,32 +34,47 @@
****************************************************************************/ ****************************************************************************/
void __fastcall Translate( TForm *Form ) void __fastcall Translate( TForm *Form )
{ {
#if 0 // We must test the string because we don't want to get the default one
if( Form->Hint != "" )
{
Form->Hint = _( Form->Hint.c_str() ); Form->Hint = _( Form->Hint.c_str() );
}
if( Form->Caption != "" )
{
Form->Caption = _( Form->Caption.c_str() ); Form->Caption = _( Form->Caption.c_str() );
}
int i; for( int i = 0; i < Form->ComponentCount; i++ )
for( i = 0; i < Form->ComponentCount; i++ )
{ {
// Does this component need a translation ? // Does this component need a translation ?
if( Form->Components[i]->Tag > 0 ) if( Form->Components[i]->Tag > 0 )
{ {
TComponent *Component = Form->Components[i]; TComponent *Component = Form->Components[i];
// Note: the Text property isn't translated, because we don't want
// to modify the content of TEdit or TComboBox objects, which
// may have default values
// Hint property // Hint property
if( Component->Tag & 1 ) if( Component->Tag & 1 )
{ {
if( Component->InheritsFrom( __classid( TControl ) ) ) if( Component->InheritsFrom( __classid( TControl ) ) )
{ {
TControl *Object = (TControl *) Component; TControl *Object = (TControl *) Component;
if( Object->Hint != "" )
{
Object->Hint = _( Object->Hint.c_str() ); Object->Hint = _( Object->Hint.c_str() );
} }
}
else if( Component->InheritsFrom( __classid( TMenuItem ) ) ) else if( Component->InheritsFrom( __classid( TMenuItem ) ) )
{ {
TMenuItem *Object = (TMenuItem *) Component; TMenuItem *Object = (TMenuItem *) Component;
if( Object->Hint != "" )
{
Object->Hint = _( Object->Hint.c_str() ); Object->Hint = _( Object->Hint.c_str() );
} }
} }
}
// Caption property // Caption property
if( Component->Tag & 2 ) if( Component->Tag & 2 )
...@@ -66,74 +82,83 @@ void __fastcall Translate( TForm *Form ) ...@@ -66,74 +82,83 @@ void __fastcall Translate( TForm *Form )
if( Component->InheritsFrom( __classid( TMenuItem ) ) ) if( Component->InheritsFrom( __classid( TMenuItem ) ) )
{ {
TMenuItem *Object = (TMenuItem *) Component; TMenuItem *Object = (TMenuItem *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() ); Object->Caption = _( Object->Caption.c_str() );
} }
}
else if( Component->InheritsFrom( __classid( TLabel ) ) ) else if( Component->InheritsFrom( __classid( TLabel ) ) )
{ {
TLabel *Object = (TLabel *) Component; TLabel *Object = (TLabel *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() ); Object->Caption = _( Object->Caption.c_str() );
} }
}
else if( Component->InheritsFrom( __classid( TButton ) ) ) else if( Component->InheritsFrom( __classid( TButton ) ) )
{ {
TButton *Object = (TButton *) Component; TButton *Object = (TButton *) Component;
Object->Caption = _( Object->Caption.c_str() ); if( Object->Caption != "" )
}
else if( Component->InheritsFrom( __classid( TToolButton ) ) )
{ {
TToolButton *Object = (TToolButton *) Component;
Object->Caption = _( Object->Caption.c_str() ); Object->Caption = _( Object->Caption.c_str() );
} }
}
else if( Component->InheritsFrom( __classid( TRadioButton ) ) ) else if( Component->InheritsFrom( __classid( TRadioButton ) ) )
{ {
TRadioButton *Object = (TRadioButton *) Component; TRadioButton *Object = (TRadioButton *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() ); Object->Caption = _( Object->Caption.c_str() );
} }
}
else if( Component->InheritsFrom( __classid( TCheckBox ) ) ) else if( Component->InheritsFrom( __classid( TCheckBox ) ) )
{ {
TCheckBox *Object = (TCheckBox *) Component; TCheckBox *Object = (TCheckBox *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() ); Object->Caption = _( Object->Caption.c_str() );
} }
}
else if( Component->InheritsFrom( __classid( TRadioGroup ) ) ) else if( Component->InheritsFrom( __classid( TRadioGroup ) ) )
{ {
TRadioGroup *Object = (TRadioGroup *) Component; TRadioGroup *Object = (TRadioGroup *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() ); Object->Caption = _( Object->Caption.c_str() );
} }
}
else if( Component->InheritsFrom( __classid( TGroupBox ) ) ) else if( Component->InheritsFrom( __classid( TGroupBox ) ) )
{ {
TGroupBox *Object = (TGroupBox *) Component; TGroupBox *Object = (TGroupBox *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() ); Object->Caption = _( Object->Caption.c_str() );
} }
else if( Component->InheritsFrom( __classid( TTabSheet ) ) ) }
#if 0
else if( Component->InheritsFrom( __classid( TToolButton ) ) )
{
TToolButton *Object = (TToolButton *) Component;
if( Object->Caption != "" )
{ {
TTabSheet *Object = (TTabSheet *) Component;
Object->Caption = _( Object->Caption.c_str() ); Object->Caption = _( Object->Caption.c_str() );
} }
}
#endif
else if( Component->InheritsFrom( __classid( TListView ) ) ) else if( Component->InheritsFrom( __classid( TListView ) ) )
{ {
TListView *Object = (TListView *) Component; TListView *ListView = (TListView *) Component;
int iCol; for( int iCol = 0; iCol < ListView->Columns->Count; iCol++ )
for( iCol = 0; iCol < Object->Columns->Count; iCol++ )
Object->Columns->Items[iCol]->Caption =
_( Object->Columns->Items[iCol]->Caption.c_str() );
}
}
// Text property
if( Component->Tag & 4 )
{ {
if( Component->InheritsFrom( __classid( TEdit ) ) ) TListColumn *Object = ListView->Columns->Items[iCol];
if( Object->Caption != "" )
{ {
TEdit *Object = (TEdit *) Component; Object->Caption = _( Object->Caption.c_str() );
Object->Text = _( Object->Text.c_str() ); }
} }
else if( Component->InheritsFrom( __classid( TComboBox ) ) )
{
TComboBox *Object = (TComboBox *) Component;
Object->Text = _( Object->Text.c_str() );
} }
} }
} }
} }
#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