sdllocale.inc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // based on SDL_locale.h
  2. type
  3. PPSDL_Locale = ^PSDL_Locale;
  4. PSDL_Locale = ^TSDL_Locale;
  5. TSDL_Locale = record
  6. // A language name, like 'en' for English.
  7. language: PAnsiChar;
  8. // A country, like 'US' for America. Can be NIL.
  9. country: PAnsiChar;
  10. end;
  11. {**
  12. * \brief Report the user's preferred locale.
  13. *
  14. * This returns an array of SDL_Locale structs, the final item zeroed out.
  15. * When the caller is done with this array, it should call SDL_free() on
  16. * the returned value; all the memory involved is allocated in a single
  17. * block, so a single SDL_free() will suffice.
  18. *
  19. * Returned language strings are in the format xx, where 'xx' is an ISO-639
  20. * language specifier (such as 'en' for English, 'de' for German, etc).
  21. * Country strings are in the format YY, where 'YY' is an ISO-3166 country
  22. * code (such as "US" for the United States, 'CA' for Canada, etc). Country
  23. * might be NULL if there's no specific guidance on them (so you might get
  24. * ( 'en', 'US' ) for American English, but ( 'en', NIL ) means "English
  25. * language, generically"). Language strings are never NIL, except to
  26. * terminate the array.
  27. *
  28. * Please note that not all of these strings are 2 characters; some are
  29. * three or more.
  30. *
  31. * The returned list of locales are in the order of the user's preference.
  32. * For example, a German citizen that is fluent in US English and knows
  33. * enough Japanese to navigate around Tokyo might have a list like:
  34. * [ 'de', 'en_US', 'jp', NIL ]. Someone from England might prefer British
  35. * English (where "color" is spelled "colour", etc), but will settle for
  36. * anything like it: [ 'en_GB', 'en', NIL ].
  37. *
  38. * This function returns NIL on error, including when the platform does not
  39. * supply this information at all.
  40. *
  41. * This might be a "slow" call that has to query the operating system. It's
  42. * best to ask for this once and save the results. However, this list can
  43. * change, usually because the user has changed a system preference outside
  44. * of your program; SDL will send an SDL_LOCALECHANGED event in this case,
  45. * if possible, and you can call this function again to get an updated copy
  46. * of preferred locales.
  47. *
  48. * \return array of locales, terminated with a locale with a NIL language
  49. * field. Will return NIL on error.
  50. *}
  51. function SDL_GetPreferredLocales(): PSDL_Locale; cdecl;
  52. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPreferredLocales' {$ENDIF} {$ENDIF};