Android language

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Kev
Prole
Posts: 8
Joined: Tue Mar 19, 2019 8:34 pm

Android language

Post 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
User avatar
HDPLocust
Citizen
Posts: 65
Joined: Thu Feb 19, 2015 10:56 pm
Location: Swamp
Contact:

Re: Android language

Post 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.
Science and violence
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Android language

Post 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?
Kev
Prole
Posts: 8
Joined: Tue Mar 19, 2019 8:34 pm

Re: Android language

Post 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
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Android language

Post 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.
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Android language

Post 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.
Kev
Prole
Posts: 8
Joined: Tue Mar 19, 2019 8:34 pm

Re: Android language

Post by Kev »

I confirm LANG and LC_ALL do not work.How can I use JNI?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests