How to set up multiple languages ​​on Android

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Trafitto
Prole
Posts: 4
Joined: Fri Jan 26, 2018 4:06 pm
Contact:

How to set up multiple languages ​​on Android

Post by Trafitto »

Hello,
I wanted to know if there is a way to set the multilanguage on Android

Thanks!!
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How to set up multiple languages ​​on Android

Post by zorg »

If your question is can you code your app to support multiple languages, then yes, if you code it as such.
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.
Trafitto
Prole
Posts: 4
Joined: Fri Jan 26, 2018 4:06 pm
Contact:

Re: How to set up multiple languages ​​on Android

Post by Trafitto »

Ok, so is there nothing already made ? I have to make the folder res/values/strings.xml and handle by myself ?
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How to set up multiple languages ​​on Android

Post by zorg »

I think there might be a misconception here, or we're talking about two different things.

Löve works the same on all platforms it supports, Android and iOS included; you have your data in the .love file, which is a renamed zip, and for android, you build an application with that included with the löve app so it runs your own project (or, for development purposes, you just download the plain löve app, and there's a single folder where you can put your code and resources to develop/test).

I found the below link, and i don't think that's needed for whatever you want to accomplish; multi-language support with löve can work in a myriad ways.
http://android.tutorialhorizon.com/what-is-strings-xml/

For example, here's a lib one could use:
https://github.com/kikito/i18n.lua
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.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: How to set up multiple languages ​​on Android

Post by raidho36 »

You can do something as simple as

Code: Select all

selected_language = "EN"
text = require ( "text/" .. selected_language .. "/dialogue123.lua" )
love.graphics.print ( text.greeting, 100, 100 )
Where the dialogue file returns a Lua table with relevant entries.
Trafitto
Prole
Posts: 4
Joined: Fri Jan 26, 2018 4:06 pm
Contact:

Re: How to set up multiple languages ​​on Android

Post by Trafitto »

Thanks everyone, i was wondaring that if i wouldnt use the "android way" to handle multi language my app wouldnt be recognized properly multi language by the play store :)
User avatar
Ulydev
Party member
Posts: 445
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

Re: How to set up multiple languages ​​on Android

Post by Ulydev »

Trafitto wrote: Wed Feb 07, 2018 8:58 am Thanks everyone, i was wondaring that if i wouldnt use the "android way" to handle multi language my app wouldnt be recognized properly multi language by the play store :)
I believe using ffi or digging into the Java code you could implement a function that returns the phone locale and translate based on that.
Either way there's no such built-in function as far as I know, I might be wrong though.
Post Reply

Who is online

Users browsing this forum: No registered users and 78 guests