Bug 199441 - nl_langinfo(ABMON_1) only returns number in Chinese locales
Summary: nl_langinfo(ABMON_1) only returns number in Chinese locales
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 10.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Xin LI
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-04-14 04:08 UTC by Ting-Wei Lan
Modified: 2016-09-02 00:28 UTC (History)
1 user (show)

See Also:
delphij: mfc-stable10+
delphij: mfc-stable9+


Attachments
Fix short month names and replace %b with %_m in date_fmt for Chinese locales (3.05 KB, patch)
2015-04-14 04:08 UTC, Ting-Wei Lan
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ting-Wei Lan 2015-04-14 04:08:57 UTC
Created attachment 155585 [details]
Fix short month names and replace %b with %_m in date_fmt for Chinese locales

When using a Chinese locale, such as zh_TW.UTF-8 or zh_CN.UTF-8, nl_langinfo(ABMON_*) only returns numbers. nl_langinfo(ABMON_1) returns 1, nl_langinfo(ABMON_2) returns 2, and so on.

This causes problems in applications that put the short month name and the day of the month together. For example, 'Apr 14' in English becomes '414日' in Chinese on the top bar of GNOME Shell.

This problem may be resolved by appending '月' to all short month names and replacing %b with %_m in date_fmt. ja_JP.UTF-8 already does this, but I have not done much testing to know whether it can cause other problems in Chinese locales. The GNU C Library also returns values with '月' appended.
Comment 1 commit-hook freebsd_committer freebsd_triage 2015-10-08 17:49:00 UTC
A commit references this bug:

Author: delphij
Date: Thu Oct  8 17:48:50 UTC 2015
New revision: 289041
URL: https://svnweb.freebsd.org/changeset/base/289041

Log:
  Fix short month names and replace %b with %_m in date_fmt for Chinese
  locales.

  When using a Chinese locale, such as zh_TW.UTF-8 or zh_CN.UTF-8,
  nl_langinfo(ABMON_*) only returned numbers.  For instance,
  nl_langinfo(ABMON_1) returns 1, nl_langinfo(ABMON_2) returns 2, and
  so on.

  This causes problems in applications that put the short month name
  and the day of the month together.  For example, 'Apr 14' in English
  becomes '414?' in Chinese on the top bar of GNOME Shell.

  This problem may be resolved by appending '?' to all short month
  names and replacing %b with %_m in date_fmt. ja_JP.UTF-8 already
  does this, and this matches the en_US.ISO8859-1 behavior, which
  returns 'Oct'.  The GNU C Library also returns values with '?'
  appended.

  PR:		199441
  Submitted by:	Ting-Wei Lan <lantw44 gmail com>
  MFC after:	2 weeks

Changes:
  head/share/timedef/zh_CN.GB18030.src
  head/share/timedef/zh_CN.GB2312.src
  head/share/timedef/zh_CN.UTF-8.src
  head/share/timedef/zh_CN.eucCN.src
  head/share/timedef/zh_TW.Big5.src
  head/share/timedef/zh_TW.UTF-8.src
Comment 2 Xin LI freebsd_committer freebsd_triage 2015-10-08 17:50:21 UTC
Committed, thanks!
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-10-29 17:01:08 UTC
A commit references this bug:

Author: delphij
Date: Thu Oct 29 17:00:52 UTC 2015
New revision: 290150
URL: https://svnweb.freebsd.org/changeset/base/290150

Log:
  MFC r289038,r289041:

  Add encoding for mime-types.

  Fix short month names and replace %b with %_m in date_fmt for Chinese
  locales.

  When using a Chinese locale, such as zh_TW.UTF-8 or zh_CN.UTF-8,
  nl_langinfo(ABMON_*) only returned numbers.  For instance,
  nl_langinfo(ABMON_1) returns 1, nl_langinfo(ABMON_2) returns 2, and
  so on.

  This causes problems in applications that put the short month name
  and the day of the month together.  For example, 'Apr 14' in English
  becomes '414?' in Chinese on the top bar of GNOME Shell.

  This problem may be resolved by appending '?' to all short month
  names and replacing %b with %_m in date_fmt. ja_JP.UTF-8 already
  does this, and this matches the en_US.ISO8859-1 behavior, which
  returns 'Oct'.  The GNU C Library also returns values with '?'
  appended.

  PR:		199441
  Submitted by:	Ting-Wei Lan <lantw44 gmail com>

Changes:
_U  stable/10/
  stable/10/share/timedef/zh_CN.GB18030.src
  stable/10/share/timedef/zh_CN.GB2312.src
  stable/10/share/timedef/zh_CN.UTF-8.src
  stable/10/share/timedef/zh_CN.eucCN.src
  stable/10/share/timedef/zh_TW.Big5.src
  stable/10/share/timedef/zh_TW.UTF-8.src
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-10-29 17:05:10 UTC
A commit references this bug:

Author: delphij
Date: Thu Oct 29 17:04:44 UTC 2015
New revision: 290151
URL: https://svnweb.freebsd.org/changeset/base/290151

Log:
  MFC r289038,r289041:

  Add encoding for mime-types.

  Fix short month names and replace %b with %_m in date_fmt for Chinese
  locales.

  When using a Chinese locale, such as zh_TW.UTF-8 or zh_CN.UTF-8,
  nl_langinfo(ABMON_*) only returned numbers.  For instance,
  nl_langinfo(ABMON_1) returns 1, nl_langinfo(ABMON_2) returns 2, and
  so on.

  This causes problems in applications that put the short month name
  and the day of the month together.  For example, 'Apr 14' in English
  becomes '414?' in Chinese on the top bar of GNOME Shell.

  This problem may be resolved by appending '?' to all short month
  names and replacing %b with %_m in date_fmt. ja_JP.UTF-8 already
  does this, and this matches the en_US.ISO8859-1 behavior, which
  returns 'Oct'.  The GNU C Library also returns values with '?'
  appended.

  PR:		199441
  Submitted by:	Ting-Wei Lan <lantw44 gmail com>

Changes:
_U  stable/9/share/timedef/
  stable/9/share/timedef/zh_CN.GB18030.src
  stable/9/share/timedef/zh_CN.GB2312.src
  stable/9/share/timedef/zh_CN.UTF-8.src
  stable/9/share/timedef/zh_CN.eucCN.src
  stable/9/share/timedef/zh_TW.Big5.src
  stable/9/share/timedef/zh_TW.UTF-8.src
Comment 5 Xin LI freebsd_committer freebsd_triage 2015-10-29 18:08:03 UTC
This change have been merged to all supported -STABLE branches, thanks for your submission!
Comment 6 commit-hook freebsd_committer freebsd_triage 2016-09-02 00:28:18 UTC
A commit references this bug:

Author: kevlo
Date: Fri Sep  2 00:27:27 UTC 2016
New revision: 305264
URL: https://svnweb.freebsd.org/changeset/base/305264

Log:
  Replace %m with %_m in date_fmt for Chinese locales.
  This is a fix for the problem mentioned in the PR.

  PR:	199441

Changes:
  head/tools/tools/locale/tools/cldr2def.pl