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
Multi language game
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Multi language game
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.
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.
Re: Multi language game
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):
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
-
- Party member
- Posts: 215
- Joined: Sun Jan 18, 2009 8:03 pm
Re: Multi language game
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.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests