SDL_HINT_PREFERRED_LOCALES(3)

πŸ’– SDL_HINT_PREFERRED_LOCALES πŸ’–

okay bestie, welcome to the SDL_HINT_PREFERRED_LOCALES page, straight outta the SDL3 FUNCTIONS section of the manual. this one's short, sweet, and honestly kinda iconic. let's get into it 🫢


✨ NAME ✨

SDL_HINT_PREFERRED_LOCALES β€” the override for SDL_GetPreferredLocales(). that's it, that's the whole job. she's a hint, she's here to have opinions about locales πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_hints.h>

#define SDL_HINT_PREFERRED_LOCALES "SDL_PREFERRED_LOCALES"

like, literally that's the whole thing. one include, one define, no cap 🌸


✨ DESCRIPTION ✨

so here's the tea β˜• β€” if you set this hint, it gets favored over anything the OS might report for the user's preferred locales. you're basically telling the OS "thanks for your input babe, but I got this" 😌

⚠️ real talk though: changing this hint at runtime will not generate an SDL_EVENT_LOCALE_CHANGED event. no automatic event for you, sorry bestie 😭 β€” but if you can change the hint, you can push your own event, if you want. main character energy: you wanna event, you throw the event yourself πŸ’…

now, the format, because this part matters fr fr:

it's a comma-separated list of language and locale, combined with an underscore, as is a common format: "en_GB". the locale is optional β€” you can just do "en" if that's the vibe. so you might have a list like this:

"en_GB,jp,es_PT"

see how cute that is? language en, underscore, region GB. then a comma. then just jp being lowkey minimal. then es_PT doing the full thing. all three, one string, slay πŸ‘‘

This hint can be set anytime. no timing drama, no "only before init" nonsense. whenever you want, bestie ✨


✨ AVAILABILITY ✨

this hint is available since SDL 3.2.0. so if you're on anything older, sorry babe, she's not there yet πŸ™ˆ


and that's the whole page!! short king of a manpage, but every detail ate and left no crumbs πŸ“

Simple Directmedia Layer πŸ’œ SDL 3.4.18 πŸ’œ and you just read SDL_HINT_PREFERRED_LOCALES(3) β€” thanks for stopping by, ily, go set some locales πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from