1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/**
23 * \file SDL_locale.h
24 *
25 * Include file for SDL locale services
26 */
27
28#ifndef _SDL_locale_h
29#define _SDL_locale_h
30
31#include "SDL_stdinc.h"
32#include "SDL_error.h"
33
34#include "begin_code.h"
35/* Set up for C function definitions, even when using C++ */
36#ifdef __cplusplus
37/* *INDENT-OFF* */
38extern "C" {
39/* *INDENT-ON* */
40#endif
41
42
43typedef struct SDL_Locale
44{
45 const char *language; /**< A language name, like "en" for English. */
46 const char *country; /**< A country, like "US" for America. Can be NULL. */
47} SDL_Locale;
48
49/**
50 * Report the user's preferred locale.
51 *
52 * This returns an array of SDL_Locale structs, the final item zeroed out.
53 * When the caller is done with this array, it should call SDL_free() on the
54 * returned value; all the memory involved is allocated in a single block, so
55 * a single SDL_free() will suffice.
56 *
57 * Returned language strings are in the format xx, where 'xx' is an ISO-639
58 * language specifier (such as "en" for English, "de" for German, etc).
59 * Country strings are in the format YY, where "YY" is an ISO-3166 country
60 * code (such as "US" for the United States, "CA" for Canada, etc). Country
61 * might be NULL if there's no specific guidance on them (so you might get {
62 * "en", "US" } for American English, but { "en", NULL } means "English
63 * language, generically"). Language strings are never NULL, except to
64 * terminate the array.
65 *
66 * Please note that not all of these strings are 2 characters; some are three
67 * or more.
68 *
69 * The returned list of locales are in the order of the user's preference. For
70 * example, a German citizen that is fluent in US English and knows enough
71 * Japanese to navigate around Tokyo might have a list like: { "de", "en_US",
72 * "jp", NULL }. Someone from England might prefer British English (where
73 * "color" is spelled "colour", etc), but will settle for anything like it: {
74 * "en_GB", "en", NULL }.
75 *
76 * This function returns NULL on error, including when the platform does not
77 * supply this information at all.
78 *
79 * This might be a "slow" call that has to query the operating system. It's
80 * best to ask for this once and save the results. However, this list can
81 * change, usually because the user has changed a system preference outside of
82 * your program; SDL will send an SDL_LOCALECHANGED event in this case, if
83 * possible, and you can call this function again to get an updated copy of
84 * preferred locales.
85 *
86 * \return array of locales, terminated with a locale with a NULL language
87 * field. Will return NULL on error.
88 *
89 * \since This function is available since SDL 2.0.14.
90 */
91extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void);
92
93/* Ends C function definitions when using C++ */
94#ifdef __cplusplus
95/* *INDENT-OFF* */
96}
97/* *INDENT-ON* */
98#endif
99#include "close_code.h"
100
101#endif /* _SDL_locale_h */
102
103/* vi: set ts=4 sw=4 expandtab: */
104