From d48a1bd22d624bfe381d5e1770aab14f2c59c142 Mon Sep 17 00:00:00 2001 From: Didier Vandekerckhove Date: Fri, 16 Oct 2015 19:42:26 +0200 Subject: [PATCH] Added specific get_locale to OSX platform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default unix get_locale didn’t work. OS X requires a specific one. --- platform/osx/os_osx.h | 2 ++ platform/osx/os_osx.mm | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 49fa6c0862c..e8277688acb 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -157,6 +157,8 @@ public: Error shell_open(String p_uri); void push_input(const InputEvent& p_event); + String get_locale() const; + virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0); virtual VideoMode get_video_mode(int p_screen=0) const; virtual void get_fullscreen_mode_list(List *p_list,int p_screen=0) const; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index b0ce37cecfd..4990d04ab64 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1254,6 +1254,11 @@ Error OS_OSX::shell_open(String p_uri) { return OK; } +String OS_OSX::get_locale() const { + NSString* preferredLang = [[NSLocale preferredLanguages] objectAtIndex:0]; + return [preferredLang UTF8String]; +} + void OS_OSX::swap_buffers() { [context flushBuffer];