1/* Determine name of the currently selected locale.
2   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
3
4   This program is free software; you can redistribute it and/or modify it
5   under the terms of the GNU Library General Public License as published
6   by the Free Software Foundation; either version 2, or (at your option)
7   any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12   Library General Public License for more details.
13
14   You should have received a copy of the GNU Library General Public
15   License along with this program; if not, write to the Free Software
16   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17   USA.  */
18
19#ifndef _GL_LOCALENAME_H
20#define _GL_LOCALENAME_H
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26
27/* Determine the current locale's name.
28   It considers both the POSIX notion of locale name (see functions
29   gl_locale_name_thread and gl_locale_name_posix) and the system notion
30   of locale name (see function gl_locale_name_default).
31   CATEGORY is a locale category abbreviation, as defined in <locale.h>,
32   but not LC_ALL. E.g. LC_MESSAGES.
33   CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES".
34   Return the locale category's name, canonicalized into XPG syntax
35     language[_territory][.codeset][@modifier]
36   The codeset part in the result is not reliable; the locale_charset()
37   should be used for codeset information instead.
38   The result must not be freed; it is statically allocated.  */
39extern const char * gl_locale_name (int category, const char *categoryname);
40
41/* Determine the current per-thread locale's name, as specified by uselocale()
42   calls.
43   CATEGORY is a locale category abbreviation, as defined in <locale.h>,
44   but not LC_ALL. E.g. LC_MESSAGES.
45   CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES".
46   Return the locale category's name, canonicalized into XPG syntax
47     language[_territory][.codeset][@modifier]
48   or NULL if no locale has been specified for the current thread.
49   The codeset part in the result is not reliable; the locale_charset()
50   should be used for codeset information instead.
51   The result must not be freed; it is statically allocated.  */
52extern const char * gl_locale_name_thread (int category, const char *categoryname);
53
54/* Determine the thread-independent current locale's name, as specified by
55   setlocale() calls or by environment variables.
56   CATEGORY is a locale category abbreviation, as defined in <locale.h>,
57   but not LC_ALL. E.g. LC_MESSAGES.
58   CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES".
59   Return the locale category's name, canonicalized into XPG syntax
60     language[_territory][.codeset][@modifier]
61   or NULL if no locale has been specified to setlocale() or by environment
62   variables.
63   The codeset part in the result is not reliable; the locale_charset()
64   should be used for codeset information instead.
65   The result must not be freed; it is statically allocated.  */
66extern const char * gl_locale_name_posix (int category, const char *categoryname);
67
68/* Determine the default locale's name, as specified by environment
69   variables.
70   Return the locale category's name, or NULL if no locale has been specified
71   by environment variables.
72   The result must not be freed; it is statically allocated.  */
73extern const char * gl_locale_name_environ (int category, const char *categoryname);
74
75/* Determine the default locale's name.  This is the current locale's name,
76   if not specified by uselocale() calls, by setlocale() calls, or by
77   environment variables.  This locale name is usually determined by systems
78   settings that the user can manipulate through a GUI.
79
80   Quoting POSIX:2001:
81     "All implementations shall define a locale as the default locale,
82      to be invoked when no environment variables are set, or set to the
83      empty string.  This default locale can be the C locale or any other
84      implementation-defined locale.  Some implementations may provide
85      facilities for local installation administrators to set the default
86      locale, customizing it for each location.  IEEE Std 1003.1-2001 does
87      not require such a facility."
88
89   The result must not be freed; it is statically allocated.  */
90extern const char * gl_locale_name_default (void);
91
92
93#ifdef __cplusplus
94}
95#endif
96
97#endif /* _GL_LOCALENAME_H */
98