Apps had no way to follow the system locale - inbe hard-defaulted to English for every fresh profile. GetDefaultLocaleCode resolves LANGUAGE/LC_ALL/LC_MESSAGES/LANG down to an available catalog (pt_BR.UTF-8 -> pt) and returns "en" when nothing matches.
38 lines
734 B
C
38 lines
734 B
C
#ifndef LOCALE_H
|
|
#define LOCALE_H
|
|
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct LocaleEntry {
|
|
char *key;
|
|
char *value;
|
|
} LocaleEntry;
|
|
|
|
typedef struct LocaleLanguage {
|
|
char *code;
|
|
char *label;
|
|
} LocaleLanguage;
|
|
|
|
void InitLocale(void);
|
|
int SetLocale(const char *code);
|
|
const char *GetDefaultLocaleCode(void);
|
|
const char *GetLocaleText(const char *key);
|
|
void FormatLocaleText(char *dst, size_t dst_size, const char *key, ...);
|
|
|
|
int GetLocaleCount(void);
|
|
const char *GetLocaleCode(int index);
|
|
const char *GetLocaleLabel(int index);
|
|
int GetLocaleIndex(const char *code);
|
|
const char *GetCurrentLocaleCode(void);
|
|
int GetCurrentLocaleIndex(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // LOCALE_H
|