Skip to content

Query Locale information

Finalspace edited this page May 29, 2026 · 2 revisions

Table of Contents

FPL provides a couple of functions for querying the currently configured locale. A locale is written into a caller-provided string buffer in a format described by the fplLocaleFormat enumeration. Currently the only supported format is fplLocaleFormat_ISO639, which produces ISO-639 strings like en-US or de-DE.

Querying a locale

FPL distinguishes three kinds of locale:

Function Returns the locale of
fplGetUserLocale() The current user account
fplGetSystemLocale() The operating system / system-wide setting
fplGetInputLocale() The active keyboard / input layout

All three functions share the same signature - pass the desired fplLocaleFormat, a destination buffer and its maximum length. They return the number of characters written, excluding the null terminator.

char localeBuffer[16];

// Query the current user locale, e.g. "en-US"
if ((, localeBuffer, (localeBuffer)) > 0) {
    ("User locale: %s\n", localeBuffer);
}

// Query the system locale
if ((, localeBuffer, (localeBuffer)) > 0) {
    ("System locale: %s\n", localeBuffer);
}

// Query the input/keyboard locale
if ((, localeBuffer, (localeBuffer)) > 0) {
    ("Input locale: %s\n", localeBuffer);
}

Note: A return value of zero means the locale could not be determined or the buffer was too small.

Final Platform Layer

Pages

Topics

Data Structures

Clone this wiki locally