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