---
name: "querylocale"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd", "macos"]
url: "https://new.carta.tech/querylocale"
---

# querylocale(3)

Look up the locale name or version for a specified category

## NAME

**querylocale** – Look up the locale name or version for a specified category

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

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

*const* *char* *\**\

**querylocale**(*int mask*, *locale\_t locale*);

## DESCRIPTION

Returns the name or version of the locale for the category specified by *mask*. The possible values for the mask are the same as those in [newlocale(3)](/newlocale/3.md), when requesting the locale name. Specify the bitwise OR of *LC\_VERSION\_MASK* and another mask value to request a version string. Version strings can be compared to detect changes to the locale's definition. The structure of the version string is unspecified. Currently, version information is only available for *LC\_COLLATE\_MASK*, and an empty string is returned for other categories. If more than one bit in the mask is set, not counting *LC\_VERSION\_MASK*, the returned value is undefined.

## SEE ALSO

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

## HISTORY

The **querylocale**() function first appeared in FreeBSD 9.1, and is based on the function of the same name in Darwin. *LC\_VERSION\_MASK* first appeared in FreeBSD 13.0.
