diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-02-20 22:10:26 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-02-20 22:10:26 +0000 |
commit | 5d76584680963d0b4808850eed6205d9df50c39b (patch) | |
tree | 995cc6f00055840559d75a9658326465f79360c5 /winsup/cygwin/nlsfuncs.cc | |
parent | 53a918f3d63b67532dde8287ce653ca84b28f65c (diff) | |
download | cygnal-5d76584680963d0b4808850eed6205d9df50c39b.tar.gz cygnal-5d76584680963d0b4808850eed6205d9df50c39b.tar.bz2 cygnal-5d76584680963d0b4808850eed6205d9df50c39b.zip |
* lc_era.h (lc_era): Fix "ja_JP" era_t_fmt entry to use traditional
format.
* nlsfuncs.cc (dt_flags): Remove DT_ERACAL since crippled era data
in Windows makes it useless.
(__eval_datetimefmt): Check if locale's default calender has
non-gregorian start year. Use era year also in default date entries,
if so.
Diffstat (limited to 'winsup/cygwin/nlsfuncs.cc')
-rw-r--r-- | winsup/cygwin/nlsfuncs.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc index c31632a76..93c2c34b0 100644 --- a/winsup/cygwin/nlsfuncs.cc +++ b/winsup/cygwin/nlsfuncs.cc @@ -351,9 +351,6 @@ enum dt_flags { DT_DEFAULT = 0x00, DT_AMPM = 0x01, /* Enforce 12 hour time format. */ DT_ABBREV = 0x02, /* Enforce abbreviated month and day names. */ - DT_ERACAL = 0x04, /* Retrieve era information (ignored otherwise). - Also switch to optional calendar with era - information, if necessary. */ }; static char * @@ -363,6 +360,7 @@ __eval_datetimefmt (LCID lcid, LCTYPE type, dt_flags flags, char **ptr, wchar_t buf[80]; wchar_t fc; size_t num; + DWORD cal; mbstate_t mb; size_t idx; const char *day_str = "edaA"; @@ -402,6 +400,17 @@ __eval_datetimefmt (LCID lcid, LCTYPE type, dt_flags flags, char **ptr, if ((flags & DT_ABBREV) && fc != L'y' && idx == 3) idx = 2; *p++ = '%'; + /* Check for default calender with offset to gregorian calendar. + If so, make era representation the default. */ + if (fc == L'y' + && GetLocaleInfoW (lcid, LOCALE_ICALENDARTYPE + | LOCALE_RETURN_NUMBER, + (PWCHAR) &cal, sizeof cal / sizeof (WCHAR)) + && cal > CAL_GREGORIAN_US) + { + *p++ = 'E'; + idx = 2; + } *p++ = t_str[idx]; break; case L'g': |