Index: unx/source/app/i18n_im.cxx =================================================================== RCS file: /cvs/gsl/vcl/unx/source/app/i18n_im.cxx,v retrieving revision 1.16.2.1 diff -u -r1.16.2.1 i18n_im.cxx --- unx/source/app/i18n_im.cxx 22 Apr 2002 16:34:58 -0000 1.16.2.1 +++ unx/source/app/i18n_im.cxx 21 Nov 2002 03:45:36 -0000 @@ -82,6 +82,11 @@ #include #endif +#ifdef MACOSX +#include +#include +#endif + using namespace vcl; #ifndef _SAL_I18N_CALLBACK_HXX @@ -221,6 +226,36 @@ SetSystemLocale( const char* p_inlocale ) { char *p_outlocale; + +#ifdef MACOSX + // If p_inlocale is NULL, use current locale from libsal since + // setlocale() always returns NULL when you pass NULL on Mac OS X + if ( p_inlocale == NULL || *p_inlocale == NULL ) + { + rtl_Locale* pLocale = NULL; + osl_getProcessLocale( &pLocale ); + if ( pLocale ) + { + ByteString aLocaleString( String( pLocale->Language ), RTL_TEXTENCODING_ASCII_US ); + ByteString aCountry( String( pLocale->Country ), RTL_TEXTENCODING_ASCII_US ); + ByteString aVariant( String( pLocale->Variant ), RTL_TEXTENCODING_ASCII_US ); + + if( aCountry.Len() ) + { + aLocaleString += "_"; + aLocaleString += aCountry; + } + if( aVariant.Len() ) + { + aLocaleString += "."; + aLocaleString += aVariant; + } + + p_inlocale = aLocaleString.GetBuffer(); + } + } +#endif + if ( (p_outlocale = setlocale(LC_ALL, p_inlocale)) == NULL ) { fprintf( stderr,