1514f4c20SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3514f4c20SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4514f4c20SAndrew Rist * or more contributor license agreements. See the NOTICE file 5514f4c20SAndrew Rist * distributed with this work for additional information 6514f4c20SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7514f4c20SAndrew Rist * to you under the Apache License, Version 2.0 (the 8514f4c20SAndrew Rist * "License"); you may not use this file except in compliance 9514f4c20SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11514f4c20SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13514f4c20SAndrew Rist * Unless required by applicable law or agreed to in writing, 14514f4c20SAndrew Rist * software distributed under the License is distributed on an 15514f4c20SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16514f4c20SAndrew Rist * KIND, either express or implied. See the License for the 17514f4c20SAndrew Rist * specific language governing permissions and limitations 18514f4c20SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20514f4c20SAndrew Rist *************************************************************/ 21514f4c20SAndrew Rist 22cdf0e10cSrcweir #ifndef _RTL_LOCALE_H_ 23cdf0e10cSrcweir #define _RTL_LOCALE_H_ 24cdf0e10cSrcweir 25cdf0e10cSrcweir #include <rtl/ustring.h> 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifdef __cplusplus 28cdf0e10cSrcweir extern "C" { 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir #ifdef SAL_W32 32cdf0e10cSrcweir # pragma pack(push, 8) 33cdf0e10cSrcweir #elif defined(SAL_OS2) 34cdf0e10cSrcweir # pragma pack(push, 4) 35cdf0e10cSrcweir #endif 36cdf0e10cSrcweir 37cdf0e10cSrcweir /** 38*01cec6d6Smseidel The implementation structure of a locale. Do not create this structure 39cdf0e10cSrcweir direct. Only use the functions rtl_locale_register and 40cdf0e10cSrcweir rtl_locale_setDefault. The strings Language, Country and Variant 41cdf0e10cSrcweir are constants, so it is not necessary to acquire and release them. 42cdf0e10cSrcweir */ 43cdf0e10cSrcweir typedef struct _rtl_Locale 44cdf0e10cSrcweir { 45cdf0e10cSrcweir /** 46cdf0e10cSrcweir Lowercase two-letter ISO 639-1 or three-letter ISO 639-3 code. 47cdf0e10cSrcweir */ 48cdf0e10cSrcweir rtl_uString * Language; 49cdf0e10cSrcweir /** 50cdf0e10cSrcweir uppercase two-letter ISO-3166 code. 51cdf0e10cSrcweir */ 52cdf0e10cSrcweir rtl_uString * Country; 53cdf0e10cSrcweir /** 54cdf0e10cSrcweir Lowercase vendor and browser specific code. 55cdf0e10cSrcweir */ 56cdf0e10cSrcweir rtl_uString * Variant; 57cdf0e10cSrcweir /** 58cdf0e10cSrcweir The merged hash value of the Language, Country and Variant strings. 59cdf0e10cSrcweir */ 60cdf0e10cSrcweir sal_Int32 HashCode; 61cdf0e10cSrcweir } rtl_Locale; 62cdf0e10cSrcweir 63cdf0e10cSrcweir #if defined( SAL_W32) || defined(SAL_OS2) 64cdf0e10cSrcweir #pragma pack(pop) 65cdf0e10cSrcweir #endif 66cdf0e10cSrcweir 67cdf0e10cSrcweir /** 68cdf0e10cSrcweir Register a locale from language, country and variant. 69cdf0e10cSrcweir @param language lowercase two-letter ISO 639-1 or three-letter ISO 639-3 code. 70cdf0e10cSrcweir @param country uppercase two-letter ISO-3166 code. May be null. 71cdf0e10cSrcweir @param variant vendor and browser specific code. May be null. 72cdf0e10cSrcweir */ 73cdf0e10cSrcweir rtl_Locale * SAL_CALL rtl_locale_register( const sal_Unicode * language, const sal_Unicode * country, const sal_Unicode * variant ); 74cdf0e10cSrcweir 75cdf0e10cSrcweir /** 76cdf0e10cSrcweir Common method of getting the current default Locale. 77cdf0e10cSrcweir Used for the presentation: menus, dialogs, etc. 78cdf0e10cSrcweir Generally set once when your applet or application is initialized, 79cdf0e10cSrcweir then never reset. (If you do reset the default locale, you 80cdf0e10cSrcweir probably want to reload your GUI, so that the change is reflected 81cdf0e10cSrcweir in your interface.) 82cdf0e10cSrcweir <p>More advanced programs will allow users to use different locales 83cdf0e10cSrcweir for different fields, e.g. in a spreadsheet. 84cdf0e10cSrcweir <BR>Note that the initial setting will match the host system. 85cdf0e10cSrcweir */ 86cdf0e10cSrcweir rtl_Locale * SAL_CALL rtl_locale_getDefault(); 87cdf0e10cSrcweir 88cdf0e10cSrcweir /** 89cdf0e10cSrcweir Sets the default. 90cdf0e10cSrcweir Normally set once at the beginning of applet or application, 91cdf0e10cSrcweir then never reset. <code>setDefault</code> does not reset the host locale. 92cdf0e10cSrcweir @param language lowercase two-letter ISO 639-1 or three-letter ISO 639-3 code. 93cdf0e10cSrcweir @param country uppercase two-letter ISO-3166 code. 94cdf0e10cSrcweir @param variant vendor and browser specific code. See class description. 95cdf0e10cSrcweir */ 96cdf0e10cSrcweir void SAL_CALL rtl_locale_setDefault( const sal_Unicode * language, const sal_Unicode * country, const sal_Unicode * variant ); 97cdf0e10cSrcweir 98cdf0e10cSrcweir /** 99cdf0e10cSrcweir Getter for programmatic name of field, 100cdf0e10cSrcweir a lowercased two-letter ISO 639-1 or three-letter ISO 639-3 code. 101cdf0e10cSrcweir @see #getDisplayLanguage 102cdf0e10cSrcweir */ 103cdf0e10cSrcweir rtl_uString * SAL_CALL rtl_locale_getLanguage( rtl_Locale * This ); 104cdf0e10cSrcweir 105cdf0e10cSrcweir /** 106cdf0e10cSrcweir Getter for programmatic name of field, 107cdf0e10cSrcweir an uppercased two-letter ISO-3166 code. 108cdf0e10cSrcweir @see #getDisplayCountry 109cdf0e10cSrcweir */ 110cdf0e10cSrcweir rtl_uString * SAL_CALL rtl_locale_getCountry( rtl_Locale * This ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir /** 113cdf0e10cSrcweir Getter for programmatic name of field. 114cdf0e10cSrcweir @see #getDisplayVariant 115cdf0e10cSrcweir */ 116cdf0e10cSrcweir rtl_uString * SAL_CALL rtl_locale_getVariant( rtl_Locale * This ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir /** 119cdf0e10cSrcweir Returns the hash code of the locale This. 120cdf0e10cSrcweir */ 121cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_locale_hashCode( rtl_Locale * This ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir /** 124*01cec6d6Smseidel Returns true if the locals are equal, otherwise false. 125cdf0e10cSrcweir */ 126cdf0e10cSrcweir sal_Int32 SAL_CALL rtl_locale_equals( rtl_Locale * This, rtl_Locale * obj ); 127cdf0e10cSrcweir 128cdf0e10cSrcweir #ifdef __cplusplus 129cdf0e10cSrcweir } 130cdf0e10cSrcweir #endif 131cdf0e10cSrcweir 132cdf0e10cSrcweir #endif /* _RTL_LOCALE_H_ */ 133