macOS: fix locale detection

master
Maksim 2020-11-03 23:45:00 +01:00
parent 3849ef3474
commit c527b25094
2 changed files with 3 additions and 0 deletions

View File

@ -16,6 +16,8 @@
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
local lang = core.settings:get("language")
if not (lang and (lang ~= "")) then lang = os.getenv("LANG") end
local function get_formspec()
local index = filterlist.get_current_index(menudata.worldlist,
tonumber(core.settings:get("mainmenu_last_selected_world")))

View File

@ -226,6 +226,7 @@ void init_gettext(const char *path, const std::string &configured_language,
NSString *syslang = [[NSLocale preferredLanguages] firstObject];
[syslang getBytes:lang maxLength:2 usedLength:nil encoding:NSASCIIStringEncoding options:0 range:NSMakeRange(0, 2) remainingRange:nil];
setenv("LANGUAGE", lang, 1);
setenv("LANG", lang, 1);
#endif
setlocale(LC_ALL, "");
}