1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: locale.h,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _RTL_LOCALE_H_
32 #define _RTL_LOCALE_H_
34 #include <rtl/ustring.h>
41 # pragma pack(push, 8)
42 #elif defined(SAL_OS2)
43 # pragma pack(push, 4)
47 The implementation structur of a locale. Do not create this structure
48 direct. Only use the functions rtl_locale_register and
49 rtl_locale_setDefault. The strings Language, Country and Variant
50 are constants, so it is not necessary to acquire and release them.
52 typedef struct _rtl_Locale
55 Lowercase two-letter ISO-639 code.
57 rtl_uString
* Language
;
59 uppercase two-letter ISO-3166 code.
61 rtl_uString
* Country
;
63 Lowercase vendor and browser specific code.
65 rtl_uString
* Variant
;
67 The merged hash value of the Language, Country and Variant strings.
72 #if defined( SAL_W32) || defined(SAL_OS2)
77 Register a locale from language, country and variant.
78 @param language lowercase two-letter ISO-639 code.
79 @param country uppercase two-letter ISO-3166 code. May be null.
80 @param variant vendor and browser specific code. May be null.
82 rtl_Locale
* SAL_CALL
rtl_locale_register( const sal_Unicode
* language
, const sal_Unicode
* country
, const sal_Unicode
* variant
);
85 Common method of getting the current default Locale.
86 Used for the presentation: menus, dialogs, etc.
87 Generally set once when your applet or application is initialized,
88 then never reset. (If you do reset the default locale, you
89 probably want to reload your GUI, so that the change is reflected
91 <p>More advanced programs will allow users to use different locales
92 for different fields, e.g. in a spreadsheet.
93 <BR>Note that the initial setting will match the host system.
95 rtl_Locale
* SAL_CALL
rtl_locale_getDefault();
99 Normally set once at the beginning of applet or application,
100 then never reset. <code>setDefault</code> does not reset the host locale.
101 @param language lowercase two-letter ISO-639 code.
102 @param country uppercase two-letter ISO-3166 code.
103 @param variant vendor and browser specific code. See class description.
105 void SAL_CALL
rtl_locale_setDefault( const sal_Unicode
* language
, const sal_Unicode
* country
, const sal_Unicode
* variant
);
108 Getter for programmatic name of field,
109 an lowercased two-letter ISO-639 code.
110 @see #getDisplayLanguage
112 rtl_uString
* SAL_CALL
rtl_locale_getLanguage( rtl_Locale
* This
);
115 Getter for programmatic name of field,
116 an uppercased two-letter ISO-3166 code.
117 @see #getDisplayCountry
119 rtl_uString
* SAL_CALL
rtl_locale_getCountry( rtl_Locale
* This
);
122 Getter for programmatic name of field.
123 @see #getDisplayVariant
125 rtl_uString
* SAL_CALL
rtl_locale_getVariant( rtl_Locale
* This
);
128 Returns the hash code of the locale This.
130 sal_Int32 SAL_CALL
rtl_locale_hashCode( rtl_Locale
* This
);
133 Returns true if the locals are equal, otherwis false.
135 sal_Int32 SAL_CALL
rtl_locale_equals( rtl_Locale
* This
, rtl_Locale
* obj
);
141 #endif /* _RTL_LOCALE_H_ */