summaryrefslogtreecommitdiff
path: root/lib/localename.h
blob: f633ad8be69df8f4e890bb2464069866f5253427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* Determine name of the currently selected locale.
   Copyright (C) 2007 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU Library General Public License as published
   by the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
   USA.  */

#ifndef _GL_LOCALENAME_H
#define _GL_LOCALENAME_H

#ifdef __cplusplus
extern "C" {
#endif


/* Determine the current locale's name.
   It considers both the POSIX notion of locale name (see function
   gl_locale_name_posix) and the system notion of locale name (see function
   gl_locale_name_default).
   CATEGORY is a locale category abbreviation, as defined in <locale.h>,
   but not LC_ALL. E.g. LC_MESSAGES.
   CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES".
   Return the locale category's name, canonicalized into XPG syntax
     language[_territory][.codeset][@modifier]
   The codeset part in the result is not reliable; the locale_charset()
   should be used for codeset information instead.
   The result must not be freed; it is statically allocated.  */
extern const char * gl_locale_name (int category, const char *categoryname);

/* Determine the current locale's name, as specified by setlocale() calls
   or by environment variables.
   CATEGORY is a locale category abbreviation, as defined in <locale.h>,
   but not LC_ALL. E.g. LC_MESSAGES.
   CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES".
   Return the locale category's name, canonicalized into XPG syntax
     language[_territory][.codeset][@modifier]
   or NULL if no locale has been specified to setlocale() or by environment
   variables.
   The codeset part in the result is not reliable; the locale_charset()
   should be used for codeset information instead.
   The result must not be freed; it is statically allocated.  */
extern const char * gl_locale_name_posix (int category, const char *categoryname);

/* Determine the default locale's name.  This is the current locale's name,
   if not specified by setlocale() calls or by environment variables.  This
   locale name is usually determined by systems settings that the user can
   manipulate through a GUI.

   Quoting POSIX:2001:
     "All implementations shall define a locale as the default locale,
      to be invoked when no environment variables are set, or set to the
      empty string.  This default locale can be the C locale or any other
      implementation-defined locale.  Some implementations may provide
      facilities for local installation administrators to set the default
      locale, customizing it for each location.  IEEE Std 1003.1-2001 does
      not require such a facility."

   The result must not be freed; it is statically allocated.  */
extern const char * gl_locale_name_default (void);


#ifdef __cplusplus
}
#endif

#endif /* _GL_LOCALENAME_H */