Ways to build a multilingual App?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

Ways to build a multilingual App?

Post by DevBoyLars »

Hi there,
what kind of ways are out there to build a multilingual App in LC?
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10507
Joined: Wed May 06, 2009 2:28 pm

Re: Ways to build a multilingual App?

Post by dunbarx »

Not sure I really know what I am talking about here.

If I were writing a application for French, I would have to make sure that interface elements, such as the "answer" dialog, had things like "Annuler" instead of "Cancel". Is this the sort of thing you mean?

It is straightforward to use different character sets for different countries. Of course, you have to program in english. As an American, I see that as only natural. :D

Craig Newman
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Ways to build a multilingual App?

Post by jacque »

One common way is to create a custom property set for each language. Each property set has keys in English with values in the other language. The controls in the stack should have names in English. When the stack opens, or before each card opens, the script loops through all the controls and sets their labels to the value in the appropriate custom property set.

That allows you to use a single English name for every control while displaying a different language to the user on screen.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10507
Joined: Wed May 06, 2009 2:28 pm

Re: Ways to build a multilingual App?

Post by dunbarx »

Jacque.

Surely a sound approach. Or maybe just one property, holding an array, like:

translator["French"]["EnglishLabel1"]["FrenchLabel1"]
translator["French"]["EnglishLabel2"]["FrenchLabel2"]
translator["Spanish"]["EnglishLabel1"]["SpanishLabel1"]
translator["Spanish"]["EnglishLabel2"]["SpanishLabel2"]
etc.

Craig
Last edited by dunbarx on Sat Feb 22, 2014 1:56 am, edited 1 time in total.
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Ways to build a multilingual App?

Post by jacque »

Sure, that would work too. One advantage of using different property sets though is that you can just set the property set once at startup and then use a bit simpler syntax:

Code: Select all

set the customPropertySet of this stack to thisLanguage -- only done once at startup, then thereafter:

set the label of btn "File" of grp "menu" to  the cFile of this stack
instead of:

set the label of btn "File" of grp "menu" to the translator[thisLanguage]["File"][cFile] of this stack
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

Re: Ways to build a multilingual App?

Post by DevBoyLars »

Could someone please upload a sample stack for me please? :)
Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Ways to build a multilingual App?

Post by Simon »

I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Ways to build a multilingual App?

Post by jmburnod »

Hi All,
Url post above doesn't work.
Here is a little stack with some scripts for translate label, menuitems and ask/answer dialogs between English/French.
stChangeLangage.zip
(2.42 KiB) Downloaded 845 times
Best regards
Jean-Marc
https://alternatic.ch
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Ways to build a multilingual App?

Post by Klaus »

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Ways to build a multilingual App?

Post by jmburnod »

Salut Klaus,
Thank you
I was able to open it after I replace ".mc" with ".livecode" in file name and it works 8)
Best
Jean-Marc
https://alternatic.ch
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Ways to build a multilingual App?

Post by Klaus »

It also works without renaming when you select "All files" in the popup below the filelist! 8)
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Ways to build a multilingual App?

Post by jmburnod »

Here is a new version "stChangeLangage001".
It use the same way as first and it is able to always return handler name in English for each langage
stChangeLangage001.zip
(22.71 KiB) Downloaded 820 times
https://alternatic.ch
Post Reply