Bug 247553 - setlocale(3) ought to explain how the locale string is interpreted
Summary: setlocale(3) ought to explain how the locale string is interpreted
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Joerg Wunsch
Depends on:
Reported: 2020-06-26 05:37 UTC by Joerg Wunsch
Modified: 2020-07-17 22:08 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Joerg Wunsch freebsd_committer 2020-06-26 05:37:23 UTC
According to


the interpretation of the locale string is implementation-defined.

Thus, setlocale(3) ought to explain how the string is interpreted. By now, it only mentions predefined locales.

While at it, it also lacks the xref to locale(1).
Comment 1 Conrad Meyer freebsd_committer 2020-06-26 23:22:30 UTC
The page documents:

     Only three locales are defined by default, the empty string "" which
     denotes the native environment, and the "C" and "POSIX" locales, which
     denote the C language environment.  A locale argument of NULL causes
     setlocale() to return the current locale.  By default, C programs start
     in the "C" locale.

It also points to:

     /usr/share/locale/locale/category  locale file for the locale locale and
                                        the category category.

Which can be used to discover the installed locales for a given category:

     $ ls /usr/share/locale/*/LC_CTYPE | wc -l
Comment 2 Joerg Wunsch freebsd_committer 2020-06-27 19:38:12 UTC
This is certainly a method to actually find out the possible names - but I wouldn't call that a "documentation".
Comment 3 commit-hook freebsd_committer 2020-06-27 20:56:13 UTC
A commit references this bug:

Author: joerg
Date: Sat Jun 27 20:55:48 UTC 2020
New revision: 362708
URL: https://svnweb.freebsd.org/changeset/base/362708

  Explain how to learn about possible recognized locale names

  Posix says that the interpretation of the locale string is
  "implementation-defined", so we ought to document what is
  actually recognized.

  Also add a cross reference to locale(1).

  PR:		247553
  MFC after:	1 week

Comment 4 Joerg Wunsch freebsd_committer 2020-07-17 22:08:09 UTC
Fixed in HEAD, stable/12, and stable/11