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: 7
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
Prole
Posts: 48
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: 704
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?
Check out my most recent medium post, please give feedback.
Link

Kev
Prole
Posts: 7
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: 1740
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: 704
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.
Check out my most recent medium post, please give feedback.
Link

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests