Multi language game

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
disaldo
Prole
Posts: 1
Joined: Sun Mar 01, 2009 10:17 pm

Multi language game

Post by disaldo »

Hi

Just started to use LOVE and its great. I am currently working on a project to help kids with Learning Disabilities and Difficulties to improve their vocabulary. This will be done through a game interface, basically the computer will randomly select card from the pack from them , Food, Utensils or Laundry and they will need to provide an answer to the question - say show a saucepan and they will select the word sauce pan or type it in. They score through getting answer correct and get double points if they answer it in English. The kids are from England, Sweden and Finland so the question will need to be in each language.

What is the best way to implement multi language should I do it as three separate Lua files and select the correct one from a menu or have one long lua file. Finally if I wanted to let other people add quetsions at a later date is it possible to call details from say an XML or CVS file from outside of the Love program.

I apologise for the long first time question, I feel that from some of the examples available I can make some games that will help these kids out I am just a bit stuck on the language issue.

Thanks in advance

Disdaldo
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Multi language game

Post by bartbes »

It all depends on coding-style, but it'd probably be cleaner using seperate files.
About adding new data later, you might want to look at Updater, I believe you can use it to download new/updated language files. Which, btw, can be in all formats, but I'd suggest you use a format that is easily to convert into the variables you need.
(Assuming you meant CSV instead of CVS) CSV should be easy to parse.

I like the idea you're using LÖVE for this good cause, I hope everything works out.
User avatar
Skofo
Party member
Posts: 146
Joined: Mon Dec 22, 2008 10:55 pm

Re: Multi language game

Post by Skofo »

The simplest way about this is probably to use tables which keeps the words/phrases in each language, and then you can call the variables from those tables to write/check whatever you need to write/check.

Simple example (for writing, checking phrases would require some extra code, but you should be able to get the basic concept from this):

Code: Select all

function load()
english = {
startgame = "Start Game",
exit = "Exit",
saucepan = "Saucepan"
}

blanese = {
startgame = "Bla Bla",
exit = "Blee",
saucepan = "Blablo"
}

love.graphics.setFont(love.default_font, 14)
end

function draw()
love.graphics.draw(english.startgame, 50, 69)
love.graphics.draw(blanese.saucepan, 50, 100)
end
Working on: Viator
Need a 64-bit Debian package for LÖVE? Here it is!
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: Multi language game

Post by osuf oboys »

I believe there should be a function call for selecting the phrase from the right language, like lang("english", "exitText"). That way, you can more easily substitute one language for another, combine multiple sources, and protect against changes in the future. The definitions of the texts can still follow skofo's suggestion. The alternative definition would of course be to define each text on its own, with all the languages. That would be less organized but will allow you to define the text in the same location as you use it - lang(curLang, {english="bottle", esperanto="botelo"}).
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
Post Reply

Who is online

Users browsing this forum: No registered users and 85 guests