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 » Thu May 16, 2019 9:10 pm

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: 52
Joined: Thu Feb 19, 2015 10:56 pm
Location: Ru
Contact:

Re: Android language

Post by HDPLocust » Fri May 17, 2019 12:10 am

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: 720
Joined: Sat Apr 26, 2014 7:46 pm

Re: Android language

Post by bobbyjones » Fri May 17, 2019 4:22 am

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?
Do you frequently have great ideas but immediately lose them? Check out the MVP for my website called IdeaVault. It is designed to solve that problem. Desktop browsers only currently.

Kev
Prole
Posts: 8
Joined: Tue Mar 19, 2019 8:34 pm

Re: Android language

Post by Kev » Fri May 17, 2019 5:01 am

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: 1901
Joined: Mon Jun 17, 2013 12:00 pm

Re: Android language

Post by raidho36 » Fri May 17, 2019 6:11 am

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: 720
Joined: Sat Apr 26, 2014 7:46 pm

Re: Android language

Post by bobbyjones » Fri May 17, 2019 6:45 pm

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.
Do you frequently have great ideas but immediately lose them? Check out the MVP for my website called IdeaVault. It is designed to solve that problem. Desktop browsers only currently.

Kev
Prole
Posts: 8
Joined: Tue Mar 19, 2019 8:34 pm

Re: Android language

Post by Kev » Mon May 20, 2019 8:07 pm

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

Post Reply

Who is online

Users browsing this forum: master both, nac45, Nelvin, slime and 6 guests