Page 1 of 1

Android language

Posted: Thu May 16, 2019 9:10 pm
by Kev
hello i'm on löve for android and i'm trying to get the default OS language i know os.getenv () can do it but i do not know the name of the environment variable containing the language

Re: Android language

Posted: Fri May 17, 2019 12:10 am
by HDPLocust
You can use locale shell command, but no guarantees. It's ok, don't use it, just ask user about preferred language at first launch. It's better way, srsly.

Re: Android language

Posted: Fri May 17, 2019 4:22 am
by bobbyjones
Looking up online it looks like CoronaSDK approaches this problem by having a preferences method in their system module. Maybe Love should have the same thing?

Re: Android language

Posted: Fri May 17, 2019 5:01 am
by Kev
thank you for the answer I will ask the user at launch
bobbyjones: i have been looking at löve references for a few times but he seems to have nothing

Re: Android language

Posted: Fri May 17, 2019 6:11 am
by raidho36
The relevant environment variable names are "LANG" and "LC_ALL". These are from UNIX specifications. Android uses Linux kernel which isn't UNIX, but is UNIX-like and supports these variables. Apple OSes are straight UNIX.

The to-go way of handling multiple languages is to simply have a language selector in menu.

Re: Android language

Posted: Fri May 17, 2019 6:45 pm
by bobbyjones
Do LANG and LC_ALL work on android? I read that it does not work. I believe the only way to access the Locale and language is through JNI.

Re: Android language

Posted: Mon May 20, 2019 8:07 pm
by Kev
I confirm LANG and LC_ALL do not work.How can I use JNI?