The LANG environment variable is not described in the setlocale(3) manpage. It would also be helpful to describe the priority of the environment variables (AFAIK: LC_ALL, then LC_*, then LANG).
Responsible Changed From-To: freebsd-doc->murray I will take a look at this one.
A patch to describe the LANG variable and note that documented order (LC_ALL, LC_*, LANG) is the priority order (or so I'm led to believe from the initial log of this PR) --- setlocale.3.orig Sat Jun 10 02:37:30 2006 +++ setlocale.3 Sat Jun 10 02:48:42 2006 @@ -60,7 +60,8 @@ The .Fn setlocale function recognizes several categories of routines. -These are the categories and the sets of routines they select: +In decending order of evaluation priority, the categories and the sets +of routines they select: .Pp .Bl -tag -width LC_MONETARY .It Dv LC_ALL @@ -103,6 +104,9 @@ Set a locale for formatting dates and times using the .Fn strftime function. +.It Dv LANG +Sets the generic locale category for native language, local customs and +coded character set in the absence of any configured LC_* variables. .El .Pp Only three locales are defined by default, -- Regards, Conall O'Brien Systems and Network Administrator School Of Mathematics University Of Dublin, Trinity College
There is also an EXAMPLES section in the NetBSD man page we may want to borrow : http://people.freebsd.org/~murray/patches/setlocale.3.diff - Murray
For bugs matching the following criteria: Status: In Progress Changed: (is less than) 2014-06-01 Reset to default assignee and clear in-progress tags. Mail being skipped
A commit references this bug: Author: gbe Date: Fri Aug 7 17:25:56 UTC 2020 New revision: 364032 URL: https://svnweb.freebsd.org/changeset/base/364032 Log: setlocale(3): Add an EXAMPLES section and add LANG category PR: 41824 Submitted by: Slaven Rezic <eserte atvran dot herceg dot de> Obtained from: NetBSD MFC after: 1 week Changes: head/lib/libc/locale/setlocale.3
A commit references this bug: Author: gbe Date: Fri Aug 14 06:46:40 UTC 2020 New revision: 364230 URL: https://svnweb.freebsd.org/changeset/base/364230 Log: MFC r364032: setlocale(3): Add an EXAMPLES section and add LANG category PR: 41824 Submitted by: Slaven Rezic <eserte at vran dot herceg dot de> Obtained from: NetBSD Changes: _U stable/12/ stable/12/lib/libc/locale/setlocale.3
Both example setlocale() calls would fail as there's no "de" or "fr" locale directory under /usr/share/locale and it might confuse users; it would help to provide examples that work as is, preferably using UTF-8 locales, i.e. de_DE.UTF-8 and fr_FR.UTF-8.
Assign to committer, and close as fixed.