| OLD | NEW |
| (Empty) |
| 1 // Copyright 2004-2009 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 // | |
| 16 // | |
| 17 // localization.h | |
| 18 // | |
| 19 // Localization functions for date-time, strings, locales, and numbers | |
| 20 | |
| 21 #ifndef OMAHA_BASE_LOCALIZATION_H_ | |
| 22 #define OMAHA_BASE_LOCALIZATION_H_ | |
| 23 | |
| 24 #include <atlstr.h> | |
| 25 #include "base/basictypes.h" | |
| 26 #include "omaha/base/time.h" | |
| 27 | |
| 28 namespace omaha { | |
| 29 | |
| 30 // Allows us to override LCIDs for unittests | |
| 31 void SetLcidOverride(const LCID & lcid_new); | |
| 32 | |
| 33 | |
| 34 // | |
| 35 // Date-time Functions | |
| 36 // | |
| 37 | |
| 38 // Show the time in the specified locale's default format. | |
| 39 // If you want to use the user's default format, use LOCALE_USER_DEFAULT | |
| 40 // for the locale [eg - "5:15:34 pm" is the US default] | |
| 41 CString ShowDateForLocale(const time64 & t, const LCID & lcid); | |
| 42 | |
| 43 // Show the time in the specified format for the specified locale. | |
| 44 // If you want to use the user's default format, use LOCALE_USER_DEFAULT | |
| 45 // for the locale [eg - "5:15:34 pm" is the US default] | |
| 46 CString ShowFormattedDateForLocale(const time64 & t, const LCID & lcid, | |
| 47 const TCHAR * format); | |
| 48 | |
| 49 | |
| 50 // Show the time in the specified locale's default format. | |
| 51 // If you want to use the user's default format, use LOCALE_USER_DEFAULT | |
| 52 // for the locale [eg - "5:15:34 pm" is the US default] | |
| 53 CString ShowTimeForLocale(const time64 & t, const LCID & lcid); | |
| 54 | |
| 55 // Show the time in the specified format for the specified locale. | |
| 56 // If you want to use the user's default format, use LOCALE_USER_DEFAULT | |
| 57 // for the locale [eg - "5:15:34 pm" is the US default] | |
| 58 CString ShowFormattedTimeForLocale(const time64 & t, const LCID & lcid, | |
| 59 const TCHAR * format); | |
| 60 | |
| 61 // Show the long date and time [ie - Tuesday, March 20, 2004 5:15pm] | |
| 62 CString ShowDateTimeForLocale(const time64 & t, const LCID & lcid); | |
| 63 | |
| 64 // Get the long data and time in a (US English) format for logging | |
| 65 CString ShowDateTimeForLogging(const time64 & t); | |
| 66 | |
| 67 // | |
| 68 // Number Functions | |
| 69 // | |
| 70 | |
| 71 // Changes the number into a user viewable format for the current locale | |
| 72 CString Show(const int i); | |
| 73 CString Show(const uint32 u); | |
| 74 CString Show(const double & d, const int decimal_places); | |
| 75 | |
| 76 | |
| 77 // | |
| 78 // Locale Name / LCID / RFC 1766 conversions | |
| 79 // | |
| 80 HRESULT SetLocaleToRfc1766(const TCHAR * rfc1766_locale); | |
| 81 HRESULT SetLocaleToLCID(const LCID & lcid); | |
| 82 | |
| 83 HRESULT GetLocaleAsLCID(LCID * lcid); | |
| 84 HRESULT GetLocaleAsRfc1766(CString * rfc1766_locale); | |
| 85 | |
| 86 HRESULT GetNumberFormatForLCID(const LCID & lcid, NUMBERFMT * fmt, | |
| 87 TCHAR * fmt_decimal_buf, | |
| 88 size_t decimal_buf_len, | |
| 89 TCHAR * fmt_thousand_buf, | |
| 90 size_t thousand_buf_len); | |
| 91 | |
| 92 } // namespace omaha | |
| 93 | |
| 94 #endif // OMAHA_BASE_LOCALIZATION_H_ | |
| OLD | NEW |