Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #802
Difficulty: Medium
The CSS @font-face rule is not supported across the main browsers, Internet Explorer, Firefox, Opera, Chrome, and Safari.
True or False?
Linux & Unix Commands - Search Man Pages

uselocale(3) [x11r4 man page]

USELOCALE(3)						     Linux Programmer's Manual						      USELOCALE(3)

uselocale - set/get the locale for the calling thread SYNOPSIS
#include <locale.h> locale_t uselocale(locale_t newloc); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): uselocale(): Since glibc 2.10: _XOPEN_SOURCE >= 700 Before glibc 2.10: _GNU_SOURCE DESCRIPTION
The uselocale() function sets the current locale for the calling thread, and returns the thread's previously current locale. After a suc- cessful call to uselocale(), any calls by this thread to functions that depend on the locale will operate as though the locale has been set to newloc. The newloc argument can have one of the following values: A handle returned by a call to newlocale(3) or duplocale(3) The calling thread's current locale is set to the specified locale. The special locale object handle LC_GLOBAL_LOCALE The calling thread's current locale is set to the global locale determined by setlocale(3). (locale_t) 0 The calling thread's current locale is left unchanged (and the current locale is returned as the function result). RETURN VALUE
On success, uselocale() returns the locale handle that was set by the previous call to uselocale() in this thread, or LC_GLOBAL_HANDLE if there was no such previous call. On error, it returns (locale_t) 0, and sets errno to indicate the cause of the error. ERRORS
EINVAL newloc does not refer to a valid locale object. VERSIONS
The uselocale() function first appeared in version 2.3 of the GNU C library. CONFORMING TO
Unlike setlocale(3), uselocale() does not allow selective replacement of individual locale categories. To employ a locale that differs in only a few categories from the current locale, use calls to duplocale(3) and newlocale(3) to obtain a locale object equivalent to the cur- rent locale and modify the desired categories in that object. EXAMPLE
See newlocale(3) and duplocale(3). SEE ALSO
locale(1), duplocale(3), freelocale(3), newlocale(3), setlocale(3), locale(5), locale(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at Linux 2017-09-15 USELOCALE(3)

Check Out this Related Man Page

USELOCALE(3P)						     POSIX Programmer's Manual						     USELOCALE(3P)

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
uselocale -- use locale in current thread SYNOPSIS
#include <locale.h> locale_t uselocale(locale_t newloc); DESCRIPTION
The uselocale() function shall set the current locale for the current thread to the locale represented by newloc. The value for the newloc argument shall be one of the following: 1. A value returned by the newlocale() or duplocale() functions 2. The special locale object descriptor LC_GLOBAL_LOCALE 3. (locale_t)0 Once the uselocale() function has been called to install a thread-local locale, the behavior of every interface using data from the current locale shall be affected for the calling thread. The current locale for other threads shall remain unchanged. If the newloc argument is (locale_t)0, the object returned is the current locale or LC_GLOBAL_LOCALE if there has been no previous call to uselocale() for the current thread. If the newloc argument is LC_GLOBAL_LOCALE, the thread shall use the global locale determined by the setlocale() function. RETURN VALUE
Upon successful completion, the uselocale() function shall return the locale handle from the previous call for the current thread, or LC_GLOBAL_LOCALE if there was no such previous call. Otherwise, uselocale() shall return (locale_t)0 and set errno to indicate the error. ERRORS
The uselocale() function may fail if: EINVAL locale is not a valid locale object. The following sections are informative. EXAMPLES
Unlike the setlocale() function, the uselocale() function does not allow replacing some locale categories only. Applications that need to install a locale which differs only in a few categories must use newlocale() to change a locale object equivalent to the currently used locale and install it. RATIONALE
duplocale(), freelocale(), newlocale(), setlocale() The Base Definitions volume of POSIX.1-2008, <locale.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Stan- dard is the referee document. The original Standard can be obtained online at . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see . IEEE
/The Open Group 2013 USELOCALE(3P)

Featured Tech Videos