如何通过 api 获取扩展的语言环境信息
How to get extended locale information by api
我想获取有关当前语言环境的信息。
我能找到的唯一接口是:
locale.h: extern struct lconv *localeconv (void);
但 struct lconv
仅包含数字和财务区域设置信息。我还想获取 strftime 使用的时间相关信息。特别是日期名称和日期格式。
追踪 locale abday
我找到了 "/usr/lib/locale/locale-archive"
但我找不到关于它的格式的任何信息。
使用nl_langinfo(3)
. From the glibc docs:
7.7 Accessing Locale Information
… To do this the C
library provides two functions: localeconv and nl_langinfo. The former
is part of ISO C and therefore portable, but has a brain-damaged
interface. The second is part of the Unix interface and is portable in
as far as the system follows the Unix standards.
• The Lame Way to Locale Data: ISO C’s localeconv.
• The Elegant and Fast Way: X/Open’s nl_langinfo.
我想获取有关当前语言环境的信息。 我能找到的唯一接口是:
locale.h: extern struct lconv *localeconv (void);
但 struct lconv
仅包含数字和财务区域设置信息。我还想获取 strftime 使用的时间相关信息。特别是日期名称和日期格式。
追踪 locale abday
我找到了 "/usr/lib/locale/locale-archive"
但我找不到关于它的格式的任何信息。
使用nl_langinfo(3)
. From the glibc docs:
7.7 Accessing Locale Information
… To do this the C library provides two functions: localeconv and nl_langinfo. The former is part of ISO C and therefore portable, but has a brain-damaged interface. The second is part of the Unix interface and is portable in as far as the system follows the Unix standards.
• The Lame Way to Locale Data: ISO C’s localeconv.
• The Elegant and Fast Way: X/Open’s nl_langinfo.