---
name: "uselocale"
section: "3"
platform: "macos"
package: "Libc"
version: "1752.120.2"
release: "macOS 26.5"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/uselocale"
---

# uselocale(3)

Set the per-thread locale

## NAME

**uselocale** – Set the per-thread locale

## SYNOPSIS

**#include \<xlocale.h\>**

*locale\_t*\

**uselocale**(*locale\_t loc*);

## DESCRIPTION

Sets the per-thread locale to *loc*. Specify LC\_GLOBAL\_LOCALE to turn off any per-thread locale. Pass NULL to return the current value of the per-thread locale (or LC\_GLOBAL\_LOCALE) without changing the locale.

## RETURN VALUES

Returns the previous locale, or LC\_GLOBAL\_LOCALE if no per-thread locale was in effect.

## SEE ALSO

[duplocale(3)](/duplocale/3.md), [freelocale(3)](/freelocale/3.md), [newlocale(3)](/newlocale/3.md), [querylocale(3)](/querylocale/3.md), [xlocale(3)](/xlocale/3.md)
