Skip to content

Commit

Permalink
fixing #501
Browse files Browse the repository at this point in the history
  • Loading branch information
gagolews committed Nov 18, 2023
1 parent f1e8feb commit 2eadee9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/icu74/i18n/windtfmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ UnicodeString* Win32DateFormat::getTimeDateFormat(const Calendar *cal, const Loc
}


#if !defined(STRI_DISABLE_RESOLVE_LOCALE_NAME) || STRI_DISABLE_RESOLVE_LOCALE_NAME == 0
#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
// TODO: This is copied in both winnmfmt.cpp and windtfmt.cpp, but really should
// be factored out into a common helper for both.
static UErrorCode GetEquivalentWindowsLocaleName(const Locale& locale, UnicodeString** buffer)
Expand Down Expand Up @@ -174,7 +174,7 @@ Win32DateFormat::Win32DateFormat(DateFormat::EStyle timeStyle, DateFormat::EStyl
: DateFormat(), fDateTimeMsg(nullptr), fTimeStyle(timeStyle), fDateStyle(dateStyle), fLocale(locale), fZoneID(), fWindowsLocaleName(nullptr)
{
if (U_SUCCESS(status)) {
#if !defined(STRI_DISABLE_RESOLVE_LOCALE_NAME) || STRI_DISABLE_RESOLVE_LOCALE_NAME == 0
#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
GetEquivalentWindowsLocaleName(locale, &fWindowsLocaleName);
#endif
// Note: In the previous code, it would look up the LCID for the locale, and if
Expand Down
6 changes: 4 additions & 2 deletions src/icu74/i18n/winnmfmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static void freeCurrencyFormat(CURRENCYFMTW *fmt)
}


#if !defined(STRI_DISABLE_RESOLVE_LOCALE_NAME) || STRI_DISABLE_RESOLVE_LOCALE_NAME == 0
#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
// TODO: This is copied in both winnmfmt.cpp and windtfmt.cpp, but really should
// be factored out into a common helper for both.
static UErrorCode GetEquivalentWindowsLocaleName(const Locale& locale, UnicodeString** buffer)
Expand Down Expand Up @@ -219,9 +219,11 @@ Win32NumberFormat::Win32NumberFormat(const Locale &locale, UBool currency, UErro
{
if (!U_FAILURE(status)) {
fLCID = locale.getLCID();
#if !defined(STRI_DISABLE_RESOLVE_LOCALE_NAME) || STRI_DISABLE_RESOLVE_LOCALE_NAME == 0

#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
GetEquivalentWindowsLocaleName(locale, &fWindowsLocaleName);
#endif

// Note: In the previous code, it would look up the LCID for the locale, and if
// the locale was not recognized then it would get an LCID of 0, which is a
// synonym for LOCALE_USER_DEFAULT on Windows.
Expand Down
4 changes: 4 additions & 0 deletions src/uconfig_local.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
// used on Windows only, some do not have it
#define STRI_DISABLE_RESOLVE_LOCALE_NAME @DISABLE_RESOLVE_LOCALE_NAME@

#if U_PLATFORM_HAS_WIN32_API && STRI_DISABLE_RESOLVE_LOCALE_NAME
#define UCONFIG_USE_WINDOWS_LCID_MAPPING_API 0
#endif

/* This caused a serious bug on Solaris, see #94:
// #define U_DISABLE_RENAMING 1
// do not turn on!
Expand Down

0 comments on commit 2eadee9

Please sign in to comment.