how to get current locale from love session

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
User avatar
amightydish
Prole
Posts: 11
Joined: Fri May 12, 2017 5:18 pm

how to get current locale from love session

Post by amightydish »

Hi there,
I'm doing some cross platform development and would like to find out the language/locale settings of the current session.
I've found a few libraries about how to handle localization, once you know what language you are in.
I'm after something like

Code: Select all

locale = love.getLocale()
print(locale)
--> en

Is there functionality like that?

Thank you for any pointers!
User avatar
zorg
Party member
Posts: 3441
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: how to get current locale from love session

Post by zorg »

For games, people usually forget locales and just ask the user what language they want to use, if there's support for more than one. (And that's assuming that the games are using some flavour of unicode, many japanese ones don't, for example, though those don't even ask, they just usually fail with a non-japanese locale, on windows anyway.)

But, if you're really adamant, lua has this:

Code: Select all

local locale = os.setlocale() -- empty first parameter means return the current locale.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: No registered users and 151 guests