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