summaryrefslogtreecommitdiff
path: root/sal/workben/getlocaleinfotest.cxx
diff options
context:
space:
mode:
authorOliver Braun <obr@openoffice.org>2001-09-11 11:49:16 +0000
committerOliver Braun <obr@openoffice.org>2001-09-11 11:49:16 +0000
commit50f0eea007c4ceaae4947fd49feb266707fe6797 (patch)
treebf19bf70b69b79b8432c79fbbcf7c83d01193924 /sal/workben/getlocaleinfotest.cxx
parentaf2938348bb539ccb27c92fe286b768d4143f662 (diff)
#88460# added osl_getProcessLocale and osl_setProcessLocale tests
Diffstat (limited to 'sal/workben/getlocaleinfotest.cxx')
-rw-r--r--sal/workben/getlocaleinfotest.cxx62
1 files changed, 55 insertions, 7 deletions
diff --git a/sal/workben/getlocaleinfotest.cxx b/sal/workben/getlocaleinfotest.cxx
index 9cba109c6a68..2b42d6d18a97 100644
--- a/sal/workben/getlocaleinfotest.cxx
+++ b/sal/workben/getlocaleinfotest.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: getlocaleinfotest.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: tra $ $Date: 2001-05-15 12:11:08 $
+ * last change: $Author: obr $ $Date: 2001-09-11 12:49:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,19 +61,67 @@
#include <rtl/locale.h>
#include <osl/nlsupport.h>
+#include <osl/process.h>
#include <rtl/ustring.hxx>
-int _cdecl main( int argc, char * argv[] )
+#include <stdio.h>
+
+#ifdef WNT
+#define _CDECL _cdecl
+#else
+#define _CDECL
+#endif
+
+int _CDECL main( int argc, char * argv[] )
{
- rtl::OUString lang = rtl::OUString::createFromAscii( "de" );
- rtl::OUString country = rtl::OUString::createFromAscii( "DE" );
+/*
+ rtl::OUString lang = rtl::OUString::createFromAscii( "zh" );
+ rtl::OUString country = rtl::OUString::createFromAscii( "TW" );
+*/
+ rtl::OUString lang = rtl::OUString::createFromAscii( argv[1] );
+ rtl::OUString country = rtl::OUString::createFromAscii( argv[2] );
rtl_TextEncoding rtlTextEnc;
+ rtl_Locale* rtlLocale = NULL;
+
+ osl_getProcessLocale( &rtlLocale );
+
+ if ( rtlLocale )
+ {
+ rtlTextEnc = osl_getTextEncodingFromLocale( rtlLocale );
+ printf( "default text encoding is %d.\n", rtlTextEnc );
+ }
+ else
+ fprintf( stderr, "osl_getProcessLocale did not return a locale !!\n" );
+
+ rtlLocale = rtl_locale_register( lang.getStr( ), country.getStr( ), NULL );
+
+ if ( rtlLocale )
+ {
+ rtlTextEnc = osl_getTextEncodingFromLocale( rtlLocale );
+ printf( "text encoding for %s_%s is %d.\n", argv[1], argv[2], rtlTextEnc );
+ }
+ else
+ fprintf( stderr, "rtl_locale_register did not return a locale !!\n" );
+
+ rtlTextEnc = osl_getTextEncodingFromLocale( NULL );
+ printf( "process text encoding is %d.\n", rtlTextEnc );
+
+ if( osl_setProcessLocale( rtlLocale ) )
+ fprintf( stderr, "osl_setProcessLocale failed !!\n" );
+
+
+ rtlTextEnc = osl_getTextEncodingFromLocale( NULL );
+ printf( "process text encoding is now: %d.\n", rtlTextEnc );
- rtl_Locale* rtlLocale =
- rtl_locale_register( lang.getStr( ), country.getStr( ), NULL );
+ osl_getProcessLocale( &rtlLocale );
if ( rtlLocale )
+ {
rtlTextEnc = osl_getTextEncodingFromLocale( rtlLocale );
+ printf( "text encoding for process locale is now: %d.\n", rtlTextEnc );
+ }
+ else
+ fprintf( stderr, "osl_getProcessLocale did not return a locale !!\n" );
return(0);
}