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 @@
* 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>
......
......@@ -21,6 +21,7 @@
*****************************************************************************/
#include <vcl.h>
#include <comctrls.hpp>
#pragma hdrstop
#include <vlc/vlc.h>
......@@ -33,32 +34,47 @@
****************************************************************************/
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() );
}
if( Form->Caption != "" )
{
Form->Caption = _( Form->Caption.c_str() );
}
int i;
for( i = 0; i < Form->ComponentCount; i++ )
for( int i = 0; i < Form->ComponentCount; i++ )
{
// Does this component need a translation ?
if( Form->Components[i]->Tag > 0 )
{
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
if( Component->Tag & 1 )
{
if( Component->InheritsFrom( __classid( TControl ) ) )
{
TControl *Object = (TControl *) Component;
if( Object->Hint != "" )
{
Object->Hint = _( Object->Hint.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TMenuItem ) ) )
{
TMenuItem *Object = (TMenuItem *) Component;
if( Object->Hint != "" )
{
Object->Hint = _( Object->Hint.c_str() );
}
}
}
// Caption property
if( Component->Tag & 2 )
......@@ -66,74 +82,83 @@ void __fastcall Translate( TForm *Form )
if( Component->InheritsFrom( __classid( TMenuItem ) ) )
{
TMenuItem *Object = (TMenuItem *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TLabel ) ) )
{
TLabel *Object = (TLabel *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TButton ) ) )
{
TButton *Object = (TButton *) Component;
Object->Caption = _( Object->Caption.c_str() );
}
else if( Component->InheritsFrom( __classid( TToolButton ) ) )
if( Object->Caption != "" )
{
TToolButton *Object = (TToolButton *) Component;
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TRadioButton ) ) )
{
TRadioButton *Object = (TRadioButton *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TCheckBox ) ) )
{
TCheckBox *Object = (TCheckBox *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TRadioGroup ) ) )
{
TRadioGroup *Object = (TRadioGroup *) Component;
if( Object->Caption != "" )
{
Object->Caption = _( Object->Caption.c_str() );
}
}
else if( Component->InheritsFrom( __classid( TGroupBox ) ) )
{
TGroupBox *Object = (TGroupBox *) Component;
if( Object->Caption != "" )
{
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() );
}
}
#endif
else if( Component->InheritsFrom( __classid( TListView ) ) )
{
TListView *Object = (TListView *) Component;
int 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 )
TListView *ListView = (TListView *) Component;
for( int iCol = 0; iCol < ListView->Columns->Count; iCol++ )
{
if( Component->InheritsFrom( __classid( TEdit ) ) )
TListColumn *Object = ListView->Columns->Items[iCol];
if( Object->Caption != "" )
{
TEdit *Object = (TEdit *) Component;
Object->Text = _( Object->Text.c_str() );
Object->Caption = _( Object->Caption.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