locale: Implemented SDL_GetPreferredLocales().
authorRyan C. Gordon <icculus@icculus.org>
Mon, 04 May 2020 02:27:29 -0400
changeset 1379755ec5ae4aa0b
parent 13796 afe75d23ab20
child 13798 458e052261cb
locale: Implemented SDL_GetPreferredLocales().

This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.

Fixes Bugzilla #2131.
Android.mk
CMakeLists.txt
Makefile.in
Makefile.os2
VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj
VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters
VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj
VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters
VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj
VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters
VisualC/SDL/SDL.vcxproj
VisualC/SDL/SDL.vcxproj.filters
Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
Xcode/SDL/SDL.xcodeproj/project.pbxproj
configure
configure.ac
include/SDL.h
include/SDL_events.h
include/SDL_hints.h
include/SDL_locale.h
src/core/android/SDL_android.c
src/core/android/SDL_android.h
src/dynapi/SDL_dynapi_overrides.h
src/dynapi/SDL_dynapi_procs.h
src/events/SDL_events.c
src/events/SDL_events_c.h
src/locale/SDL_locale.c
src/locale/SDL_syslocale.h
src/locale/android/SDL_syslocale.c
src/locale/dummy/SDL_syslocale.c
src/locale/emscripten/SDL_syslocale.c
src/locale/haiku/SDL_syslocale.cc
src/locale/macosx/SDL_syslocale.m
src/locale/unix/SDL_syslocale.c
src/locale/windows/SDL_syslocale.c
src/locale/winrt/SDL_syslocale.c
src/main/haiku/SDL_BApp.h
src/video/cocoa/SDL_cocoaevents.m
test/Makefile.in
test/README
test/configure
test/testlocale.c
     1.1 --- a/Android.mk	Wed May 06 12:19:58 2020 -0700
     1.2 +++ b/Android.mk	Mon May 04 02:27:29 2020 -0400
     1.3 @@ -35,6 +35,8 @@
     1.4  	$(wildcard $(LOCAL_PATH)/src/joystick/hidapi/*.c) \
     1.5  	$(wildcard $(LOCAL_PATH)/src/joystick/virtual/*.c) \
     1.6  	$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
     1.7 +	$(wildcard $(LOCAL_PATH)/src/locale/*.c) \
     1.8 +	$(wildcard $(LOCAL_PATH)/src/locale/android/*.c) \
     1.9  	$(wildcard $(LOCAL_PATH)/src/power/*.c) \
    1.10  	$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
    1.11  	$(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \
     2.1 --- a/CMakeLists.txt	Wed May 06 12:19:58 2020 -0700
     2.2 +++ b/CMakeLists.txt	Mon May 04 02:27:29 2020 -0400
     2.3 @@ -307,7 +307,7 @@
     2.4  
     2.5  set(SDL_SUBSYSTEMS
     2.6      Atomic Audio Video Render Events Joystick Haptic Power Threads Timers
     2.7 -    File Loadso CPUinfo Filesystem Dlopen Sensor)
     2.8 +    File Loadso CPUinfo Filesystem Dlopen Sensor Locale)
     2.9  foreach(_SUB ${SDL_SUBSYSTEMS})
    2.10    string(TOUPPER ${_SUB} _OPT)
    2.11    if (NOT DEFINED SDL_${_OPT}_ENABLED_BY_DEFAULT)
    2.12 @@ -404,6 +404,7 @@
    2.13    ${SDL2_SOURCE_DIR}/src/events/*.c
    2.14    ${SDL2_SOURCE_DIR}/src/file/*.c
    2.15    ${SDL2_SOURCE_DIR}/src/libm/*.c
    2.16 +  ${SDL2_SOURCE_DIR}/src/locale/*.c
    2.17    ${SDL2_SOURCE_DIR}/src/render/*.c
    2.18    ${SDL2_SOURCE_DIR}/src/render/*/*.c
    2.19    ${SDL2_SOURCE_DIR}/src/stdlib/*.c
    2.20 @@ -885,6 +886,8 @@
    2.21    file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/*.c)
    2.22    set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
    2.23  endif()
    2.24 +
    2.25 +
    2.26  # TODO: in configure.ac, the test for LOADSO and SDL_DLOPEN is a bit weird:
    2.27  # if LOADSO is not wanted, SDL_LOADSO_DISABLED is set
    2.28  # If however on Unix or APPLE dlopen() is detected via CheckDLOPEN(),
    2.29 @@ -993,6 +996,11 @@
    2.30      set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_POWER_SOURCES})
    2.31      set(HAVE_SDL_POWER TRUE)
    2.32    endif()
    2.33 +  if(SDL_LOCALE)
    2.34 +    file(GLOB ANDROID_LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/android/*.c)
    2.35 +    set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_LOCALE_SOURCES})
    2.36 +    set(HAVE_SDL_LOCALE TRUE)
    2.37 +  endif()
    2.38    if(SDL_TIMERS)
    2.39      set(SDL_TIMER_UNIX 1)
    2.40      file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c)
    2.41 @@ -1083,6 +1091,11 @@
    2.42      set(SOURCE_FILES ${SOURCE_FILES} ${EM_POWER_SOURCES})
    2.43      set(HAVE_SDL_POWER TRUE)
    2.44    endif()
    2.45 +  if(SDL_LOCALE)
    2.46 +    file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/emscripten/*.c)
    2.47 +    set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
    2.48 +    set(HAVE_SDL_LOCALE TRUE)
    2.49 +  endif()
    2.50    if(SDL_TIMERS)
    2.51      set(SDL_TIMER_UNIX 1)
    2.52      file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c)
    2.53 @@ -1272,6 +1285,12 @@
    2.54      endif()
    2.55    endif()
    2.56  
    2.57 +  if(SDL_LOCALE)
    2.58 +    file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/unix/*.c)
    2.59 +    set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
    2.60 +    set(HAVE_SDL_LOCALE TRUE)
    2.61 +  endif()
    2.62 +
    2.63    if(SDL_FILESYSTEM)
    2.64      set(SDL_FILESYSTEM_UNIX 1)
    2.65      file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/unix/*.c)
    2.66 @@ -1438,6 +1457,12 @@
    2.67      set(HAVE_SDL_POWER TRUE)
    2.68    endif()
    2.69  
    2.70 +  if(SDL_LOCALE)
    2.71 +    file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/windows/*.c)
    2.72 +    set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
    2.73 +    set(HAVE_SDL_LOCALE TRUE)
    2.74 +  endif()
    2.75 +
    2.76    if(SDL_FILESYSTEM)
    2.77      set(SDL_FILESYSTEM_WINDOWS 1)
    2.78      file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/windows/*.c)
    2.79 @@ -1629,6 +1654,12 @@
    2.80      set(HAVE_SDL_POWER TRUE)
    2.81    endif()
    2.82  
    2.83 +  if(SDL_LOCALE)
    2.84 +    file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/macosx/*.m)
    2.85 +    set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
    2.86 +    set(HAVE_SDL_LOCALE TRUE)
    2.87 +  endif()
    2.88 +
    2.89    if(SDL_TIMERS)
    2.90      set(SDL_TIMER_UNIX 1)
    2.91      file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c)
    2.92 @@ -1837,6 +1868,12 @@
    2.93      set(HAVE_SDL_TIMERS TRUE)
    2.94    endif()
    2.95  
    2.96 +  if(SDL_LOCALE)
    2.97 +    file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/haiku/*.cc)
    2.98 +    set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
    2.99 +    set(HAVE_SDL_LOCALE TRUE)
   2.100 +  endif()
   2.101 +
   2.102    CheckPTHREAD()
   2.103  
   2.104  elseif(RISCOS)
   2.105 @@ -1899,6 +1936,11 @@
   2.106    file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/dummy/*.c)
   2.107    set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
   2.108  endif()
   2.109 +if(NOT HAVE_SDL_LOCALE)
   2.110 +  set(SDL_LOCALE_DISABLED 1)
   2.111 +  file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/dummy/*.c)
   2.112 +  set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
   2.113 +endif()
   2.114  
   2.115  # We always need to have threads and timers around
   2.116  if(NOT HAVE_SDL_THREADS)
     3.1 --- a/Makefile.in	Wed May 06 12:19:58 2020 -0700
     3.2 +++ b/Makefile.in	Mon May 04 02:27:29 2020 -0400
     3.3 @@ -82,6 +82,7 @@
     3.4  	SDL_keyboard.h \
     3.5  	SDL_keycode.h \
     3.6  	SDL_loadso.h \
     3.7 +	SDL_locale.h \
     3.8  	SDL_log.h \
     3.9  	SDL_main.h \
    3.10  	SDL_messagebox.h \
     4.1 --- a/Makefile.os2	Wed May 06 12:19:58 2020 -0700
     4.2 +++ b/Makefile.os2	Mon May 04 02:27:29 2020 -0400
     4.3 @@ -60,6 +60,8 @@
     4.4  
     4.5  SRCS+= SDL_dynapi.c
     4.6  
     4.7 +SRCS+= SDL_locale.c SDL_syslocale.c
     4.8 +
     4.9  OBJS = $(SRCS:.c=.obj)
    4.10  MOBJS= $(MSRCS:.c=.obj)
    4.11  
    4.12 @@ -68,7 +70,7 @@
    4.13  
    4.14  .c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk;
    4.15  .c: ./src/haptic/dummy;./src/joystick/dummy;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy;
    4.16 -.c: ./src/loadso/dummy;./src/filesystem/dummy;./src/timer/dummy;./src/thread/generic;
    4.17 +.c: ./src/loadso/dummy;./src/filesystem/dummy;./src/timer/dummy;./src/thread/generic;./src/locale/unix
    4.18  
    4.19  all: $(DLLFILE) $(LIBFILE) .symbolic
    4.20  
     5.1 --- a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj	Wed May 06 12:19:58 2020 -0700
     5.2 +++ b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj	Mon May 04 02:27:29 2020 -0400
     5.3 @@ -52,6 +52,7 @@
     5.4      <ClInclude Include="..\..\include\SDL_keyboard.h" />
     5.5      <ClInclude Include="..\..\include\SDL_keycode.h" />
     5.6      <ClInclude Include="..\..\include\SDL_loadso.h" />
     5.7 +    <ClInclude Include="..\..\include\SDL_locale.h" />
     5.8      <ClInclude Include="..\..\include\SDL_log.h" />
     5.9      <ClInclude Include="..\..\include\SDL_main.h" />
    5.10      <ClInclude Include="..\..\include\SDL_mouse.h" />
    5.11 @@ -118,6 +119,7 @@
    5.12      <ClInclude Include="..\..\src\joystick\windows\SDL_dinputjoystick_c.h" />
    5.13      <ClInclude Include="..\..\src\joystick\windows\SDL_windowsjoystick_c.h" />
    5.14      <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
    5.15 +    <ClInclude Include="..\..\src\locale\SDL_syslocale.h" />
    5.16      <ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
    5.17      <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
    5.18      <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
    5.19 @@ -249,6 +251,8 @@
    5.20      <ClCompile Include="..\..\src\joystick\windows\SDL_windowsjoystick.c" />
    5.21      <ClCompile Include="..\..\src\joystick\windows\SDL_xinputjoystick.c" />
    5.22      <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
    5.23 +    <ClCompile Include="..\..\src\locale\SDL_locale.c" />
    5.24 +    <ClCompile Include="..\..\src\locale\winrt\SDL_syslocale.c" />
    5.25      <ClCompile Include="..\..\src\power\SDL_power.c" />
    5.26      <ClCompile Include="..\..\src\power\winrt\SDL_syspower.cpp" />
    5.27      <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.c" />
     6.1 --- a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters	Wed May 06 12:19:58 2020 -0700
     6.2 +++ b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters	Mon May 04 02:27:29 2020 -0400
     6.3 @@ -84,6 +84,9 @@
     6.4      <ClInclude Include="..\..\include\SDL_loadso.h">
     6.5        <Filter>Header Files</Filter>
     6.6      </ClInclude>
     6.7 +    <ClInclude Include="..\..\include\SDL_locale.h">
     6.8 +      <Filter>Header Files</Filter>
     6.9 +    </ClInclude>
    6.10      <ClInclude Include="..\..\include\SDL_log.h">
    6.11        <Filter>Header Files</Filter>
    6.12      </ClInclude>
    6.13 @@ -321,6 +324,9 @@
    6.14      <ClInclude Include="..\..\src\SDL_internal.h">
    6.15        <Filter>Source Files</Filter>
    6.16      </ClInclude>
    6.17 +    <ClInclude Include="..\..\src\locale\SDL_syslocale.h">
    6.18 +      <Filter>Source Files</Filter>
    6.19 +    </ClInclude>
    6.20      <ClInclude Include="..\..\src\thread\SDL_systhread.h">
    6.21        <Filter>Source Files</Filter>
    6.22      </ClInclude>
    6.23 @@ -614,6 +620,12 @@
    6.24      <ClCompile Include="..\..\src\SDL_log.c">
    6.25        <Filter>Source Files</Filter>
    6.26      </ClCompile>
    6.27 +    <ClCompile Include="..\..\src\locale\SDL_locale.c">
    6.28 +      <Filter>Source Files</Filter>
    6.29 +    </ClCompile>
    6.30 +    <ClCompile Include="..\..\src\locale\winrt\SDL_syslocale.c">
    6.31 +      <Filter>Source Files</Filter>
    6.32 +    </ClCompile>
    6.33      <ClCompile Include="..\..\src\stdlib\SDL_getenv.c">
    6.34        <Filter>Source Files</Filter>
    6.35      </ClCompile>
     7.1 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj	Wed May 06 12:19:58 2020 -0700
     7.2 +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj	Mon May 04 02:27:29 2020 -0400
     7.3 @@ -44,6 +44,7 @@
     7.4      <ClInclude Include="..\..\include\SDL_keyboard.h" />
     7.5      <ClInclude Include="..\..\include\SDL_keycode.h" />
     7.6      <ClInclude Include="..\..\include\SDL_loadso.h" />
     7.7 +    <ClInclude Include="..\..\include\SDL_locale.h" />
     7.8      <ClInclude Include="..\..\include\SDL_log.h" />
     7.9      <ClInclude Include="..\..\include\SDL_main.h" />
    7.10      <ClInclude Include="..\..\include\SDL_mouse.h" />
    7.11 @@ -124,6 +125,7 @@
    7.12      <ClInclude Include="..\..\src\SDL_fatal.h" />
    7.13      <ClInclude Include="..\..\src\SDL_hints_c.h" />
    7.14      <ClInclude Include="..\..\src\SDL_internal.h" />
    7.15 +    <ClInclude Include="..\..\src\locale\SDL_syslocale.h" />
    7.16      <ClInclude Include="..\..\src\sensor\dummy\SDL_dummysensor.h" />
    7.17      <ClInclude Include="..\..\src\sensor\SDL_sensor_c.h" />
    7.18      <ClInclude Include="..\..\src\sensor\SDL_syssensor.h" />
    7.19 @@ -245,6 +247,8 @@
    7.20      <ClCompile Include="..\..\src\SDL_error.c" />
    7.21      <ClCompile Include="..\..\src\SDL_hints.c" />
    7.22      <ClCompile Include="..\..\src\SDL_log.c" />
    7.23 +    <ClCompile Include="..\..\src\locale\SDL_locale.c" />
    7.24 +    <ClCompile Include="..\..\src\locale\winrt\SDL_syslocale.c" />
    7.25      <ClCompile Include="..\..\src\sensor\dummy\SDL_dummysensor.c" />
    7.26      <ClCompile Include="..\..\src\sensor\SDL_sensor.c" />
    7.27      <ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
     8.1 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters	Wed May 06 12:19:58 2020 -0700
     8.2 +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters	Mon May 04 02:27:29 2020 -0400
     8.3 @@ -84,6 +84,9 @@
     8.4      <ClInclude Include="..\..\include\SDL_loadso.h">
     8.5        <Filter>Header Files</Filter>
     8.6      </ClInclude>
     8.7 +    <ClInclude Include="..\..\include\SDL_locale.h">
     8.8 +      <Filter>Header Files</Filter>
     8.9 +    </ClInclude>
    8.10      <ClInclude Include="..\..\include\SDL_log.h">
    8.11        <Filter>Header Files</Filter>
    8.12      </ClInclude>
    8.13 @@ -306,6 +309,9 @@
    8.14      <ClInclude Include="..\..\src\SDL_internal.h">
    8.15        <Filter>Source Files</Filter>
    8.16      </ClInclude>
    8.17 +    <ClInclude Include="..\..\src\locale\SDL_syslocale.h">
    8.18 +      <Filter>Source Files</Filter>
    8.19 +    </ClInclude>
    8.20      <ClInclude Include="..\..\src\thread\SDL_systhread.h">
    8.21        <Filter>Source Files</Filter>
    8.22      </ClInclude>
    8.23 @@ -578,6 +584,12 @@
    8.24      <ClCompile Include="..\..\src\SDL_log.c">
    8.25        <Filter>Source Files</Filter>
    8.26      </ClCompile>
    8.27 +    <ClCompile Include="..\..\src\locale\SDL_locale.c">
    8.28 +      <Filter>Source Files</Filter>
    8.29 +    </ClCompile>
    8.30 +    <ClCompile Include="..\..\src\locale\winrt\SDL_syslocale.c">
    8.31 +      <Filter>Source Files</Filter>
    8.32 +    </ClCompile>
    8.33      <ClCompile Include="..\..\src\stdlib\SDL_getenv.c">
    8.34        <Filter>Source Files</Filter>
    8.35      </ClCompile>
     9.1 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj	Wed May 06 12:19:58 2020 -0700
     9.2 +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj	Mon May 04 02:27:29 2020 -0400
     9.3 @@ -52,6 +52,7 @@
     9.4      <ClInclude Include="..\..\include\SDL_keyboard.h" />
     9.5      <ClInclude Include="..\..\include\SDL_keycode.h" />
     9.6      <ClInclude Include="..\..\include\SDL_loadso.h" />
     9.7 +    <ClInclude Include="..\..\include\SDL_locale.h" />
     9.8      <ClInclude Include="..\..\include\SDL_log.h" />
     9.9      <ClInclude Include="..\..\include\SDL_main.h" />
    9.10      <ClInclude Include="..\..\include\SDL_mouse.h" />
    9.11 @@ -139,6 +140,7 @@
    9.12      <ClInclude Include="..\..\src\SDL_fatal.h" />
    9.13      <ClInclude Include="..\..\src\SDL_hints_c.h" />
    9.14      <ClInclude Include="..\..\src\SDL_internal.h" />
    9.15 +    <ClInclude Include="..\..\src\locale\SDL_syslocale.h" />
    9.16      <ClInclude Include="..\..\src\sensor\dummy\SDL_dummysensor.h" />
    9.17      <ClInclude Include="..\..\src\sensor\SDL_sensor_c.h" />
    9.18      <ClInclude Include="..\..\src\sensor\SDL_syssensor.h" />
    9.19 @@ -277,6 +279,8 @@
    9.20      <ClCompile Include="..\..\src\SDL_error.c" />
    9.21      <ClCompile Include="..\..\src\SDL_hints.c" />
    9.22      <ClCompile Include="..\..\src\SDL_log.c" />
    9.23 +    <ClInclude Include="..\..\src\locale\SDL_locale.c" />
    9.24 +    <ClInclude Include="..\..\src\locale\winrt\SDL_syslocale.c" />
    9.25      <ClCompile Include="..\..\src\sensor\dummy\SDL_dummysensor.c" />
    9.26      <ClCompile Include="..\..\src\sensor\SDL_sensor.c" />
    9.27      <ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
    10.1 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters	Wed May 06 12:19:58 2020 -0700
    10.2 +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters	Mon May 04 02:27:29 2020 -0400
    10.3 @@ -84,6 +84,9 @@
    10.4      <ClInclude Include="..\..\include\SDL_loadso.h">
    10.5        <Filter>Header Files</Filter>
    10.6      </ClInclude>
    10.7 +    <ClInclude Include="..\..\include\SDL_locale.h">
    10.8 +      <Filter>Header Files</Filter>
    10.9 +    </ClInclude>
   10.10      <ClInclude Include="..\..\include\SDL_log.h">
   10.11        <Filter>Header Files</Filter>
   10.12      </ClInclude>
   10.13 @@ -306,6 +309,9 @@
   10.14      <ClInclude Include="..\..\src\SDL_internal.h">
   10.15        <Filter>Source Files</Filter>
   10.16      </ClInclude>
   10.17 +    <ClInclude Include="..\..\src\locale\SDL_syslocale.h">
   10.18 +      <Filter>Source Files</Filter>
   10.19 +    </ClInclude>
   10.20      <ClInclude Include="..\..\src\thread\SDL_thread_c.h">
   10.21        <Filter>Source Files</Filter>
   10.22      </ClInclude>
   10.23 @@ -596,6 +602,12 @@
   10.24      <ClCompile Include="..\..\src\SDL_log.c">
   10.25        <Filter>Source Files</Filter>
   10.26      </ClCompile>
   10.27 +    <ClCompile Include="..\..\src\locale\SDL_locale.c">
   10.28 +      <Filter>Source Files</Filter>
   10.29 +    </ClCompile>
   10.30 +    <ClCompile Include="..\..\src\locale\winrt\SDL_syslocale.c">
   10.31 +      <Filter>Source Files</Filter>
   10.32 +    </ClCompile>
   10.33      <ClCompile Include="..\..\src\stdlib\SDL_getenv.c">
   10.34        <Filter>Source Files</Filter>
   10.35      </ClCompile>
    11.1 --- a/VisualC/SDL/SDL.vcxproj	Wed May 06 12:19:58 2020 -0700
    11.2 +++ b/VisualC/SDL/SDL.vcxproj	Mon May 04 02:27:29 2020 -0400
    11.3 @@ -239,6 +239,7 @@
    11.4      <ClInclude Include="..\..\include\SDL_keyboard.h" />
    11.5      <ClInclude Include="..\..\include\SDL_keycode.h" />
    11.6      <ClInclude Include="..\..\include\SDL_loadso.h" />
    11.7 +    <ClInclude Include="..\..\include\SDL_locale.h" />
    11.8      <ClInclude Include="..\..\include\SDL_log.h" />
    11.9      <ClInclude Include="..\..\include\SDL_main.h" />
   11.10      <ClInclude Include="..\..\include\SDL_messagebox.h" />
   11.11 @@ -331,6 +332,7 @@
   11.12      <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
   11.13      <ClInclude Include="..\..\src\libm\math_libm.h" />
   11.14      <ClInclude Include="..\..\src\libm\math_private.h" />
   11.15 +    <ClInclude Include="..\..\src\locale\SDL_syslocale.h" />
   11.16      <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
   11.17      <ClInclude Include="..\..\src\render\direct3d\SDL_shaders_d3d.h" />
   11.18      <ClInclude Include="..\..\src\render\opengl\SDL_glfuncs.h" />
   11.19 @@ -463,6 +465,8 @@
   11.20      <ClCompile Include="..\..\src\libm\s_sin.c" />
   11.21      <ClCompile Include="..\..\src\libm\s_tan.c" />
   11.22      <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
   11.23 +    <ClCompile Include="..\..\src\locale\SDL_locale.c" />
   11.24 +    <ClCompile Include="..\..\src\locale\windows\SDL_syslocale.c" />
   11.25      <ClCompile Include="..\..\src\power\SDL_power.c" />
   11.26      <ClCompile Include="..\..\src\power\windows\SDL_syspower.c" />
   11.27      <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
    12.1 --- a/VisualC/SDL/SDL.vcxproj.filters	Wed May 06 12:19:58 2020 -0700
    12.2 +++ b/VisualC/SDL/SDL.vcxproj.filters	Mon May 04 02:27:29 2020 -0400
    12.3 @@ -84,6 +84,9 @@
    12.4      <ClInclude Include="..\..\include\SDL_loadso.h">
    12.5        <Filter>API Headers</Filter>
    12.6      </ClInclude>
    12.7 +    <ClInclude Include="..\..\include\SDL_locale.h">
    12.8 +      <Filter>API Headers</Filter>
    12.9 +    </ClInclude>
   12.10      <ClInclude Include="..\..\include\SDL_log.h">
   12.11        <Filter>API Headers</Filter>
   12.12      </ClInclude>
   12.13 @@ -269,6 +272,7 @@
   12.14      <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
   12.15      <ClInclude Include="..\..\src\libm\math_libm.h" />
   12.16      <ClInclude Include="..\..\src\libm\math_private.h" />
   12.17 +    <ClInclude Include="..\..\src\locale\SDL_syslocale.h" />
   12.18      <ClInclude Include="..\..\src\render\direct3d\SDL_shaders_d3d.h" />
   12.19      <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
   12.20      <ClInclude Include="..\..\src\render\opengl\SDL_glfuncs.h" />
   12.21 @@ -401,6 +405,8 @@
   12.22      <ClCompile Include="..\..\src\libm\s_sin.c" />
   12.23      <ClCompile Include="..\..\src\libm\s_tan.c" />
   12.24      <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
   12.25 +    <ClCompile Include="..\..\src\locale\SDL_locale.c" />
   12.26 +    <ClCompile Include="..\..\src\locale\windows\SDL_syslocale.c" />
   12.27      <ClCompile Include="..\..\src\power\SDL_power.c" />
   12.28      <ClCompile Include="..\..\src\power\windows\SDL_syspower.c" />
   12.29      <ClCompile Include="..\..\src\render\direct3d\SDL_render_d3d.c" />
    13.1 --- a/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Wed May 06 12:19:58 2020 -0700
    13.2 +++ b/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Mon May 04 02:27:29 2020 -0400
    13.3 @@ -343,6 +343,22 @@
    13.4  		55FFA91A2122302B00D7CBED /* SDL_syspower.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FFA9192122302B00D7CBED /* SDL_syspower.h */; };
    13.5  		566726451DF72CF5001DD3DB /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */; };
    13.6  		566726461DF72CF5001DD3DB /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 566726441DF72CF5001DD3DB /* SDL_dataqueue.h */; };
    13.7 +		566E26EE2462770300718109 /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26ED2462770300718109 /* SDL_locale.h */; };
    13.8 +		566E26EF2462770300718109 /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26ED2462770300718109 /* SDL_locale.h */; };
    13.9 +		566E26F02462770300718109 /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26ED2462770300718109 /* SDL_locale.h */; };
   13.10 +		566E26F12462770300718109 /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26ED2462770300718109 /* SDL_locale.h */; };
   13.11 +		566E26F22462770300718109 /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26ED2462770300718109 /* SDL_locale.h */; };
   13.12 +		566E26F82462774E00718109 /* SDL_syslocale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26F42462774E00718109 /* SDL_syslocale.h */; };
   13.13 +		566E26F92462774E00718109 /* SDL_syslocale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26F42462774E00718109 /* SDL_syslocale.h */; };
   13.14 +		566E26FA2462774E00718109 /* SDL_syslocale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26F42462774E00718109 /* SDL_syslocale.h */; };
   13.15 +		566E26FD2462774E00718109 /* SDL_syslocale.m in Sources */ = {isa = PBXBuildFile; fileRef = 566E26F62462774E00718109 /* SDL_syslocale.m */; };
   13.16 +		566E26FE2462774E00718109 /* SDL_syslocale.m in Sources */ = {isa = PBXBuildFile; fileRef = 566E26F62462774E00718109 /* SDL_syslocale.m */; };
   13.17 +		566E26FF2462774E00718109 /* SDL_syslocale.m in Sources */ = {isa = PBXBuildFile; fileRef = 566E26F62462774E00718109 /* SDL_syslocale.m */; };
   13.18 +		566E27002462774E00718109 /* SDL_syslocale.m in Sources */ = {isa = PBXBuildFile; fileRef = 566E26F62462774E00718109 /* SDL_syslocale.m */; };
   13.19 +		566E27032462774E00718109 /* SDL_locale.c in Sources */ = {isa = PBXBuildFile; fileRef = 566E26F72462774E00718109 /* SDL_locale.c */; };
   13.20 +		566E27042462774E00718109 /* SDL_locale.c in Sources */ = {isa = PBXBuildFile; fileRef = 566E26F72462774E00718109 /* SDL_locale.c */; };
   13.21 +		566E27052462774E00718109 /* SDL_locale.c in Sources */ = {isa = PBXBuildFile; fileRef = 566E26F72462774E00718109 /* SDL_locale.c */; };
   13.22 +		566E27062462774E00718109 /* SDL_locale.c in Sources */ = {isa = PBXBuildFile; fileRef = 566E26F72462774E00718109 /* SDL_locale.c */; };
   13.23  		56A6702E18565E450007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6702D18565E450007D20F /* SDL_internal.h */; };
   13.24  		56A6703518565E760007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703118565E760007D20F /* SDL_dynapi_overrides.h */; };
   13.25  		56A6703618565E760007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703218565E760007D20F /* SDL_dynapi_procs.h */; };
   13.26 @@ -982,6 +998,10 @@
   13.27  		55FFA9192122302B00D7CBED /* SDL_syspower.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syspower.h; sourceTree = "<group>"; };
   13.28  		566726431DF72CF5001DD3DB /* SDL_dataqueue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dataqueue.c; sourceTree = "<group>"; };
   13.29  		566726441DF72CF5001DD3DB /* SDL_dataqueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dataqueue.h; sourceTree = "<group>"; };
   13.30 +		566E26ED2462770300718109 /* SDL_locale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_locale.h; sourceTree = "<group>"; };
   13.31 +		566E26F42462774E00718109 /* SDL_syslocale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_syslocale.h; path = locale/SDL_syslocale.h; sourceTree = "<group>"; };
   13.32 +		566E26F62462774E00718109 /* SDL_syslocale.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_syslocale.m; sourceTree = "<group>"; };
   13.33 +		566E26F72462774E00718109 /* SDL_locale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_locale.c; path = locale/SDL_locale.c; sourceTree = "<group>"; };
   13.34  		56A6702D18565E450007D20F /* SDL_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_internal.h; sourceTree = "<group>"; };
   13.35  		56A6703118565E760007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dynapi_overrides.h; sourceTree = "<group>"; };
   13.36  		56A6703218565E760007D20F /* SDL_dynapi_procs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dynapi_procs.h; sourceTree = "<group>"; };
   13.37 @@ -1384,6 +1404,25 @@
   13.38  			name = Frameworks;
   13.39  			sourceTree = "<group>";
   13.40  		};
   13.41 +		566E26F32462773A00718109 /* locale */ = {
   13.42 +			isa = PBXGroup;
   13.43 +			children = (
   13.44 +				566E26F52462774E00718109 /* macosx */,
   13.45 +				566E26F72462774E00718109 /* SDL_locale.c */,
   13.46 +				566E26F42462774E00718109 /* SDL_syslocale.h */,
   13.47 +			);
   13.48 +			name = locale;
   13.49 +			sourceTree = "<group>";
   13.50 +		};
   13.51 +		566E26F52462774E00718109 /* macosx */ = {
   13.52 +			isa = PBXGroup;
   13.53 +			children = (
   13.54 +				566E26F62462774E00718109 /* SDL_syslocale.m */,
   13.55 +			);
   13.56 +			name = macosx;
   13.57 +			path = locale/macosx;
   13.58 +			sourceTree = "<group>";
   13.59 +		};
   13.60  		56A6702F18565E4F0007D20F /* dynapi */ = {
   13.61  			isa = PBXGroup;
   13.62  			children = (
   13.63 @@ -1656,6 +1695,7 @@
   13.64  				AA7558781595D55500BBD41B /* SDL_keyboard.h */,
   13.65  				AA7558791595D55500BBD41B /* SDL_keycode.h */,
   13.66  				AA75587A1595D55500BBD41B /* SDL_loadso.h */,
   13.67 +				566E26ED2462770300718109 /* SDL_locale.h */,
   13.68  				AA75587B1595D55500BBD41B /* SDL_log.h */,
   13.69  				AA75587C1595D55500BBD41B /* SDL_main.h */,
   13.70  				AA9FF9501637C6E5000DF050 /* SDL_messagebox.h */,
   13.71 @@ -1708,6 +1748,7 @@
   13.72  				F35CEA6E20F51B7F003ECE98 /* hidapi */,
   13.73  				FD5F9D080E0E08B3008E885B /* joystick */,
   13.74  				FD8BD8150E27E25900B52CD5 /* loadso */,
   13.75 +				566E26F32462773A00718109 /* locale */,
   13.76  				F3E3C65322406963007D243C /* main */,
   13.77  				56ED04DE118A8E9A00A56AA6 /* power */,
   13.78  				041B2CE312FA0F680087D585 /* render */,
   13.79 @@ -1968,9 +2009,11 @@
   13.80  				52ED1DA2222889500061FCE0 /* SDL_audio.h in Headers */,
   13.81  				52ED1DA3222889500061FCE0 /* SDL_syspower.h in Headers */,
   13.82  				52ED1DA4222889500061FCE0 /* SDL_blendmode.h in Headers */,
   13.83 +				566E26F92462774E00718109 /* SDL_syslocale.h in Headers */,
   13.84  				52ED1DA5222889500061FCE0 /* SDL_sensor_c.h in Headers */,
   13.85  				52ED1DA6222889500061FCE0 /* SDL_clipboard.h in Headers */,
   13.86  				52ED1DA7222889500061FCE0 /* SDL_config_iphoneos.h in Headers */,
   13.87 +				566E26EF2462770300718109 /* SDL_locale.h in Headers */,
   13.88  				52ED1DA8222889500061FCE0 /* SDL_config.h in Headers */,
   13.89  				52ED1DA9222889500061FCE0 /* SDL_copying.h in Headers */,
   13.90  				52ED1DAA222889500061FCE0 /* SDL_egl_c.h in Headers */,
   13.91 @@ -2043,6 +2086,7 @@
   13.92  			isa = PBXHeadersBuildPhase;
   13.93  			buildActionMask = 2147483647;
   13.94  			files = (
   13.95 +				566E26F12462770300718109 /* SDL_locale.h in Headers */,
   13.96  			);
   13.97  			runOnlyForDeploymentPostprocessing = 0;
   13.98  		};
   13.99 @@ -2106,9 +2150,11 @@
  13.100  				F3E3C6902241389A007D243C /* SDL_audio.h in Headers */,
  13.101  				F3E3C6912241389A007D243C /* SDL_syspower.h in Headers */,
  13.102  				F3E3C6922241389A007D243C /* SDL_blendmode.h in Headers */,
  13.103 +				566E26FA2462774E00718109 /* SDL_syslocale.h in Headers */,
  13.104  				F3E3C6932241389A007D243C /* SDL_sensor_c.h in Headers */,
  13.105  				F3E3C6942241389A007D243C /* SDL_clipboard.h in Headers */,
  13.106  				F3E3C6952241389A007D243C /* SDL_config_iphoneos.h in Headers */,
  13.107 +				566E26F02462770300718109 /* SDL_locale.h in Headers */,
  13.108  				F3E3C6962241389A007D243C /* SDL_config.h in Headers */,
  13.109  				F3E3C6972241389A007D243C /* SDL_copying.h in Headers */,
  13.110  				F3E3C6982241389A007D243C /* SDL_egl_c.h in Headers */,
  13.111 @@ -2181,6 +2227,7 @@
  13.112  			isa = PBXHeadersBuildPhase;
  13.113  			buildActionMask = 2147483647;
  13.114  			files = (
  13.115 +				566E26F22462770300718109 /* SDL_locale.h in Headers */,
  13.116  			);
  13.117  			runOnlyForDeploymentPostprocessing = 0;
  13.118  		};
  13.119 @@ -2260,6 +2307,7 @@
  13.120  				AA7558A61595D55500BBD41B /* SDL_gesture.h in Headers */,
  13.121  				AA7558A71595D55500BBD41B /* SDL_haptic.h in Headers */,
  13.122  				AA7558A81595D55500BBD41B /* SDL_hints.h in Headers */,
  13.123 +				566E26F82462774E00718109 /* SDL_syslocale.h in Headers */,
  13.124  				566726461DF72CF5001DD3DB /* SDL_dataqueue.h in Headers */,
  13.125  				F30D9C9F212CD0990047DF2E /* SDL_syssensor.h in Headers */,
  13.126  				AA7558AA1595D55500BBD41B /* SDL_joystick.h in Headers */,
  13.127 @@ -2290,6 +2338,7 @@
  13.128  				AA7558BE1595D55500BBD41B /* SDL_scancode.h in Headers */,
  13.129  				AA7558BF1595D55500BBD41B /* SDL_shape.h in Headers */,
  13.130  				AA7558C01595D55500BBD41B /* SDL_stdinc.h in Headers */,
  13.131 +				566E26EE2462770300718109 /* SDL_locale.h in Headers */,
  13.132  				FAD4F7021BA3C4E8008346CE /* SDL_sysjoystick_c.h in Headers */,
  13.133  				AA7558C11595D55500BBD41B /* SDL_surface.h in Headers */,
  13.134  				AA7558C21595D55500BBD41B /* SDL_system.h in Headers */,
  13.135 @@ -2539,6 +2588,7 @@
  13.136  				52ED1DFC222889500061FCE0 /* SDL_rwops.c in Sources */,
  13.137  				52ED1DFD222889500061FCE0 /* hid.m in Sources */,
  13.138  				52ED1DFE222889500061FCE0 /* SDL_vulkan_utils.c in Sources */,
  13.139 +				566E27042462774E00718109 /* SDL_locale.c in Sources */,
  13.140  				52ED1DFF222889500061FCE0 /* SDL_error.c in Sources */,
  13.141  				52ED1E00222889500061FCE0 /* SDL.c in Sources */,
  13.142  				52ED1E01222889500061FCE0 /* SDL_syscond.c in Sources */,
  13.143 @@ -2550,6 +2600,7 @@
  13.144  				52ED1E07222889500061FCE0 /* SDL_getenv.c in Sources */,
  13.145  				52ED1E08222889500061FCE0 /* SDL_iconv.c in Sources */,
  13.146  				52ED1E09222889500061FCE0 /* SDL_malloc.c in Sources */,
  13.147 +				566E26FE2462774E00718109 /* SDL_syslocale.m in Sources */,
  13.148  				A7FF6B6323AC3BC6005876C6 /* SDL_hidapi_gamecube.c in Sources */,
  13.149  				52ED1E0A222889500061FCE0 /* SDL_hidapi_xbox360.c in Sources */,
  13.150  				52ED1E0B222889500061FCE0 /* SDL_qsort.c in Sources */,
  13.151 @@ -2673,6 +2724,7 @@
  13.152  				F3E3C6EA2241389A007D243C /* SDL_rwops.c in Sources */,
  13.153  				F3E3C6EB2241389A007D243C /* hid.m in Sources */,
  13.154  				F3E3C6EC2241389A007D243C /* SDL_vulkan_utils.c in Sources */,
  13.155 +				566E27062462774E00718109 /* SDL_locale.c in Sources */,
  13.156  				F3E3C6ED2241389A007D243C /* SDL_error.c in Sources */,
  13.157  				F3E3C6EE2241389A007D243C /* SDL.c in Sources */,
  13.158  				F3E3C6EF2241389A007D243C /* SDL_syscond.c in Sources */,
  13.159 @@ -2684,6 +2736,7 @@
  13.160  				F3E3C6F52241389A007D243C /* SDL_getenv.c in Sources */,
  13.161  				F3E3C6F62241389A007D243C /* SDL_iconv.c in Sources */,
  13.162  				F3E3C6F72241389A007D243C /* SDL_malloc.c in Sources */,
  13.163 +				566E27002462774E00718109 /* SDL_syslocale.m in Sources */,
  13.164  				A7FF6B6523AC3BC6005876C6 /* SDL_hidapi_gamecube.c in Sources */,
  13.165  				F3E3C6F82241389A007D243C /* SDL_hidapi_xbox360.c in Sources */,
  13.166  				F3E3C6F92241389A007D243C /* SDL_qsort.c in Sources */,
  13.167 @@ -2847,7 +2900,9 @@
  13.168  				FAB598731BB5C31600BE72C5 /* SDL_iconv.c in Sources */,
  13.169  				FAB598741BB5C31600BE72C5 /* SDL_malloc.c in Sources */,
  13.170  				FAB598751BB5C31600BE72C5 /* SDL_qsort.c in Sources */,
  13.171 +				566E27052462774E00718109 /* SDL_locale.c in Sources */,
  13.172  				F36839CE214790950000F255 /* SDL_dummysensor.c in Sources */,
  13.173 +				566E26FF2462774E00718109 /* SDL_syslocale.m in Sources */,
  13.174  				A7C19D2B212E552C00DF2152 /* SDL_displayevents.c in Sources */,
  13.175  				FAB598761BB5C31600BE72C5 /* SDL_stdlib.c in Sources */,
  13.176  				FAB598771BB5C31600BE72C5 /* SDL_string.c in Sources */,
  13.177 @@ -2931,6 +2986,7 @@
  13.178  				FD6526760DE8FCDD002AD96B /* SDL_rwops.c in Sources */,
  13.179  				F30D9CC6212CE92C0047DF2E /* hid.m in Sources */,
  13.180  				4D7517201EE1D98200820EEA /* SDL_vulkan_utils.c in Sources */,
  13.181 +				566E27032462774E00718109 /* SDL_locale.c in Sources */,
  13.182  				FD6526780DE8FCDD002AD96B /* SDL_error.c in Sources */,
  13.183  				FD65267A0DE8FCDD002AD96B /* SDL.c in Sources */,
  13.184  				FD65267B0DE8FCDD002AD96B /* SDL_syscond.c in Sources */,
  13.185 @@ -2942,6 +2998,7 @@
  13.186  				FD3F4A760DEA620800C5B771 /* SDL_getenv.c in Sources */,
  13.187  				FD3F4A770DEA620800C5B771 /* SDL_iconv.c in Sources */,
  13.188  				FD3F4A780DEA620800C5B771 /* SDL_malloc.c in Sources */,
  13.189 +				566E26FD2462774E00718109 /* SDL_syslocale.m in Sources */,
  13.190  				A7FF6B6223AC3BC6005876C6 /* SDL_hidapi_gamecube.c in Sources */,
  13.191  				F3BDD79220F51CB8004ECBF3 /* SDL_hidapi_xbox360.c in Sources */,
  13.192  				FD3F4A790DEA620800C5B771 /* SDL_qsort.c in Sources */,
    14.1 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Wed May 06 12:19:58 2020 -0700
    14.2 +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Mon May 04 02:27:29 2020 -0400
    14.3 @@ -17,6 +17,10 @@
    14.4  		564624381FF821DA0074AC87 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624371FF821CB0074AC87 /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
    14.5  		5646243B1FF822100074AC87 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624351FF821B80074AC87 /* QuartzCore.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
    14.6  		5646243C1FF822170074AC87 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624371FF821CB0074AC87 /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
    14.7 +		566E267A2462701100718109 /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; };
    14.8 +		566E26CF246274CC00718109 /* SDL_syslocale.m in Sources */ = {isa = PBXBuildFile; fileRef = 566E26CC246274CB00718109 /* SDL_syslocale.m */; };
    14.9 +		566E26D8246274CC00718109 /* SDL_locale.c in Sources */ = {isa = PBXBuildFile; fileRef = 566E26CD246274CB00718109 /* SDL_locale.c */; };
   14.10 +		566E26E1246274CC00718109 /* SDL_syslocale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26CE246274CC00718109 /* SDL_syslocale.h */; };
   14.11  		567E2F2117C44C35005F1892 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 567E2F2017C44C35005F1892 /* SDL_filesystem.h */; settings = {ATTRIBUTES = (Public, ); }; };
   14.12  		56C5237F1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; };
   14.13  		56C523811D8F498C001F2F30 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; };
   14.14 @@ -3983,6 +3987,10 @@
   14.15  		4D4820431F0F10B400EDC31C /* SDL_vulkan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_vulkan.h; sourceTree = "<group>"; };
   14.16  		564624351FF821B80074AC87 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
   14.17  		564624371FF821CB0074AC87 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
   14.18 +		566E26792462701100718109 /* SDL_locale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_locale.h; sourceTree = "<group>"; };
   14.19 +		566E26CC246274CB00718109 /* SDL_syslocale.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_syslocale.m; path = locale/macosx/SDL_syslocale.m; sourceTree = "<group>"; };
   14.20 +		566E26CD246274CB00718109 /* SDL_locale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_locale.c; path = locale/SDL_locale.c; sourceTree = "<group>"; };
   14.21 +		566E26CE246274CC00718109 /* SDL_syslocale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_syslocale.h; path = locale/SDL_syslocale.h; sourceTree = "<group>"; };
   14.22  		567E2F2017C44C35005F1892 /* SDL_filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_filesystem.h; sourceTree = "<group>"; };
   14.23  		5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl.h; sourceTree = "<group>"; };
   14.24  		75E09158241EA924004729E1 /* SDL_virtualjoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_virtualjoystick.c; sourceTree = "<group>"; };
   14.25 @@ -4662,6 +4670,7 @@
   14.26  				AA7557DA1595D4D800BBD41B /* SDL_keyboard.h */,
   14.27  				AA7557DB1595D4D800BBD41B /* SDL_keycode.h */,
   14.28  				AA7557DC1595D4D800BBD41B /* SDL_loadso.h */,
   14.29 +				566E26792462701100718109 /* SDL_locale.h */,
   14.30  				AA7557DD1595D4D800BBD41B /* SDL_log.h */,
   14.31  				AA7557DE1595D4D800BBD41B /* SDL_main.h */,
   14.32  				AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */,
   14.33 @@ -4760,6 +4769,7 @@
   14.34  				A7D8A79D23E2513E00DCD162 /* joystick */,
   14.35  				A7D8A91123E2514000DCD162 /* libm */,
   14.36  				A7D8A85D23E2513F00DCD162 /* loadso */,
   14.37 +				566E26CB246274AE00718109 /* locale */,
   14.38  				A7D8A5AC23E2513D00DCD162 /* main */,
   14.39  				A7D8A7DF23E2513F00DCD162 /* power */,
   14.40  				A7D8A8DA23E2514000DCD162 /* render */,
   14.41 @@ -4826,6 +4836,24 @@
   14.42  			name = Frameworks;
   14.43  			sourceTree = "<group>";
   14.44  		};
   14.45 +		566E26CB246274AE00718109 /* locale */ = {
   14.46 +			isa = PBXGroup;
   14.47 +			children = (
   14.48 +				566E26EA246274E800718109 /* macosx */,
   14.49 +				566E26CD246274CB00718109 /* SDL_locale.c */,
   14.50 +				566E26CE246274CC00718109 /* SDL_syslocale.h */,
   14.51 +			);
   14.52 +			name = locale;
   14.53 +			sourceTree = "<group>";
   14.54 +		};
   14.55 +		566E26EA246274E800718109 /* macosx */ = {
   14.56 +			isa = PBXGroup;
   14.57 +			children = (
   14.58 +				566E26CC246274CB00718109 /* SDL_syslocale.m */,
   14.59 +			);
   14.60 +			name = macosx;
   14.61 +			sourceTree = "<group>";
   14.62 +		};
   14.63  		75E09157241EA924004729E1 /* virtual */ = {
   14.64  			isa = PBXGroup;
   14.65  			children = (
   14.66 @@ -5734,6 +5762,7 @@
   14.67  				A75FCD2323E25AB700529352 /* SDL_uikitmessagebox.h in Headers */,
   14.68  				A75FCD2423E25AB700529352 /* SDL_x11messagebox.h in Headers */,
   14.69  				A75FCD2523E25AB700529352 /* SDL_thread_c.h in Headers */,
   14.70 +				566E26812462701100718109 /* SDL_locale.h in Headers */,
   14.71  				A75FCD2623E25AB700529352 /* SDL_cocoamessagebox.h in Headers */,
   14.72  				A75FCD2723E25AB700529352 /* SDL_x11shape.h in Headers */,
   14.73  				A75FCD2823E25AB700529352 /* SDL_cpuinfo.h in Headers */,
   14.74 @@ -5816,6 +5845,7 @@
   14.75  				A75FCD7323E25AB700529352 /* SDL_yuv_c.h in Headers */,
   14.76  				A75FCD7423E25AB700529352 /* scancodes_xfree86.h in Headers */,
   14.77  				A75FCD7523E25AB700529352 /* SDL_syspower.h in Headers */,
   14.78 +				566E26E8246274CC00718109 /* SDL_syslocale.h in Headers */,
   14.79  				A75FDAFA23E35ED600529352 /* SDL_config_iphoneos.h in Headers */,
   14.80  				A75FCD7623E25AB700529352 /* SDL_x11clipboard.h in Headers */,
   14.81  				A75FCD7723E25AB700529352 /* SDL_name.h in Headers */,
   14.82 @@ -5975,6 +6005,7 @@
   14.83  				A75FCEDC23E25AC700529352 /* SDL_uikitmessagebox.h in Headers */,
   14.84  				A75FCEDD23E25AC700529352 /* SDL_x11messagebox.h in Headers */,
   14.85  				A75FCEDE23E25AC700529352 /* SDL_thread_c.h in Headers */,
   14.86 +				566E26822462701100718109 /* SDL_locale.h in Headers */,
   14.87  				A75FCEDF23E25AC700529352 /* SDL_cocoamessagebox.h in Headers */,
   14.88  				A75FCEE023E25AC700529352 /* SDL_x11shape.h in Headers */,
   14.89  				A75FCEE123E25AC700529352 /* SDL_cpuinfo.h in Headers */,
   14.90 @@ -6057,6 +6088,7 @@
   14.91  				A75FCF2C23E25AC700529352 /* SDL_yuv_c.h in Headers */,
   14.92  				A75FCF2D23E25AC700529352 /* scancodes_xfree86.h in Headers */,
   14.93  				A75FCF2E23E25AC700529352 /* SDL_syspower.h in Headers */,
   14.94 +				566E26E9246274CC00718109 /* SDL_syslocale.h in Headers */,
   14.95  				A75FDAFB23E35ED700529352 /* SDL_config_iphoneos.h in Headers */,
   14.96  				A75FCF2F23E25AC700529352 /* SDL_x11clipboard.h in Headers */,
   14.97  				A75FCF3023E25AC700529352 /* SDL_name.h in Headers */,
   14.98 @@ -6240,6 +6272,7 @@
   14.99  				A769B0AA23E259AE00872273 /* SDL_uikitmessagebox.h in Headers */,
  14.100  				A769B0AB23E259AE00872273 /* SDL_x11messagebox.h in Headers */,
  14.101  				A769B0AC23E259AE00872273 /* SDL_thread_c.h in Headers */,
  14.102 +				566E267F2462701100718109 /* SDL_locale.h in Headers */,
  14.103  				A769B0AD23E259AE00872273 /* SDL_cocoamessagebox.h in Headers */,
  14.104  				A769B0AE23E259AE00872273 /* SDL_x11shape.h in Headers */,
  14.105  				A769B0AF23E259AE00872273 /* SDL_cpuinfo.h in Headers */,
  14.106 @@ -6322,6 +6355,7 @@
  14.107  				A769B0FB23E259AE00872273 /* SDL_yuv_c.h in Headers */,
  14.108  				A769B0FC23E259AE00872273 /* scancodes_xfree86.h in Headers */,
  14.109  				A769B0FD23E259AE00872273 /* SDL_syspower.h in Headers */,
  14.110 +				566E26E6246274CC00718109 /* SDL_syslocale.h in Headers */,
  14.111  				A75FDAF923E35ED500529352 /* SDL_config_iphoneos.h in Headers */,
  14.112  				A769B0FE23E259AE00872273 /* SDL_x11clipboard.h in Headers */,
  14.113  				A769B0FF23E259AE00872273 /* SDL_name.h in Headers */,
  14.114 @@ -6638,10 +6672,12 @@
  14.115  				A7D8B39923E2514200DCD162 /* SDL_blit_copy.h in Headers */,
  14.116  				A7D8B22B23E2514200DCD162 /* gl2.h in Headers */,
  14.117  				A7D88A5023E2437C00DCD162 /* SDL_shape.h in Headers */,
  14.118 +				566E26E2246274CC00718109 /* SDL_syslocale.h in Headers */,
  14.119  				A7D88A5123E2437C00DCD162 /* SDL_stdinc.h in Headers */,
  14.120  				A7D8ACCA23E2514100DCD162 /* SDL_uikitappdelegate.h in Headers */,
  14.121  				A7D8BBB823E254E400DCD162 /* SDL_sysjoystick_c.h in Headers */,
  14.122  				A7D8B3B123E2514200DCD162 /* SDL_yuv_c.h in Headers */,
  14.123 +				566E267B2462701100718109 /* SDL_locale.h in Headers */,
  14.124  				A7D8B1F523E2514200DCD162 /* SDL_x11dyn.h in Headers */,
  14.125  				A7D8AC8823E2514100DCD162 /* SDL_uikitviewcontroller.h in Headers */,
  14.126  				A7D8AC0A23E2514100DCD162 /* SDL_shape_internals.h in Headers */,
  14.127 @@ -6882,10 +6918,12 @@
  14.128  				A7D88C0823E24BED00DCD162 /* SDL_scancode.h in Headers */,
  14.129  				A7D8B39A23E2514200DCD162 /* SDL_blit_copy.h in Headers */,
  14.130  				A7D8B22C23E2514200DCD162 /* gl2.h in Headers */,
  14.131 +				566E26E3246274CC00718109 /* SDL_syslocale.h in Headers */,
  14.132  				A7D88C0A23E24BED00DCD162 /* SDL_shape.h in Headers */,
  14.133  				A7D88C0C23E24BED00DCD162 /* SDL_stdinc.h in Headers */,
  14.134  				A7D8ACCB23E2514100DCD162 /* SDL_uikitappdelegate.h in Headers */,
  14.135  				A7D8B3B223E2514200DCD162 /* SDL_yuv_c.h in Headers */,
  14.136 +				566E267C2462701100718109 /* SDL_locale.h in Headers */,
  14.137  				A7D8B1F623E2514200DCD162 /* SDL_x11dyn.h in Headers */,
  14.138  				A7D8AC8923E2514100DCD162 /* SDL_uikitviewcontroller.h in Headers */,
  14.139  				A7D8AC0B23E2514100DCD162 /* SDL_shape_internals.h in Headers */,
  14.140 @@ -6969,6 +7007,7 @@
  14.141  				A7D8AC9723E2514100DCD162 /* SDL_uikitmessagebox.h in Headers */,
  14.142  				A7D8B15023E2514200DCD162 /* SDL_x11messagebox.h in Headers */,
  14.143  				A7D8B3F023E2514300DCD162 /* SDL_thread_c.h in Headers */,
  14.144 +				566E267E2462701100718109 /* SDL_locale.h in Headers */,
  14.145  				A7D8AF0A23E2514100DCD162 /* SDL_cocoamessagebox.h in Headers */,
  14.146  				A7D8B16823E2514200DCD162 /* SDL_x11shape.h in Headers */,
  14.147  				A7D88D2723E24D3B00DCD162 /* SDL_cpuinfo.h in Headers */,
  14.148 @@ -7051,6 +7090,7 @@
  14.149  				A7D8B3B423E2514200DCD162 /* SDL_yuv_c.h in Headers */,
  14.150  				A7D8BBA323E2514500DCD162 /* scancodes_xfree86.h in Headers */,
  14.151  				A7D8B5D923E2514300DCD162 /* SDL_syspower.h in Headers */,
  14.152 +				566E26E5246274CC00718109 /* SDL_syslocale.h in Headers */,
  14.153  				A75FDAF823E35ED500529352 /* SDL_config_iphoneos.h in Headers */,
  14.154  				A7D8B21023E2514200DCD162 /* SDL_x11clipboard.h in Headers */,
  14.155  				A7D88D3923E24D3B00DCD162 /* SDL_name.h in Headers */,
  14.156 @@ -7185,6 +7225,7 @@
  14.157  				A7D8BBE023E2574800DCD162 /* SDL_uikitopenglview.h in Headers */,
  14.158  				A7D8B4AC23E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */,
  14.159  				A7D8B9EF23E2514400DCD162 /* SDL_drawpoint.h in Headers */,
  14.160 +				566E26E1246274CC00718109 /* SDL_syslocale.h in Headers */,
  14.161  				A7D8B39E23E2514200DCD162 /* SDL_RLEaccel_c.h in Headers */,
  14.162  				A7D8B44023E2514300DCD162 /* SDL_sysmutex_c.h in Headers */,
  14.163  				A7D8BA4323E2514400DCD162 /* SDL_glesfuncs.h in Headers */,
  14.164 @@ -7321,6 +7362,7 @@
  14.165  				A7D8BB9F23E2514500DCD162 /* scancodes_xfree86.h in Headers */,
  14.166  				A7D8BBE623E2574800DCD162 /* SDL_uikitviewcontroller.h in Headers */,
  14.167  				A7D8AF1E23E2514100DCD162 /* SDL_cocoamouse.h in Headers */,
  14.168 +				566E267A2462701100718109 /* SDL_locale.h in Headers */,
  14.169  				A7D8BBEA23E2574800DCD162 /* SDL_uikitwindow.h in Headers */,
  14.170  				A7D8AE8E23E2514100DCD162 /* SDL_cocoakeyboard.h in Headers */,
  14.171  				A7D8BA4F23E2514400DCD162 /* SDL_shaders_gles2.h in Headers */,
  14.172 @@ -7484,6 +7526,7 @@
  14.173  				A7D8BA7623E2514400DCD162 /* SDL_shaders_gl.h in Headers */,
  14.174  				A7D8B42B23E2514300DCD162 /* SDL_systhread_c.h in Headers */,
  14.175  				AA7558231595D4D800BBD41B /* SDL_keycode.h in Headers */,
  14.176 +				566E26E4246274CC00718109 /* SDL_syslocale.h in Headers */,
  14.177  				A7D8B20923E2514200DCD162 /* SDL_x11keyboard.h in Headers */,
  14.178  				A7D8AE9123E2514100DCD162 /* SDL_cocoakeyboard.h in Headers */,
  14.179  				A7D8B1F123E2514200DCD162 /* SDL_x11framebuffer.h in Headers */,
  14.180 @@ -7552,6 +7595,7 @@
  14.181  				A7D8BB6023E2514500DCD162 /* scancodes_linux.h in Headers */,
  14.182  				A7D8B1F723E2514200DCD162 /* SDL_x11dyn.h in Headers */,
  14.183  				A7D8BB6623E2514500DCD162 /* SDL_touch_c.h in Headers */,
  14.184 +				566E267D2462701100718109 /* SDL_locale.h in Headers */,
  14.185  				A7D8B4AF23E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */,
  14.186  				A7D8AEEB23E2514100DCD162 /* SDL_cocoavulkan.h in Headers */,
  14.187  				A7D8B23323E2514200DCD162 /* gl2platform.h in Headers */,
  14.188 @@ -7724,6 +7768,7 @@
  14.189  				A7D8BBB023E2514500DCD162 /* SDL_windowevents_c.h in Headers */,
  14.190  				DB313FD917554B71006C0E22 /* SDL_joystick.h in Headers */,
  14.191  				A7D8AF0523E2514100DCD162 /* SDL_cocoavideo.h in Headers */,
  14.192 +				566E26E7246274CC00718109 /* SDL_syslocale.h in Headers */,
  14.193  				DB313FDA17554B71006C0E22 /* SDL_keyboard.h in Headers */,
  14.194  				A7D8ACC223E2514100DCD162 /* SDL_uikitevents.h in Headers */,
  14.195  				A7D8BB3E23E2514500DCD162 /* SDL_gesture_c.h in Headers */,
  14.196 @@ -7792,6 +7837,7 @@
  14.197  				A7D8AC0223E2514100DCD162 /* SDL_nullevents_c.h in Headers */,
  14.198  				A7D8B58623E2514300DCD162 /* SDL_sysjoystick.h in Headers */,
  14.199  				A7D8BBCF23E2561600DCD162 /* SDL_steamcontroller.h in Headers */,
  14.200 +				566E26802462701100718109 /* SDL_locale.h in Headers */,
  14.201  				A7D8BB6223E2514500DCD162 /* scancodes_linux.h in Headers */,
  14.202  				A7D8B1F923E2514200DCD162 /* SDL_x11dyn.h in Headers */,
  14.203  				A7D8BB6823E2514500DCD162 /* SDL_touch_c.h in Headers */,
  14.204 @@ -8393,6 +8439,7 @@
  14.205  				A75FCE2C23E25AB700529352 /* SDL_cocoakeyboard.m in Sources */,
  14.206  				A75FCE2D23E25AB700529352 /* SDL_dynapi.c in Sources */,
  14.207  				A75FCE2E23E25AB700529352 /* SDL_shaders_gl.c in Sources */,
  14.208 +				566E26DF246274CC00718109 /* SDL_locale.c in Sources */,
  14.209  				A75FCE2F23E25AB700529352 /* e_log.c in Sources */,
  14.210  				A75FCE3023E25AB700529352 /* SDL_cocoamessagebox.m in Sources */,
  14.211  				A75FCE3123E25AB700529352 /* SDL_blendfillrect.c in Sources */,
  14.212 @@ -8465,6 +8512,7 @@
  14.213  				A75FCE7523E25AB700529352 /* SDL_rect.c in Sources */,
  14.214  				A75FCE7623E25AB700529352 /* SDL_cocoaopengles.m in Sources */,
  14.215  				A75FCE7723E25AB700529352 /* SDL_qsort.c in Sources */,
  14.216 +				566E26D6246274CC00718109 /* SDL_syslocale.m in Sources */,
  14.217  				A75FCE7823E25AB700529352 /* SDL_hidapi_switch.c in Sources */,
  14.218  				A75FCE7923E25AB700529352 /* SDL_strtokr.c in Sources */,
  14.219  				A75FCE7A23E25AB700529352 /* SDL_clipboardevents.c in Sources */,
  14.220 @@ -8589,6 +8637,7 @@
  14.221  				A75FCFE523E25AC700529352 /* SDL_cocoakeyboard.m in Sources */,
  14.222  				A75FCFE623E25AC700529352 /* SDL_dynapi.c in Sources */,
  14.223  				A75FCFE723E25AC700529352 /* SDL_shaders_gl.c in Sources */,
  14.224 +				566E26E0246274CC00718109 /* SDL_locale.c in Sources */,
  14.225  				A75FCFE823E25AC700529352 /* e_log.c in Sources */,
  14.226  				A75FCFE923E25AC700529352 /* SDL_cocoamessagebox.m in Sources */,
  14.227  				A75FCFEA23E25AC700529352 /* SDL_blendfillrect.c in Sources */,
  14.228 @@ -8661,6 +8710,7 @@
  14.229  				A75FD02E23E25AC700529352 /* SDL_rect.c in Sources */,
  14.230  				A75FD02F23E25AC700529352 /* SDL_cocoaopengles.m in Sources */,
  14.231  				A75FD03023E25AC700529352 /* SDL_qsort.c in Sources */,
  14.232 +				566E26D7246274CC00718109 /* SDL_syslocale.m in Sources */,
  14.233  				A75FD03123E25AC700529352 /* SDL_hidapi_switch.c in Sources */,
  14.234  				A75FD03223E25AC700529352 /* SDL_strtokr.c in Sources */,
  14.235  				A75FD03323E25AC700529352 /* SDL_clipboardevents.c in Sources */,
  14.236 @@ -8879,12 +8929,14 @@
  14.237  				A769B1FD23E259AE00872273 /* SDL_blit_auto.c in Sources */,
  14.238  				A769B1FE23E259AE00872273 /* SDL_x11keyboard.c in Sources */,
  14.239  				A769B1FF23E259AE00872273 /* SDL_keyboard.c in Sources */,
  14.240 +				566E26DD246274CC00718109 /* SDL_locale.c in Sources */,
  14.241  				A769B20123E259AE00872273 /* SDL_rect.c in Sources */,
  14.242  				A769B20223E259AE00872273 /* SDL_cocoaopengles.m in Sources */,
  14.243  				A769B20323E259AE00872273 /* SDL_qsort.c in Sources */,
  14.244  				A75FDB5223E39D1700529352 /* hid.m in Sources */,
  14.245  				A769B20423E259AE00872273 /* SDL_hidapi_switch.c in Sources */,
  14.246  				A769B20523E259AE00872273 /* SDL_strtokr.c in Sources */,
  14.247 +				566E26D4246274CC00718109 /* SDL_syslocale.m in Sources */,
  14.248  				A769B20623E259AE00872273 /* SDL_clipboardevents.c in Sources */,
  14.249  				A769B20723E259AE00872273 /* SDL_x11framebuffer.c in Sources */,
  14.250  				A769B20823E259AE00872273 /* k_cos.c in Sources */,
  14.251 @@ -9097,10 +9149,12 @@
  14.252  				A7D8AAB123E2514100DCD162 /* SDL_syshaptic.c in Sources */,
  14.253  				A7D8B5CA23E2514300DCD162 /* SDL_rwopsbundlesupport.m in Sources */,
  14.254  				A7D8AC1023E2514100DCD162 /* SDL_video.c in Sources */,
  14.255 +				566E26D0246274CC00718109 /* SDL_syslocale.m in Sources */,
  14.256  				A7D8AB5623E2514100DCD162 /* SDL_offscreenopengl.c in Sources */,
  14.257  				A7D8ACC423E2514100DCD162 /* SDL_uikitmetalview.m in Sources */,
  14.258  				A7D8BA5C23E2514400DCD162 /* SDL_shaders_gles2.c in Sources */,
  14.259  				A7D8B14123E2514200DCD162 /* SDL_blit_1.c in Sources */,
  14.260 +				566E26D9246274CC00718109 /* SDL_locale.c in Sources */,
  14.261  				A7D8B17D23E2514200DCD162 /* SDL_x11dyn.c in Sources */,
  14.262  				A7D8BB1623E2514500DCD162 /* SDL_mouse.c in Sources */,
  14.263  				A7D8BADA23E2514500DCD162 /* e_rem_pio2.c in Sources */,
  14.264 @@ -9292,10 +9346,12 @@
  14.265  				A7D8AAB223E2514100DCD162 /* SDL_syshaptic.c in Sources */,
  14.266  				A7D8B5CB23E2514300DCD162 /* SDL_rwopsbundlesupport.m in Sources */,
  14.267  				A7D8AC1123E2514100DCD162 /* SDL_video.c in Sources */,
  14.268 +				566E26D1246274CC00718109 /* SDL_syslocale.m in Sources */,
  14.269  				A7D8AB5723E2514100DCD162 /* SDL_offscreenopengl.c in Sources */,
  14.270  				A7D8ACC523E2514100DCD162 /* SDL_uikitmetalview.m in Sources */,
  14.271  				A7D8BA5D23E2514400DCD162 /* SDL_shaders_gles2.c in Sources */,
  14.272  				A7D8B14223E2514200DCD162 /* SDL_blit_1.c in Sources */,
  14.273 +				566E26DA246274CC00718109 /* SDL_locale.c in Sources */,
  14.274  				A7D8B17E23E2514200DCD162 /* SDL_x11dyn.c in Sources */,
  14.275  				A7D8BB1723E2514500DCD162 /* SDL_mouse.c in Sources */,
  14.276  				A7D8BADB23E2514500DCD162 /* e_rem_pio2.c in Sources */,
  14.277 @@ -9466,12 +9522,14 @@
  14.278  				A7D8AD2723E2514100DCD162 /* SDL_blit_auto.c in Sources */,
  14.279  				A7D8B1AA23E2514200DCD162 /* SDL_x11keyboard.c in Sources */,
  14.280  				A7D8BB6D23E2514500DCD162 /* SDL_keyboard.c in Sources */,
  14.281 +				566E26DC246274CC00718109 /* SDL_locale.c in Sources */,
  14.282  				A7D8ACEB23E2514100DCD162 /* SDL_rect.c in Sources */,
  14.283  				A7D8AE9E23E2514100DCD162 /* SDL_cocoaopengles.m in Sources */,
  14.284  				A7D8B96C23E2514400DCD162 /* SDL_qsort.c in Sources */,
  14.285  				A75FDB5123E39D1700529352 /* hid.m in Sources */,
  14.286  				A7D8B55523E2514300DCD162 /* SDL_hidapi_switch.c in Sources */,
  14.287  				A7D8B96623E2514400DCD162 /* SDL_strtokr.c in Sources */,
  14.288 +				566E26D3246274CC00718109 /* SDL_syslocale.m in Sources */,
  14.289  				A7D8BB7923E2514500DCD162 /* SDL_clipboardevents.c in Sources */,
  14.290  				A7D8B18623E2514200DCD162 /* SDL_x11framebuffer.c in Sources */,
  14.291  				A7D8BAB923E2514400DCD162 /* k_cos.c in Sources */,
  14.292 @@ -9635,6 +9693,7 @@
  14.293  				A7D8BB0923E2514500DCD162 /* k_tan.c in Sources */,
  14.294  				A7D8B15E23E2514200DCD162 /* SDL_x11vulkan.c in Sources */,
  14.295  				A7D8B8A823E2514400DCD162 /* SDL_diskaudio.c in Sources */,
  14.296 +				566E26CF246274CC00718109 /* SDL_syslocale.m in Sources */,
  14.297  				A7D8AFC023E2514200DCD162 /* SDL_egl.c in Sources */,
  14.298  				A7D8AC3323E2514100DCD162 /* SDL_RLEaccel.c in Sources */,
  14.299  				A7D8BBB123E2514500DCD162 /* SDL_assert.c in Sources */,
  14.300 @@ -9706,6 +9765,7 @@
  14.301  				A7D8B15823E2514200DCD162 /* SDL_x11opengl.c in Sources */,
  14.302  				A7D8AEA023E2514100DCD162 /* SDL_cocoavulkan.m in Sources */,
  14.303  				A7D8AB6123E2514100DCD162 /* SDL_offscreenwindow.c in Sources */,
  14.304 +				566E26D8246274CC00718109 /* SDL_locale.c in Sources */,
  14.305  			);
  14.306  			runOnlyForDeploymentPostprocessing = 0;
  14.307  		};
  14.308 @@ -9805,6 +9865,7 @@
  14.309  				A7D8B5F623E2514300DCD162 /* SDL_syspower.c in Sources */,
  14.310  				A7D8B1C723E2514200DCD162 /* SDL_x11touch.c in Sources */,
  14.311  				A7D8B95323E2514400DCD162 /* SDL_iconv.c in Sources */,
  14.312 +				566E26DB246274CC00718109 /* SDL_locale.c in Sources */,
  14.313  				A7D8BAA023E2514400DCD162 /* s_fabs.c in Sources */,
  14.314  				A7D8B1E523E2514200DCD162 /* SDL_x11shape.c in Sources */,
  14.315  				A7D8BC0423E2574800DCD162 /* SDL_uikitvulkan.m in Sources */,
  14.316 @@ -9880,6 +9941,7 @@
  14.317  				A7D8AC1223E2514100DCD162 /* SDL_video.c in Sources */,
  14.318  				A7D8AB5823E2514100DCD162 /* SDL_offscreenopengl.c in Sources */,
  14.319  				A7D8BA5E23E2514400DCD162 /* SDL_shaders_gles2.c in Sources */,
  14.320 +				566E26D2246274CC00718109 /* SDL_syslocale.m in Sources */,
  14.321  				A7D8B14323E2514200DCD162 /* SDL_blit_1.c in Sources */,
  14.322  				A7D8B17F23E2514200DCD162 /* SDL_x11dyn.c in Sources */,
  14.323  				A7D8BB1823E2514500DCD162 /* SDL_mouse.c in Sources */,
  14.324 @@ -9999,6 +10061,7 @@
  14.325  				A7D8B76323E2514300DCD162 /* SDL_sysloadso.c in Sources */,
  14.326  				A7D8B16F23E2514200DCD162 /* SDL_x11xinput2.c in Sources */,
  14.327  				A7D8B5F823E2514300DCD162 /* SDL_syspower.c in Sources */,
  14.328 +				566E26DE246274CC00718109 /* SDL_locale.c in Sources */,
  14.329  				A7D8B1C923E2514200DCD162 /* SDL_x11touch.c in Sources */,
  14.330  				A7D8B95523E2514400DCD162 /* SDL_iconv.c in Sources */,
  14.331  				A7D8BAA223E2514400DCD162 /* s_fabs.c in Sources */,
  14.332 @@ -10074,6 +10137,7 @@
  14.333  				A7D8ACC823E2514100DCD162 /* SDL_uikitmetalview.m in Sources */,
  14.334  				A7D8BBBA23E2560600DCD162 /* SDL_steamcontroller.c in Sources */,
  14.335  				A7D8BA6023E2514400DCD162 /* SDL_shaders_gles2.c in Sources */,
  14.336 +				566E26D5246274CC00718109 /* SDL_syslocale.m in Sources */,
  14.337  				A7D8B14523E2514200DCD162 /* SDL_blit_1.c in Sources */,
  14.338  				A7D8B18123E2514200DCD162 /* SDL_x11dyn.c in Sources */,
  14.339  				A7D8BB1A23E2514500DCD162 /* SDL_mouse.c in Sources */,
    15.1 --- a/configure	Wed May 06 12:19:58 2020 -0700
    15.2 +++ b/configure	Mon May 04 02:27:29 2020 -0400
    15.3 @@ -770,6 +770,7 @@
    15.4  docdir
    15.5  oldincludedir
    15.6  includedir
    15.7 +runstatedir
    15.8  localstatedir
    15.9  sharedstatedir
   15.10  sysconfdir
   15.11 @@ -981,6 +982,7 @@
   15.12  sysconfdir='${prefix}/etc'
   15.13  sharedstatedir='${prefix}/com'
   15.14  localstatedir='${prefix}/var'
   15.15 +runstatedir='${localstatedir}/run'
   15.16  includedir='${prefix}/include'
   15.17  oldincludedir='/usr/include'
   15.18  docdir='${datarootdir}/doc/${PACKAGE}'
   15.19 @@ -1233,6 +1235,15 @@
   15.20    | -silent | --silent | --silen | --sile | --sil)
   15.21      silent=yes ;;
   15.22  
   15.23 +  -runstatedir | --runstatedir | --runstatedi | --runstated \
   15.24 +  | --runstate | --runstat | --runsta | --runst | --runs \
   15.25 +  | --run | --ru | --r)
   15.26 +    ac_prev=runstatedir ;;
   15.27 +  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
   15.28 +  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
   15.29 +  | --run=* | --ru=* | --r=*)
   15.30 +    runstatedir=$ac_optarg ;;
   15.31 +
   15.32    -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
   15.33      ac_prev=sbindir ;;
   15.34    -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
   15.35 @@ -1370,7 +1381,7 @@
   15.36  for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
   15.37  		datadir sysconfdir sharedstatedir localstatedir includedir \
   15.38  		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
   15.39 -		libdir localedir mandir
   15.40 +		libdir localedir mandir runstatedir
   15.41  do
   15.42    eval ac_val=\$$ac_var
   15.43    # Remove trailing slashes.
   15.44 @@ -1523,6 +1534,7 @@
   15.45    --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   15.46    --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   15.47    --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
   15.48 +  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   15.49    --libdir=DIR            object code libraries [EPREFIX/lib]
   15.50    --includedir=DIR        C header files [PREFIX/include]
   15.51    --oldincludedir=DIR     C header files for non-gcc [/usr/include]
   15.52 @@ -17309,6 +17321,7 @@
   15.53  SOURCES="$SOURCES $srcdir/src/timer/*.c"
   15.54  SOURCES="$SOURCES $srcdir/src/video/*.c"
   15.55  SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
   15.56 +SOURCES="$SOURCES $srcdir/src/locale/*.c"
   15.57  
   15.58  
   15.59  # Check whether --enable-atomic was given.
   15.60 @@ -24659,6 +24672,8 @@
   15.61  
   15.62  CheckEventSignals
   15.63  
   15.64 +have_locale=no
   15.65 +
   15.66  case "$host" in
   15.67      *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
   15.68          case "$host" in
   15.69 @@ -24746,6 +24761,9 @@
   15.70          CheckRPATH
   15.71          CheckVivanteVideo
   15.72  
   15.73 +        SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
   15.74 +        have_locale=yes
   15.75 +
   15.76          # Set up files for the audio library
   15.77          if test x$enable_audio = xyes; then
   15.78            case $ARCH in
   15.79 @@ -24923,6 +24941,10 @@
   15.80          # Set up the core platform files
   15.81          SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
   15.82  
   15.83 +        # Use the Windows locale APIs.
   15.84 +        SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
   15.85 +        have_locale=yes
   15.86 +
   15.87          # Set up files for the video library
   15.88          if test x$enable_video = xyes; then
   15.89  
   15.90 @@ -25174,6 +25196,11 @@
   15.91              SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
   15.92              have_filesystem=yes
   15.93          fi
   15.94 +
   15.95 +        # Set up files for the locale library
   15.96 +        SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
   15.97 +        have_locale=yes
   15.98 +
   15.99          # The Haiku platform requires special setup.
  15.100          SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
  15.101          EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  15.102 @@ -25216,6 +25243,10 @@
  15.103          CheckVulkan
  15.104          CheckPTHREAD
  15.105  
  15.106 +        # Set up files for the locale library
  15.107 +        SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
  15.108 +        have_locale=yes
  15.109 +
  15.110          # Set up files for the audio library
  15.111          if test x$enable_audio = xyes; then
  15.112  
  15.113 @@ -25337,6 +25368,10 @@
  15.114          CheckPTHREAD
  15.115          CheckHIDAPI
  15.116  
  15.117 +        # Set up files for the locale library
  15.118 +        SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
  15.119 +        have_locale=yes
  15.120 +
  15.121          # Set up files for the audio library
  15.122          if test x$enable_audio = xyes; then
  15.123  
  15.124 @@ -25492,6 +25527,9 @@
  15.125              SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  15.126              have_timers=yes
  15.127          fi
  15.128 +        # Set up files for the locale library
  15.129 +        SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c"
  15.130 +        have_locale=yes
  15.131          ;;
  15.132      *-*-riscos*)
  15.133          ARCH=riscos
  15.134 @@ -25549,6 +25587,9 @@
  15.135  
  15.136  # Verify that we have all the platform specific files we need
  15.137  
  15.138 +if test x$have_locale != xyes; then
  15.139 +    SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
  15.140 +fi
  15.141  if test x$have_joystick != xyes; then
  15.142      if test x$enable_joystick = xyes; then
  15.143  
    16.1 --- a/configure.ac	Wed May 06 12:19:58 2020 -0700
    16.2 +++ b/configure.ac	Mon May 04 02:27:29 2020 -0400
    16.3 @@ -413,6 +413,7 @@
    16.4  SOURCES="$SOURCES $srcdir/src/timer/*.c"
    16.5  SOURCES="$SOURCES $srcdir/src/video/*.c"
    16.6  SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
    16.7 +SOURCES="$SOURCES $srcdir/src/locale/*.c"
    16.8  
    16.9  dnl Enable/disable various subsystems of the SDL library
   16.10  
   16.11 @@ -3439,6 +3440,8 @@
   16.12  dnl Do this for every platform, but for some it doesn't mean anything, but better to catch it here anyhow.
   16.13  CheckEventSignals
   16.14  
   16.15 +have_locale=no
   16.16 +
   16.17  dnl Set up the configuration based on the host platform!
   16.18  case "$host" in
   16.19      *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
   16.20 @@ -3527,6 +3530,9 @@
   16.21          CheckRPATH
   16.22          CheckVivanteVideo
   16.23  
   16.24 +        SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
   16.25 +        have_locale=yes
   16.26 +
   16.27          # Set up files for the audio library
   16.28          if test x$enable_audio = xyes; then
   16.29            case $ARCH in
   16.30 @@ -3676,6 +3682,10 @@
   16.31          # Set up the core platform files
   16.32          SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
   16.33  
   16.34 +        # Use the Windows locale APIs.
   16.35 +        SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
   16.36 +        have_locale=yes
   16.37 +
   16.38          # Set up files for the video library
   16.39          if test x$enable_video = xyes; then
   16.40              AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
   16.41 @@ -3847,6 +3857,11 @@
   16.42              SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
   16.43              have_filesystem=yes
   16.44          fi
   16.45 +
   16.46 +        # Set up files for the locale library
   16.47 +        SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
   16.48 +        have_locale=yes
   16.49 +
   16.50          # The Haiku platform requires special setup.
   16.51          SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
   16.52          EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
   16.53 @@ -3867,6 +3882,10 @@
   16.54          CheckVulkan
   16.55          CheckPTHREAD
   16.56  
   16.57 +        # Set up files for the locale library
   16.58 +        SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
   16.59 +        have_locale=yes
   16.60 +
   16.61          # Set up files for the audio library
   16.62          if test x$enable_audio = xyes; then
   16.63              AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
   16.64 @@ -3966,6 +3985,10 @@
   16.65          CheckPTHREAD
   16.66          CheckHIDAPI
   16.67  
   16.68 +        # Set up files for the locale library
   16.69 +        SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
   16.70 +        have_locale=yes
   16.71 +
   16.72          # Set up files for the audio library
   16.73          if test x$enable_audio = xyes; then
   16.74              AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
   16.75 @@ -4093,6 +4116,9 @@
   16.76              SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
   16.77              have_timers=yes
   16.78          fi
   16.79 +        # Set up files for the locale library
   16.80 +        SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c"
   16.81 +        have_locale=yes
   16.82          ;;
   16.83      *-*-riscos*)
   16.84          ARCH=riscos
   16.85 @@ -4141,6 +4167,9 @@
   16.86  
   16.87  # Verify that we have all the platform specific files we need
   16.88  
   16.89 +if test x$have_locale != xyes; then
   16.90 +    SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
   16.91 +fi
   16.92  if test x$have_joystick != xyes; then
   16.93      if test x$enable_joystick = xyes; then
   16.94          AC_DEFINE(SDL_JOYSTICK_DUMMY, 1, [ ])
    17.1 --- a/include/SDL.h	Wed May 06 12:19:58 2020 -0700
    17.2 +++ b/include/SDL.h	Mon May 04 02:27:29 2020 -0400
    17.3 @@ -59,6 +59,7 @@
    17.4  #include "SDL_timer.h"
    17.5  #include "SDL_version.h"
    17.6  #include "SDL_video.h"
    17.7 +#include "SDL_locale.h"
    17.8  
    17.9  #include "begin_code.h"
   17.10  /* Set up for C function definitions, even when using C++ */
    18.1 --- a/include/SDL_events.h	Wed May 06 12:19:58 2020 -0700
    18.2 +++ b/include/SDL_events.h	Mon May 04 02:27:29 2020 -0400
    18.3 @@ -85,6 +85,8 @@
    18.4                                       Called on Android in onResume()
    18.5                                  */
    18.6  
    18.7 +    SDL_LOCALECHANGED,  /**< The user's locale preferences have changed. */
    18.8 +
    18.9      /* Display events */
   18.10      SDL_DISPLAYEVENT   = 0x150,  /**< Display state change */
   18.11  
    19.1 --- a/include/SDL_hints.h	Wed May 06 12:19:58 2020 -0700
    19.2 +++ b/include/SDL_hints.h	Mon May 04 02:27:29 2020 -0400
    19.3 @@ -1349,6 +1349,21 @@
    19.4  
    19.5  
    19.6  /**
    19.7 + *  \brief Override for SDL_GetPreferredLocales()
    19.8 + *
    19.9 + *  If set, this will be favored over anything the OS might report for the
   19.10 + *  user's preferred locales. Changing this hint at runtime will not generate
   19.11 + *  a SDL_LOCALECHANGED event (but if you can change the hint, you can push
   19.12 + *  your own event, if you want).
   19.13 + *
   19.14 + *  The format of this hint is a comma-separated list of language and locale,
   19.15 + *  combined with an underscore, as is a common format: "en_GB". Locale is
   19.16 + *  optional: "en". So you might have a list like this: "en_GB,jp,es_PT"
   19.17 + */
   19.18 +#define SDL_HINT_PREFERRED_LOCALES "SDL_PREFERRED_LOCALES"
   19.19 +
   19.20 +
   19.21 +/**
   19.22   *  \brief  An enumeration of hint priorities
   19.23   */
   19.24  typedef enum
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/include/SDL_locale.h	Mon May 04 02:27:29 2020 -0400
    20.3 @@ -0,0 +1,101 @@
    20.4 +/*
    20.5 +  Simple DirectMedia Layer
    20.6 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    20.7 +
    20.8 +  This software is provided 'as-is', without any express or implied
    20.9 +  warranty.  In no event will the authors be held liable for any damages
   20.10 +  arising from the use of this software.
   20.11 +
   20.12 +  Permission is granted to anyone to use this software for any purpose,
   20.13 +  including commercial applications, and to alter it and redistribute it
   20.14 +  freely, subject to the following restrictions:
   20.15 +
   20.16 +  1. The origin of this software must not be misrepresented; you must not
   20.17 +     claim that you wrote the original software. If you use this software
   20.18 +     in a product, an acknowledgment in the product documentation would be
   20.19 +     appreciated but is not required.
   20.20 +  2. Altered source versions must be plainly marked as such, and must not be
   20.21 +     misrepresented as being the original software.
   20.22 +  3. This notice may not be removed or altered from any source distribution.
   20.23 +*/
   20.24 +
   20.25 +/**
   20.26 + *  \file SDL_locale.h
   20.27 + *
   20.28 + *  Include file for SDL locale services
   20.29 + */
   20.30 +
   20.31 +#ifndef _SDL_locale_h
   20.32 +#define _SDL_locale_h
   20.33 +
   20.34 +#include "SDL_stdinc.h"
   20.35 +#include "SDL_error.h"
   20.36 +
   20.37 +#include "begin_code.h"
   20.38 +/* Set up for C function definitions, even when using C++ */
   20.39 +#ifdef __cplusplus
   20.40 +/* *INDENT-OFF* */
   20.41 +extern "C" {
   20.42 +/* *INDENT-ON* */
   20.43 +#endif
   20.44 +
   20.45 +
   20.46 +typedef struct SDL_Locale
   20.47 +{
   20.48 +    const char *language;  /**< A language name, like "en" for English. */
   20.49 +    const char *country;  /**< A country, like "US" for America. Can be NULL. */
   20.50 +} SDL_Locale;
   20.51 +
   20.52 +/**
   20.53 + *  \brief Report the user's preferred locale.
   20.54 + *
   20.55 + *  This returns an array of SDL_Locale structs, the final item zeroed out.
   20.56 + *  When the caller is done with this array, it should call SDL_free() on
   20.57 + *  the returned value; all the memory involved is allocated in a single
   20.58 + *  block, so a single SDL_free() will suffice.
   20.59 + *
   20.60 + *  Returned language strings are in the format xx, where 'xx' is an ISO-639
   20.61 + *  language specifier (such as "en" for English, "de" for German, etc).
   20.62 + *  Country strings are in the format YY, where "YY" is an ISO-3166 country
   20.63 + *  code (such as "US" for the United States, "CA" for Canada, etc). Country
   20.64 + *  might be NULL if there's no specific guidance on them (so you might get
   20.65 + *  { "en", "US" } for American English, but { "en", NULL } means "English
   20.66 + *  language, generically"). Language strings are never NULL, except to
   20.67 + *  terminate the array.
   20.68 + *
   20.69 + *  Please note that not all of these strings are 2 characters; some are
   20.70 + *  three or more.
   20.71 + *
   20.72 + *  The returned list of locales are in the order of the user's preference.
   20.73 + *  For example, a German citizen that is fluent in US English and knows
   20.74 + *  enough Japanese to navigate around Tokyo might have a list like:
   20.75 + *  { "de", "en_US", "jp", NULL }. Someone from England might prefer British
   20.76 + *  English (where "color" is spelled "colour", etc), but will settle for
   20.77 + *  anything like it: { "en_GB", "en", NULL }.
   20.78 + *
   20.79 + *  This function returns NULL on error, including when the platform does not
   20.80 + *  supply this information at all.
   20.81 + *
   20.82 + *  This might be a "slow" call that has to query the operating system. It's
   20.83 + *  best to ask for this once and save the results. However, this list can
   20.84 + *  change, usually because the user has changed a system preference outside
   20.85 + *  of your program; SDL will send an SDL_LOCALECHANGED event in this case,
   20.86 + *  if possible, and you can call this function again to get an updated copy
   20.87 + *  of preferred locales.
   20.88 + *
   20.89 + *   \return array of locales, terminated with a locale with a NULL language
   20.90 + *           field. Will return NULL on error.
   20.91 + */
   20.92 +extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void);
   20.93 +
   20.94 +/* Ends C function definitions when using C++ */
   20.95 +#ifdef __cplusplus
   20.96 +/* *INDENT-OFF* */
   20.97 +}
   20.98 +/* *INDENT-ON* */
   20.99 +#endif
  20.100 +#include "close_code.h"
  20.101 +
  20.102 +#endif /* _SDL_locale_h */
  20.103 +
  20.104 +/* vi: set ts=4 sw=4 expandtab: */
    21.1 --- a/src/core/android/SDL_android.c	Wed May 06 12:19:58 2020 -0700
    21.2 +++ b/src/core/android/SDL_android.c	Mon May 04 02:27:29 2020 -0400
    21.3 @@ -44,6 +44,8 @@
    21.4  #include "../../haptic/android/SDL_syshaptic_c.h"
    21.5  
    21.6  #include <android/log.h>
    21.7 +#include <android/configuration.h>
    21.8 +#include <android/asset_manager_jni.h>
    21.9  #include <sys/system_properties.h>
   21.10  #include <pthread.h>
   21.11  #include <sys/types.h>
   21.12 @@ -2796,6 +2798,82 @@
   21.13  	return bPermissionRequestResult;
   21.14  }
   21.15  
   21.16 +int Android_JNI_GetLocale(char *buf, size_t buflen)
   21.17 +{
   21.18 +    struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
   21.19 +    JNIEnv* env = Android_JNI_GetEnv();
   21.20 +    int retval = -1;
   21.21 +
   21.22 +    JNIEnv *mEnv = Android_JNI_GetEnv();
   21.23 +    if (!LocalReferenceHolder_Init(&refs, env)) {
   21.24 +        LocalReferenceHolder_Cleanup(&refs);
   21.25 +        return -1;
   21.26 +    }
   21.27 +
   21.28 +    SDL_assert(buflen > 6);
   21.29 +
   21.30 +    jmethodID mid;
   21.31 +    jobject context;
   21.32 +    jobject assetManager;
   21.33 +
   21.34 +    /* context = SDLActivity.getContext(); */
   21.35 +    mid = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   21.36 +            "getContext","()Landroid/content/Context;");
   21.37 +    context = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, mid);
   21.38 +
   21.39 +    /* assetManager = context.getAssets(); */
   21.40 +    mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context),
   21.41 +            "getAssets", "()Landroid/content/res/AssetManager;");
   21.42 +    assetManager = (*mEnv)->CallObjectMethod(mEnv, context, mid);
   21.43 +
   21.44 +
   21.45 +    /* API from NDK: android/configuration.h */
   21.46 +    /* API from NDK: android/asset_manager_jni.h */
   21.47 +    AAssetManager* asset_mgr = AAssetManager_fromJava(env, assetManager);
   21.48 +    AConfiguration *cfg = AConfiguration_new();
   21.49 +
   21.50 +    if (asset_mgr && cfg)
   21.51 +    {
   21.52 +        char language[2] = {};
   21.53 +        char country[2] = {};
   21.54 +        size_t id = 0;
   21.55 +
   21.56 +        AConfiguration_fromAssetManager(cfg, asset_mgr);
   21.57 +        AConfiguration_getLanguage(cfg, language);
   21.58 +        AConfiguration_getCountry(cfg, country);
   21.59 +
   21.60 +        retval = 0;
   21.61 +
   21.62 +        /* copy language (not null terminated) */
   21.63 +        if (language[0]) {
   21.64 +            buf[id++] = language[0];
   21.65 +            if (language[1]) {
   21.66 +                buf[id++] = language[1];
   21.67 +            }
   21.68 +        }
   21.69 +
   21.70 +        buf[id++] = '_';
   21.71 +
   21.72 +        /* copy country (not null terminated) */
   21.73 +        if (country[0]) {
   21.74 +            buf[id++] = country[0];
   21.75 +            if (country[1]) {
   21.76 +                buf[id++] = country[1];
   21.77 +            }
   21.78 +        }
   21.79 +        
   21.80 +        buf[id++] = '\0';
   21.81 +        SDL_assert(id <= buflen);
   21.82 +    }
   21.83 +
   21.84 +    if (cfg) {
   21.85 +        AConfiguration_delete(cfg);
   21.86 +    }
   21.87 +
   21.88 +    LocalReferenceHolder_Cleanup(&refs);
   21.89 +    return retval;
   21.90 +}
   21.91 +
   21.92  #endif /* __ANDROID__ */
   21.93  
   21.94  /* vi: set ts=4 sw=4 expandtab: */
    22.1 --- a/src/core/android/SDL_android.h	Wed May 06 12:19:58 2020 -0700
    22.2 +++ b/src/core/android/SDL_android.h	Mon May 04 02:27:29 2020 -0400
    22.3 @@ -104,6 +104,9 @@
    22.4  JNIEnv *Android_JNI_GetEnv(void);
    22.5  int Android_JNI_SetupThread(void);
    22.6  
    22.7 +/* Locale */
    22.8 +int Android_JNI_GetLocale(char *buf, size_t buflen);
    22.9 +
   22.10  /* Generic messages */
   22.11  int Android_JNI_SendMessage(int command, int param);
   22.12  
    23.1 --- a/src/dynapi/SDL_dynapi_overrides.h	Wed May 06 12:19:58 2020 -0700
    23.2 +++ b/src/dynapi/SDL_dynapi_overrides.h	Mon May 04 02:27:29 2020 -0400
    23.3 @@ -763,3 +763,4 @@
    23.4  #define SDL_Metal_GetDrawableSize SDL_Metal_GetDrawableSize_REAL
    23.5  #define SDL_trunc SDL_trunc_REAL
    23.6  #define SDL_truncf SDL_truncf_REAL
    23.7 +#define SDL_GetPreferredLocales SDL_GetPreferredLocales_REAL
    24.1 --- a/src/dynapi/SDL_dynapi_procs.h	Wed May 06 12:19:58 2020 -0700
    24.2 +++ b/src/dynapi/SDL_dynapi_procs.h	Mon May 04 02:27:29 2020 -0400
    24.3 @@ -822,3 +822,4 @@
    24.4  SDL_DYNAPI_PROC(void,SDL_Metal_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
    24.5  SDL_DYNAPI_PROC(double,SDL_trunc,(double a),(a),return)
    24.6  SDL_DYNAPI_PROC(float,SDL_truncf,(float a),(a),return)
    24.7 +SDL_DYNAPI_PROC(SDL_Locale *,SDL_GetPreferredLocales,(void),(),return)
    25.1 --- a/src/events/SDL_events.c	Wed May 06 12:19:58 2020 -0700
    25.2 +++ b/src/events/SDL_events.c	Mon May 04 02:27:29 2020 -0400
    25.3 @@ -1010,6 +1010,12 @@
    25.4  }
    25.5  
    25.6  int
    25.7 +SDL_SendLocaleChangedEvent(void)
    25.8 +{
    25.9 +    return SDL_SendAppEvent(SDL_LOCALECHANGED);
   25.10 +}
   25.11 +
   25.12 +int
   25.13  SDL_EventsInit(void)
   25.14  {
   25.15      SDL_AddHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL);
    26.1 --- a/src/events/SDL_events_c.h	Wed May 06 12:19:58 2020 -0700
    26.2 +++ b/src/events/SDL_events_c.h	Mon May 04 02:27:29 2020 -0400
    26.3 @@ -46,6 +46,7 @@
    26.4  extern int SDL_SendAppEvent(SDL_EventType eventType);
    26.5  extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);
    26.6  extern int SDL_SendKeymapChangedEvent(void);
    26.7 +extern int SDL_SendLocaleChangedEvent(void);
    26.8  
    26.9  extern int SDL_SendQuit(void);
   26.10  
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/src/locale/SDL_locale.c	Mon May 04 02:27:29 2020 -0400
    27.3 @@ -0,0 +1,103 @@
    27.4 +/*
    27.5 +  Simple DirectMedia Layer
    27.6 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    27.7 +
    27.8 +  This software is provided 'as-is', without any express or implied
    27.9 +  warranty.  In no event will the authors be held liable for any damages
   27.10 +  arising from the use of this software.
   27.11 +
   27.12 +  Permission is granted to anyone to use this software for any purpose,
   27.13 +  including commercial applications, and to alter it and redistribute it
   27.14 +  freely, subject to the following restrictions:
   27.15 +
   27.16 +  1. The origin of this software must not be misrepresented; you must not
   27.17 +     claim that you wrote the original software. If you use this software
   27.18 +     in a product, an acknowledgment in the product documentation would be
   27.19 +     appreciated but is not required.
   27.20 +  2. Altered source versions must be plainly marked as such, and must not be
   27.21 +     misrepresented as being the original software.
   27.22 +  3. This notice may not be removed or altered from any source distribution.
   27.23 +*/
   27.24 +
   27.25 +#include "../SDL_internal.h"
   27.26 +#include "SDL_syslocale.h"
   27.27 +#include "SDL_hints.h"
   27.28 +
   27.29 +static SDL_Locale *
   27.30 +build_locales_from_csv_string(char *csv)
   27.31 +{
   27.32 +    size_t num_locales = 1;  /* at least one */
   27.33 +    size_t slen;
   27.34 +    size_t alloclen;
   27.35 +    char *ptr;
   27.36 +    SDL_Locale *loc;
   27.37 +    SDL_Locale *retval;
   27.38 +
   27.39 +    if (!csv || !csv[0]) {
   27.40 +        return NULL;  /* nothing to report */
   27.41 +    }
   27.42 +
   27.43 +    for (ptr = csv; *ptr; ptr++) {
   27.44 +        if (*ptr == ',') {
   27.45 +            num_locales++;
   27.46 +        }
   27.47 +    }
   27.48 +
   27.49 +    num_locales++;  /* one more for terminator */
   27.50 +
   27.51 +    slen = ((size_t) (ptr - csv)) + 1;  /* strlen(csv) + 1 */
   27.52 +    alloclen = slen + (num_locales * sizeof (SDL_Locale));
   27.53 +
   27.54 +    loc = retval = (SDL_Locale *) SDL_calloc(1, alloclen);
   27.55 +    if (!retval) {
   27.56 +        SDL_OutOfMemory();
   27.57 +        return NULL;  /* oh well */
   27.58 +    }
   27.59 +    ptr = (char *) (retval + num_locales);
   27.60 +    SDL_strlcpy(ptr, csv, slen);
   27.61 +
   27.62 +    while (SDL_TRUE) {  /* parse out the string */
   27.63 +        while (*ptr == ' ') ptr++;  /* skip whitespace. */
   27.64 +        if (*ptr == '\0') {
   27.65 +            break;
   27.66 +        }
   27.67 +        loc->language = ptr++;
   27.68 +        while (SDL_TRUE) {
   27.69 +            const char ch = *ptr;
   27.70 +            if (ch == '_') {
   27.71 +                *(ptr++) = '\0';
   27.72 +                loc->country = ptr;
   27.73 +            } else if (ch == ' ') {
   27.74 +                *(ptr++) = '\0';  /* trim ending whitespace and keep going. */
   27.75 +            } else if (ch == ',') {
   27.76 +                *(ptr++) = '\0';
   27.77 +                loc++;
   27.78 +                break;
   27.79 +            } else if (ch == '\0') {
   27.80 +                loc++;
   27.81 +                break;
   27.82 +            } else {
   27.83 +                ptr++;  /* just keep going, still a valid string */
   27.84 +            }
   27.85 +        }
   27.86 +    }
   27.87 +
   27.88 +    return retval;
   27.89 +}
   27.90 +
   27.91 +SDL_Locale *
   27.92 +SDL_GetPreferredLocales(void)
   27.93 +{
   27.94 +    char locbuf[128];  /* enough for 21 "xx_YY," language strings. */
   27.95 +    const char *hint = SDL_GetHint(SDL_HINT_PREFERRED_LOCALES);
   27.96 +    if (hint) {
   27.97 +        SDL_strlcpy(locbuf, hint, sizeof (locbuf));
   27.98 +    } else {
   27.99 +        SDL_zeroa(locbuf);
  27.100 +        SDL_SYS_GetPreferredLocales(locbuf, sizeof (locbuf));
  27.101 +    }
  27.102 +    return build_locales_from_csv_string(locbuf);
  27.103 +}
  27.104 +
  27.105 +/* vi: set ts=4 sw=4 expandtab: */
  27.106 +
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/src/locale/SDL_syslocale.h	Mon May 04 02:27:29 2020 -0400
    28.3 @@ -0,0 +1,29 @@
    28.4 +/*
    28.5 +  Simple DirectMedia Layer
    28.6 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    28.7 +
    28.8 +  This software is provided 'as-is', without any express or implied
    28.9 +  warranty.  In no event will the authors be held liable for any damages
   28.10 +  arising from the use of this software.
   28.11 +
   28.12 +  Permission is granted to anyone to use this software for any purpose,
   28.13 +  including commercial applications, and to alter it and redistribute it
   28.14 +  freely, subject to the following restrictions:
   28.15 +
   28.16 +  1. The origin of this software must not be misrepresented; you must not
   28.17 +     claim that you wrote the original software. If you use this software
   28.18 +     in a product, an acknowledgment in the product documentation would be
   28.19 +     appreciated but is not required.
   28.20 +  2. Altered source versions must be plainly marked as such, and must not be
   28.21 +     misrepresented as being the original software.
   28.22 +  3. This notice may not be removed or altered from any source distribution.
   28.23 +*/
   28.24 +#include "SDL_config.h"
   28.25 +
   28.26 +/* This is the system specific header for the SDL locale API */
   28.27 +
   28.28 +#include "SDL_locale.h"
   28.29 +
   28.30 +extern void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen);
   28.31 +
   28.32 +/* vi: set ts=4 sw=4 expandtab: */
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/src/locale/android/SDL_syslocale.c	Mon May 04 02:27:29 2020 -0400
    29.3 @@ -0,0 +1,32 @@
    29.4 +/*
    29.5 +  Simple DirectMedia Layer
    29.6 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    29.7 +
    29.8 +  This software is provided 'as-is', without any express or implied
    29.9 +  warranty.  In no event will the authors be held liable for any damages
   29.10 +  arising from the use of this software.
   29.11 +
   29.12 +  Permission is granted to anyone to use this software for any purpose,
   29.13 +  including commercial applications, and to alter it and redistribute it
   29.14 +  freely, subject to the following restrictions:
   29.15 +
   29.16 +  1. The origin of this software must not be misrepresented; you must not
   29.17 +     claim that you wrote the original software. If you use this software
   29.18 +     in a product, an acknowledgment in the product documentation would be
   29.19 +     appreciated but is not required.
   29.20 +  2. Altered source versions must be plainly marked as such, and must not be
   29.21 +     misrepresented as being the original software.
   29.22 +  3. This notice may not be removed or altered from any source distribution.
   29.23 +*/
   29.24 +
   29.25 +#include "../../SDL_internal.h"
   29.26 +#include "../SDL_syslocale.h"
   29.27 +
   29.28 +void
   29.29 +SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
   29.30 +{
   29.31 +    Android_JNI_GetLocale(buf, buflen);
   29.32 +}
   29.33 +
   29.34 +/* vi: set ts=4 sw=4 expandtab: */
   29.35 +
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/src/locale/dummy/SDL_syslocale.c	Mon May 04 02:27:29 2020 -0400
    30.3 @@ -0,0 +1,33 @@
    30.4 +/*
    30.5 +  Simple DirectMedia Layer
    30.6 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    30.7 +
    30.8 +  This software is provided 'as-is', without any express or implied
    30.9 +  warranty.  In no event will the authors be held liable for any damages
   30.10 +  arising from the use of this software.
   30.11 +
   30.12 +  Permission is granted to anyone to use this software for any purpose,
   30.13 +  including commercial applications, and to alter it and redistribute it
   30.14 +  freely, subject to the following restrictions:
   30.15 +
   30.16 +  1. The origin of this software must not be misrepresented; you must not
   30.17 +     claim that you wrote the original software. If you use this software
   30.18 +     in a product, an acknowledgment in the product documentation would be
   30.19 +     appreciated but is not required.
   30.20 +  2. Altered source versions must be plainly marked as such, and must not be
   30.21 +     misrepresented as being the original software.
   30.22 +  3. This notice may not be removed or altered from any source distribution.
   30.23 +*/
   30.24 +
   30.25 +#include "../../SDL_internal.h"
   30.26 +#include "../SDL_syslocale.h"
   30.27 +
   30.28 +void
   30.29 +SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
   30.30 +{
   30.31 +    /* dummy implementation. Caller already zero'd out buffer. */
   30.32 +    SDL_Unsupported();
   30.33 +}
   30.34 +
   30.35 +/* vi: set ts=4 sw=4 expandtab: */
   30.36 +
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/src/locale/emscripten/SDL_syslocale.c	Mon May 04 02:27:29 2020 -0400
    31.3 @@ -0,0 +1,72 @@
    31.4 +/*
    31.5 +  Simple DirectMedia Layer
    31.6 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    31.7 +
    31.8 +  This software is provided 'as-is', without any express or implied
    31.9 +  warranty.  In no event will the authors be held liable for any damages
   31.10 +  arising from the use of this software.
   31.11 +
   31.12 +  Permission is granted to anyone to use this software for any purpose,
   31.13 +  including commercial applications, and to alter it and redistribute it
   31.14 +  freely, subject to the following restrictions:
   31.15 +
   31.16 +  1. The origin of this software must not be misrepresented; you must not
   31.17 +     claim that you wrote the original software. If you use this software
   31.18 +     in a product, an acknowledgment in the product documentation would be
   31.19 +     appreciated but is not required.
   31.20 +  2. Altered source versions must be plainly marked as such, and must not be
   31.21 +     misrepresented as being the original software.
   31.22 +  3. This notice may not be removed or altered from any source distribution.
   31.23 +*/
   31.24 +
   31.25 +#include <emscripten.h>
   31.26 +
   31.27 +#include "../../SDL_internal.h"
   31.28 +#include "../SDL_syslocale.h"
   31.29 +
   31.30 +void
   31.31 +SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
   31.32 +{
   31.33 +    EM_ASM({
   31.34 +        var buf = $0;
   31.35 +        var buflen = $1;
   31.36 +        var list = undefined;
   31.37 +
   31.38 +        if (navigator.languages && navigator.languages.length) {
   31.39 +            list = navigator.languages;
   31.40 +        } else {
   31.41 +            var oneOfThese = navigator.userLanguage || navigator.language || navigator.browserLanguage || navigator.systemLanguage;
   31.42 +            if (oneOfThese !== undefined) {
   31.43 +                list = [ oneOfThese ];
   31.44 +            }
   31.45 +        }
   31.46 +
   31.47 +        if (list === undefined) {
   31.48 +            return;  /* we've got nothing. */
   31.49 +        }
   31.50 +
   31.51 +        var str = "";  /* Can't do list.join() because we need to fit in buflen. */
   31.52 +        for (var i = 0; i < list.length; i++) {
   31.53 +            var item = list[i];
   31.54 +            if ((str.length + item.length + 1) > buflen) {
   31.55 +                break;   /* don't add, we're out of space. */
   31.56 +            }
   31.57 +            if (str.length > 0) {
   31.58 +                str += ",";
   31.59 +            }
   31.60 +            str += item;
   31.61 +        }
   31.62 +
   31.63 +        str = str.replace(/-/g, "_");
   31.64 +        if (buflen > str.length) {
   31.65 +            buflen = str.length;  /* clamp to size of string. */
   31.66 +        }
   31.67 +
   31.68 +        for (var i = 0; i < buflen; i++) {
   31.69 +            setValue(buf + i, str.charCodeAt(i), "i8");  /* fill in C array. */
   31.70 +        }
   31.71 +    }, buf, buflen);
   31.72 +}
   31.73 +
   31.74 +/* vi: set ts=4 sw=4 expandtab: */
   31.75 +
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/src/locale/haiku/SDL_syslocale.cc	Mon May 04 02:27:29 2020 -0400
    32.3 @@ -0,0 +1,75 @@
    32.4 +/*
    32.5 +  Simple DirectMedia Layer
    32.6 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    32.7 +
    32.8 +  This software is provided 'as-is', without any express or implied
    32.9 +  warranty.  In no event will the authors be held liable for any damages
   32.10 +  arising from the use of this software.
   32.11 +
   32.12 +  Permission is granted to anyone to use this software for any purpose,
   32.13 +  including commercial applications, and to alter it and redistribute it
   32.14 +  freely, subject to the following restrictions:
   32.15 +
   32.16 +  1. The origin of this software must not be misrepresented; you must not
   32.17 +     claim that you wrote the original software. If you use this software
   32.18 +     in a product, an acknowledgment in the product documentation would be
   32.19 +     appreciated but is not required.
   32.20 +  2. Altered source versions must be plainly marked as such, and must not be
   32.21 +     misrepresented as being the original software.
   32.22 +  3. This notice may not be removed or altered from any source distribution.
   32.23 +*/
   32.24 +
   32.25 +#include <LocaleRoster.h>
   32.26 +
   32.27 +#include "../../SDL_internal.h"
   32.28 +#include "../SDL_syslocale.h"
   32.29 +
   32.30 +void
   32.31 +SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
   32.32 +{
   32.33 +    BLocaleRoster *roster = BLocaleRoster::Default();
   32.34 +    roster->Refresh();
   32.35 +
   32.36 +    BMessage msg;
   32.37 +    if (roster->GetPreferredLanguages(&msg) != B_OK) {
   32.38 +        SDL_SetError("BLocaleRoster couldn't get preferred languages");
   32.39 +        return;
   32.40 +    }
   32.41 +
   32.42 +    const char *key = "language";
   32.43 +    type_code typ = B_ANY_TYPE;
   32.44 +    int32 numlangs = 0;
   32.45 +    if ((msg.GetInfo(key, &typ, &numlangs) != B_OK) || (typ != B_STRING_TYPE)) {
   32.46 +        SDL_SetError("BLocaleRoster message was wrong");
   32.47 +        return;
   32.48 +    }
   32.49 +
   32.50 +    for (int32 i = 0; i < numlangs; i++) {
   32.51 +        const char *str = NULL;
   32.52 +        if (msg.FindString(key, i, &str) != B_OK) {
   32.53 +            continue;
   32.54 +        }
   32.55 +
   32.56 +        const size_t len = SDL_strlen(str);
   32.57 +        if (buflen <= len) {
   32.58 +            break;  // can't fit it, we're done.
   32.59 +        }
   32.60 +
   32.61 +        SDL_strlcpy(buf, str, buflen);
   32.62 +        buf += len;
   32.63 +        buflen -= len;
   32.64 +
   32.65 +        if (i < (numlangs - 1)) {
   32.66 +            if (buflen <= 1) {
   32.67 +                break;  // out of room, stop looking.
   32.68 +            }
   32.69 +            buf[0] = ',';  // add a comma between entries.
   32.70 +            buf[1] = '\0';
   32.71 +            buf++;
   32.72 +            buflen--;
   32.73 +        }
   32.74 +    }
   32.75 +}
   32.76 +
   32.77 +/* vi: set ts=4 sw=4 expandtab: */
   32.78 +
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/src/locale/macosx/SDL_syslocale.m	Mon May 04 02:27:29 2020 -0400
    33.3 @@ -0,0 +1,76 @@
    33.4 +/*
    33.5 +  Simple DirectMedia Layer
    33.6 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    33.7 +
    33.8 +  This software is provided 'as-is', without any express or implied
    33.9 +  warranty.  In no event will the authors be held liable for any damages
   33.10 +  arising from the use of this software.
   33.11 +
   33.12 +  Permission is granted to anyone to use this software for any purpose,
   33.13 +  including commercial applications, and to alter it and redistribute it
   33.14 +  freely, subject to the following restrictions:
   33.15 +
   33.16 +  1. The origin of this software must not be misrepresented; you must not
   33.17 +     claim that you wrote the original software. If you use this software
   33.18 +     in a product, an acknowledgment in the product documentation would be
   33.19 +     appreciated but is not required.
   33.20 +  2. Altered source versions must be plainly marked as such, and must not be
   33.21 +     misrepresented as being the original software.
   33.22 +  3. This notice may not be removed or altered from any source distribution.
   33.23 +*/
   33.24 +
   33.25 +#include "../../SDL_internal.h"
   33.26 +#include "../SDL_syslocale.h"
   33.27 +
   33.28 +#import <Foundation/Foundation.h>
   33.29 +
   33.30 +void
   33.31 +SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
   33.32 +{ @autoreleasepool {
   33.33 +    NSArray *languages = NSLocale.preferredLanguages;
   33.34 +    size_t numlangs = 0;
   33.35 +    size_t i;
   33.36 +
   33.37 +    numlangs = (size_t) [languages count];
   33.38 +
   33.39 +    for (i = 0; i < numlangs; i++) {
   33.40 +        NSString *nsstr = [languages objectAtIndex:i];
   33.41 +        size_t len;
   33.42 +        char *ptr;
   33.43 +
   33.44 +        if (nsstr == nil) {
   33.45 +            break;
   33.46 +        }
   33.47 +
   33.48 +        [nsstr getCString:buf maxLength:buflen encoding:NSASCIIStringEncoding];
   33.49 +        len = SDL_strlen(buf);
   33.50 +
   33.51 +        // convert '-' to '_'...
   33.52 +        //  These are always full lang-COUNTRY, so we search from the back,
   33.53 +        //  so things like zh-Hant-CN find the right '-' to convert.
   33.54 +        if ((ptr = SDL_strrchr(buf, '-')) != NULL) {
   33.55 +            *ptr = '_';
   33.56 +        }
   33.57 +
   33.58 +        if (buflen <= len) {
   33.59 +            *buf = '\0';  // drop this one and stop, we can't fit anymore.
   33.60 +            break;
   33.61 +        }
   33.62 +
   33.63 +        buf += len;
   33.64 +        buflen -= len;
   33.65 +
   33.66 +        if (i < (numlangs - 1)) {
   33.67 +            if (buflen <= 1) {
   33.68 +                break;  // out of room, stop looking.
   33.69 +            }
   33.70 +            buf[0] = ',';  // add a comma between entries.
   33.71 +            buf[1] = '\0';
   33.72 +            buf++;
   33.73 +            buflen--;
   33.74 +        }
   33.75 +    }
   33.76 +}}
   33.77 +
   33.78 +/* vi: set ts=4 sw=4 expandtab: */
   33.79 +
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/src/locale/unix/SDL_syslocale.c	Mon May 04 02:27:29 2020 -0400
    34.3 @@ -0,0 +1,110 @@
    34.4 +/*
    34.5 +  Simple DirectMedia Layer
    34.6 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    34.7 +
    34.8 +  This software is provided 'as-is', without any express or implied
    34.9 +  warranty.  In no event will the authors be held liable for any damages
   34.10 +  arising from the use of this software.
   34.11 +
   34.12 +  Permission is granted to anyone to use this software for any purpose,
   34.13 +  including commercial applications, and to alter it and redistribute it
   34.14 +  freely, subject to the following restrictions:
   34.15 +
   34.16 +  1. The origin of this software must not be misrepresented; you must not
   34.17 +     claim that you wrote the original software. If you use this software
   34.18 +     in a product, an acknowledgment in the product documentation would be
   34.19 +     appreciated but is not required.
   34.20 +  2. Altered source versions must be plainly marked as such, and must not be
   34.21 +     misrepresented as being the original software.
   34.22 +  3. This notice may not be removed or altered from any source distribution.
   34.23 +*/
   34.24 +
   34.25 +#include "../../SDL_internal.h"
   34.26 +#include "../SDL_syslocale.h"
   34.27 +#include "SDL_assert.h"
   34.28 +
   34.29 +static void
   34.30 +normalize_locale_str(char *dst, char *str, size_t buflen)
   34.31 +{
   34.32 +    char *ptr;
   34.33 +
   34.34 +    ptr = SDL_strchr(str, '.');  /* chop off encoding if specified. */
   34.35 +    if (ptr != NULL) {
   34.36 +        *ptr = '\0';
   34.37 +    }
   34.38 +
   34.39 +    ptr = SDL_strchr(str, '@');  /* chop off extra bits if specified. */
   34.40 +    if (ptr != NULL) {
   34.41 +        *ptr = '\0';
   34.42 +    }
   34.43 +
   34.44 +    /* The "C" locale isn't useful for our needs, ignore it if you see it. */
   34.45 +    if ((str[0] == 'C') && (str[1] == '\0')) {
   34.46 +        return;
   34.47 +    }
   34.48 +
   34.49 +    if (*str) {
   34.50 +        if (*dst) {
   34.51 +            SDL_strlcat(dst, ",", buflen);  /* SDL has these split by commas */
   34.52 +        }
   34.53 +        SDL_strlcat(dst, str, buflen);
   34.54 +    }
   34.55 +}
   34.56 +
   34.57 +static void
   34.58 +normalize_locales(char *dst, char *src, size_t buflen)
   34.59 +{
   34.60 +    char *ptr;
   34.61 +
   34.62 +    /* entries are separated by colons */
   34.63 +    while ((ptr = SDL_strchr(src, ':')) != NULL) {
   34.64 +        *ptr = '\0';
   34.65 +        normalize_locale_str(dst, src, buflen);
   34.66 +        src = ptr + 1;
   34.67 +    }
   34.68 +    normalize_locale_str(dst, src, buflen);
   34.69 +}
   34.70 +
   34.71 +void
   34.72 +SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
   34.73 +{
   34.74 +    /* !!! FIXME: should we be using setlocale()? Or some D-Bus thing? */
   34.75 +    SDL_bool isstack;
   34.76 +    const char *envr;
   34.77 +    char *tmp;
   34.78 +
   34.79 +    SDL_assert(buflen > 0);
   34.80 +    tmp = SDL_small_alloc(char, buflen, &isstack);
   34.81 +    if (!tmp) {
   34.82 +        SDL_OutOfMemory();
   34.83 +        return;
   34.84 +    }
   34.85 +
   34.86 +    *tmp = '\0';
   34.87 +
   34.88 +    /* LANG is the primary locale (maybe) */
   34.89 +    envr = SDL_getenv("LANG");
   34.90 +    if (envr) {
   34.91 +        SDL_strlcpy(tmp, envr, buflen);
   34.92 +    }
   34.93 +
   34.94 +    /* fallback languages */
   34.95 +    envr = SDL_getenv("LANGUAGE");
   34.96 +    if (envr) {
   34.97 +        if (*tmp) {
   34.98 +            SDL_strlcat(tmp, ":", buflen);
   34.99 +        }
  34.100 +        SDL_strlcat(tmp, envr, buflen);
  34.101 +    }
  34.102 +
  34.103 +    if (*tmp == '\0') {
  34.104 +        SDL_SetError("LANG environment variable isn't set");
  34.105 +    } else {
  34.106 +        normalize_locales(buf, tmp, buflen);
  34.107 +    }
  34.108 +
  34.109 +    SDL_small_free(tmp, isstack);
  34.110 +}
  34.111 +
  34.112 +/* vi: set ts=4 sw=4 expandtab: */
  34.113 +
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/src/locale/windows/SDL_syslocale.c	Mon May 04 02:27:29 2020 -0400
    35.3 @@ -0,0 +1,119 @@
    35.4 +/*
    35.5 +  Simple DirectMedia Layer
    35.6 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    35.7 +
    35.8 +  This software is provided 'as-is', without any express or implied
    35.9 +  warranty.  In no event will the authors be held liable for any damages
   35.10 +  arising from the use of this software.
   35.11 +
   35.12 +  Permission is granted to anyone to use this software for any purpose,
   35.13 +  including commercial applications, and to alter it and redistribute it
   35.14 +  freely, subject to the following restrictions:
   35.15 +
   35.16 +  1. The origin of this software must not be misrepresented; you must not
   35.17 +     claim that you wrote the original software. If you use this software
   35.18 +     in a product, an acknowledgment in the product documentation would be
   35.19 +     appreciated but is not required.
   35.20 +  2. Altered source versions must be plainly marked as such, and must not be
   35.21 +     misrepresented as being the original software.
   35.22 +  3. This notice may not be removed or altered from any source distribution.
   35.23 +*/
   35.24 +
   35.25 +#include "../../SDL_internal.h"
   35.26 +#include "../../core/windows/SDL_windows.h"
   35.27 +#include "../SDL_syslocale.h"
   35.28 +#include "SDL_assert.h"
   35.29 +
   35.30 +typedef BOOL (WINAPI *pfnGetUserPreferredUILanguages)(DWORD,PULONG,PZZWSTR,PULONG);
   35.31 +#ifndef MUI_LANGUAGE_NAME
   35.32 +#define MUI_LANGUAGE_NAME 0x8 
   35.33 +#endif
   35.34 +
   35.35 +static pfnGetUserPreferredUILanguages pGetUserPreferredUILanguages = NULL;
   35.36 +static HMODULE kernel32 = 0;
   35.37 +
   35.38 +
   35.39 +/* this is the fallback for WinXP...one language, not a list. */
   35.40 +static void
   35.41 +SDL_SYS_GetPreferredLocales_winxp(char *buf, size_t buflen)
   35.42 +{
   35.43 +    const char **retval = NULL;
   35.44 +    char lang[16];
   35.45 +    char country[16];
   35.46 +
   35.47 +	const int langrc = GetLocaleInfoA(LOCALE_USER_DEFAULT,
   35.48 +                                      LOCALE_SISO639LANGNAME,
   35.49 +                                      lang, sizeof (lang));
   35.50 +
   35.51 +	const int ctryrc =  GetLocaleInfoA(LOCALE_USER_DEFAULT,
   35.52 +                                       LOCALE_SISO3166CTRYNAME,
   35.53 +                                       country, sizeof (country));
   35.54 +
   35.55 +    /* Win95 systems will fail, because they don't have LOCALE_SISO*NAME ... */
   35.56 +    if (langrc == 0) {
   35.57 +        SDL_SetError("Couldn't obtain language info");
   35.58 +    } else {
   35.59 +        SDL_snprintf(buf, buflen, "%s%s%s", lang, ctryrc ? "_" : "", ctryrc ? country : "");
   35.60 +    }
   35.61 +}
   35.62 +
   35.63 +/* this works on Windows Vista and later. */
   35.64 +static void
   35.65 +SDL_SYS_GetPreferredLocales_vista(char *buf, size_t buflen)
   35.66 +{
   35.67 +    ULONG numlangs = 0;
   35.68 +    WCHAR *wbuf = NULL;
   35.69 +    ULONG wbuflen = 0;
   35.70 +    SDL_bool isstack;
   35.71 +
   35.72 +    SDL_assert(pGetUserPreferredUILanguages != NULL);
   35.73 +    pGetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numlangs, NULL, &wbuflen);
   35.74 +
   35.75 +    wbuf = SDL_small_alloc(WCHAR, wbuflen, &isstack);
   35.76 +    if (!wbuf) {
   35.77 +        SDL_OutOfMemory();
   35.78 +        return;
   35.79 +    }
   35.80 +
   35.81 +    if (!pGetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numlangs, wbuf, &wbuflen)) {
   35.82 +        SDL_SYS_GetPreferredLocales_winxp(buf, buflen);  /* oh well, try the fallback. */
   35.83 +    } else {
   35.84 +        const ULONG endidx = SDL_min(buflen, wbuflen - 1);
   35.85 +        ULONG str_start = 0;
   35.86 +        ULONG i;
   35.87 +        for (i = 0; i < endidx; i++) {
   35.88 +            const char ch = (char) wbuf[i];  /* these should all be low-ASCII, safe to cast */
   35.89 +            if (ch == '\0') {
   35.90 +                buf[i] = ',';  /* change null separators to commas */
   35.91 +                str_start = i;
   35.92 +            } else if (ch == '-') {
   35.93 +                buf[i] = '_';  /* change '-' to '_' */
   35.94 +            } else {
   35.95 +                buf[i] = ch;   /* copy through as-is. */
   35.96 +            }
   35.97 +        }
   35.98 +        buf[str_start] = '\0';  /* terminate string, chop off final ',' */
   35.99 +    }
  35.100 +
  35.101 +    SDL_small_free(wbuf, isstack);
  35.102 +}
  35.103 +
  35.104 +void
  35.105 +SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
  35.106 +{
  35.107 +    if (!kernel32) {
  35.108 +        kernel32 = LoadLibraryW(L"kernel32.dll");
  35.109 +        if (kernel32) {
  35.110 +            pGetUserPreferredUILanguages = (pfnGetUserPreferredUILanguages) GetProcAddress(kernel32, "GetUserPreferredUILanguages");
  35.111 +        }
  35.112 +    }
  35.113 +
  35.114 +    if (pGetUserPreferredUILanguages == NULL) {
  35.115 +        SDL_SYS_GetPreferredLocales_winxp(buf, buflen);  /* this is always available */
  35.116 +    } else {
  35.117 +        SDL_SYS_GetPreferredLocales_vista(buf, buflen);  /* available on Vista and later. */
  35.118 +    }
  35.119 +}
  35.120 +
  35.121 +/* vi: set ts=4 sw=4 expandtab: */
  35.122 +
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/src/locale/winrt/SDL_syslocale.c	Mon May 04 02:27:29 2020 -0400
    36.3 @@ -0,0 +1,58 @@
    36.4 +/*
    36.5 +  Simple DirectMedia Layer
    36.6 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    36.7 +
    36.8 +  This software is provided 'as-is', without any express or implied
    36.9 +  warranty.  In no event will the authors be held liable for any damages
   36.10 +  arising from the use of this software.
   36.11 +
   36.12 +  Permission is granted to anyone to use this software for any purpose,
   36.13 +  including commercial applications, and to alter it and redistribute it
   36.14 +  freely, subject to the following restrictions:
   36.15 +
   36.16 +  1. The origin of this software must not be misrepresented; you must not
   36.17 +     claim that you wrote the original software. If you use this software
   36.18 +     in a product, an acknowledgment in the product documentation would be
   36.19 +     appreciated but is not required.
   36.20 +  2. Altered source versions must be plainly marked as such, and must not be
   36.21 +     misrepresented as being the original software.
   36.22 +  3. This notice may not be removed or altered from any source distribution.
   36.23 +*/
   36.24 +
   36.25 +#include <Windows.h>
   36.26 +
   36.27 +#include "../../SDL_internal.h"
   36.28 +#include "../SDL_syslocale.h"
   36.29 +
   36.30 +/*using namespace Windows::Graphics::Display;*/
   36.31 +#include <wchar.h>
   36.32 +
   36.33 +void
   36.34 +SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
   36.35 +{
   36.36 +    WCHAR wbuffer[128] = L"";
   36.37 +    int ret = 0;
   36.38 +
   36.39 +    /* !!! FIXME: do we not have GetUserPreferredUILanguages on WinPhone or UWP? */
   36.40 +# if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
   36.41 +    ret = GetLocaleInfoEx(LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_SNAME, wbuffer, SDL_arraylen(wbuffer));
   36.42 +# else
   36.43 +    ret = GetSystemDefaultLocaleName(wbuffer, SDL_arraysize(wbuffer));
   36.44 +# endif
   36.45 +
   36.46 +    if (ret > 0)
   36.47 +    {
   36.48 +        /* Need to convert LPWSTR to LPSTR, that is wide char to char. */
   36.49 +        int i;
   36.50 +
   36.51 +        if (ret >= (buflen - 1) ) {
   36.52 +            ret = (int) (buflen - 1);
   36.53 +        }
   36.54 +        for (i = 0; i < ret; i++) {
   36.55 +            buf[i] = (char) wbuffer[i];  /* assume this was ASCII anyhow. */
   36.56 +        }
   36.57 +    }
   36.58 +}
   36.59 +
   36.60 +/* vi: set ts=4 sw=4 expandtab: */
   36.61 +
    37.1 --- a/src/main/haiku/SDL_BApp.h	Wed May 06 12:19:58 2020 -0700
    37.2 +++ b/src/main/haiku/SDL_BApp.h	Mon May 04 02:27:29 2020 -0400
    37.3 @@ -22,6 +22,7 @@
    37.4  #define SDL_BAPP_H
    37.5  
    37.6  #include <InterfaceKit.h>
    37.7 +#include <LocaleRoster.h>
    37.8  #if SDL_VIDEO_OPENGL
    37.9  #include <OpenGLKit.h>
   37.10  #endif
   37.11 @@ -153,6 +154,10 @@
   37.12              _HandleWindowResized(message);
   37.13              break;
   37.14  
   37.15 +        case B_LOCALE_CHANGED:
   37.16 +            SDL_SendLocaleChangedEvent();
   37.17 +            break;
   37.18 +
   37.19          case BAPP_SCREEN_CHANGED:
   37.20              /* TODO: Handle screen resize or workspace change */
   37.21              break;
    38.1 --- a/src/video/cocoa/SDL_cocoaevents.m	Wed May 06 12:19:58 2020 -0700
    38.2 +++ b/src/video/cocoa/SDL_cocoaevents.m	Mon May 04 02:27:29 2020 -0400
    38.3 @@ -117,6 +117,7 @@
    38.4  }
    38.5  
    38.6  - (id)init;
    38.7 +- (void)localeDidChange:(NSNotification *)notification;
    38.8  @end
    38.9  
   38.10  @implementation SDLAppDelegate : NSObject
   38.11 @@ -137,6 +138,11 @@
   38.12                     selector:@selector(focusSomeWindow:)
   38.13                         name:NSApplicationDidBecomeActiveNotification
   38.14                       object:nil];
   38.15 +
   38.16 +        [center addObserver:self
   38.17 +                   selector:@selector(localeDidChange:)
   38.18 +                       name:NSCurrentLocaleDidChangeNotification
   38.19 +                     object:nil];
   38.20      }
   38.21  
   38.22      return self;
   38.23 @@ -148,6 +154,7 @@
   38.24  
   38.25      [center removeObserver:self name:NSWindowWillCloseNotification object:nil];
   38.26      [center removeObserver:self name:NSApplicationDidBecomeActiveNotification object:nil];
   38.27 +    [center removeObserver:self name:NSCurrentLocaleDidChangeNotification object:nil];
   38.28  
   38.29      [super dealloc];
   38.30  }
   38.31 @@ -226,6 +233,11 @@
   38.32      }
   38.33  }
   38.34  
   38.35 +- (void)localeDidChange:(NSNotification *)notification;
   38.36 +{
   38.37 +    SDL_SendLocaleChangedEvent();
   38.38 +}
   38.39 +
   38.40  - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
   38.41  {
   38.42      return (BOOL)SDL_SendDropFile(NULL, [filename UTF8String]) && SDL_SendDropComplete(NULL);
    39.1 --- a/test/Makefile.in	Wed May 06 12:19:58 2020 -0700
    39.2 +++ b/test/Makefile.in	Mon May 04 02:27:29 2020 -0400
    39.3 @@ -37,6 +37,7 @@
    39.4  	testjoystick$(EXE) \
    39.5  	testkeys$(EXE) \
    39.6  	testloadso$(EXE) \
    39.7 +	testlocale$(EXE) \
    39.8  	testlock$(EXE) \
    39.9  	testmessage$(EXE) \
   39.10  	testmultiaudio$(EXE) \
   39.11 @@ -303,6 +304,10 @@
   39.12  testvulkan$(EXE): $(srcdir)/testvulkan.c
   39.13  	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   39.14  
   39.15 +testlocale$(EXE): $(srcdir)/testlocale.c
   39.16 +	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
   39.17 +
   39.18 +
   39.19  
   39.20  clean:
   39.21  	rm -f $(TARGETS)
    40.1 --- a/test/README	Wed May 06 12:19:58 2020 -0700
    40.2 +++ b/test/README	Mon May 04 02:27:29 2020 -0400
    40.3 @@ -12,6 +12,7 @@
    40.4  	testjoystick	List joysticks and watch joystick events
    40.5  	testkeys	List the available keyboard keys
    40.6  	testloadso	Tests the loadable library layer
    40.7 +	testlocale  Test Locale API
    40.8  	testlock	Hacked up test of multi-threading and locking
    40.9  	testmultiaudio	Tests using several audio devices
   40.10  	testoverlay2	Tests the overlay flickering/scaling during playback.
    41.1 --- a/test/configure	Wed May 06 12:19:58 2020 -0700
    41.2 +++ b/test/configure	Mon May 04 02:27:29 2020 -0400
    41.3 @@ -640,6 +640,7 @@
    41.4  docdir
    41.5  oldincludedir
    41.6  includedir
    41.7 +runstatedir
    41.8  localstatedir
    41.9  sharedstatedir
   41.10  sysconfdir
   41.11 @@ -720,6 +721,7 @@
   41.12  sysconfdir='${prefix}/etc'
   41.13  sharedstatedir='${prefix}/com'
   41.14  localstatedir='${prefix}/var'
   41.15 +runstatedir='${localstatedir}/run'
   41.16  includedir='${prefix}/include'
   41.17  oldincludedir='/usr/include'
   41.18  docdir='${datarootdir}/doc/${PACKAGE}'
   41.19 @@ -972,6 +974,15 @@
   41.20    | -silent | --silent | --silen | --sile | --sil)
   41.21      silent=yes ;;
   41.22  
   41.23 +  -runstatedir | --runstatedir | --runstatedi | --runstated \
   41.24 +  | --runstate | --runstat | --runsta | --runst | --runs \
   41.25 +  | --run | --ru | --r)
   41.26 +    ac_prev=runstatedir ;;
   41.27 +  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
   41.28 +  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
   41.29 +  | --run=* | --ru=* | --r=*)
   41.30 +    runstatedir=$ac_optarg ;;
   41.31 +
   41.32    -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
   41.33      ac_prev=sbindir ;;
   41.34    -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
   41.35 @@ -1109,7 +1120,7 @@
   41.36  for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
   41.37  		datadir sysconfdir sharedstatedir localstatedir includedir \
   41.38  		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
   41.39 -		libdir localedir mandir
   41.40 +		libdir localedir mandir runstatedir
   41.41  do
   41.42    eval ac_val=\$$ac_var
   41.43    # Remove trailing slashes.
   41.44 @@ -1262,6 +1273,7 @@
   41.45    --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   41.46    --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   41.47    --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
   41.48 +  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   41.49    --libdir=DIR            object code libraries [EPREFIX/lib]
   41.50    --includedir=DIR        C header files [PREFIX/include]
   41.51    --oldincludedir=DIR     C header files for non-gcc [/usr/include]
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/test/testlocale.c	Mon May 04 02:27:29 2020 -0400
    42.3 @@ -0,0 +1,67 @@
    42.4 +/*
    42.5 +  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
    42.6 +
    42.7 +  This software is provided 'as-is', without any express or implied
    42.8 +  warranty.  In no event will the authors be held liable for any damages
    42.9 +  arising from the use of this software.
   42.10 +
   42.11 +  Permission is granted to anyone to use this software for any purpose,
   42.12 +  including commercial applications, and to alter it and redistribute it
   42.13 +  freely.
   42.14 +*/
   42.15 +#include <stdio.h>
   42.16 +#include "SDL.h"
   42.17 +
   42.18 +/* !!! FIXME: move this to the test framework */
   42.19 +
   42.20 +static void log_locales(void)
   42.21 +{
   42.22 +    SDL_Locale *locales = SDL_GetPreferredLocales();
   42.23 +    if (locales == NULL) {
   42.24 +        SDL_Log("Couldn't determine locales: %s", SDL_GetError());
   42.25 +    } else {
   42.26 +        SDL_Locale *l;
   42.27 +        unsigned int total = 0;
   42.28 +        SDL_Log("Locales, in order of preference:");
   42.29 +        for (l = locales; l->language; l++) {
   42.30 +            const char *c = l->country;
   42.31 +            SDL_Log(" - %s%s%s", l->language, c ? "_" : "", c ? c : "");
   42.32 +            total++;
   42.33 +        }
   42.34 +        SDL_Log("%u locales seen.", total);
   42.35 +        SDL_free(locales);
   42.36 +    }
   42.37 +}
   42.38 +
   42.39 +int main(int argc, char **argv)
   42.40 +{
   42.41 +    /* Enable standard application logging */
   42.42 +    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
   42.43 +
   42.44 +    /* Print locales and languages */
   42.45 +    if (SDL_Init(SDL_INIT_VIDEO) != -1) {
   42.46 +        log_locales();
   42.47 +
   42.48 +        if ((argc == 2) && (SDL_strcmp(argv[1], "--listen") == 0)) {
   42.49 +            SDL_bool keep_going = SDL_TRUE;
   42.50 +            while (keep_going) {
   42.51 +                SDL_Event e;
   42.52 +                while (SDL_PollEvent(&e)) {
   42.53 +                    if (e.type == SDL_QUIT) {
   42.54 +                        keep_going = SDL_FALSE;
   42.55 +                    } else if (e.type == SDL_LOCALECHANGED) {
   42.56 +                        SDL_Log("Saw SDL_LOCALECHANGED event!");
   42.57 +                        log_locales();
   42.58 +                    }
   42.59 +                }
   42.60 +                SDL_Delay(10);
   42.61 +            }
   42.62 +        }
   42.63 +
   42.64 +        SDL_Quit();
   42.65 +    }
   42.66 +
   42.67 +   return 0;
   42.68 +}
   42.69 +
   42.70 +/* vi: set ts=4 sw=4 expandtab: */