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: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

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

Ways to build a multilingual App?

Post by DevBoyLars » Fri Feb 21, 2014 6:31 pm

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: 5574
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Ways to build a multilingual App?

Post by dunbarx » Fri Feb 21, 2014 7:26 pm

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: 4666
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Ways to build a multilingual App?

Post by jacque » Fri Feb 21, 2014 7:32 pm

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: 5574
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Ways to build a multilingual App?

Post by dunbarx » Fri Feb 21, 2014 10:04 pm

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: 4666
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Ways to build a multilingual App?

Post by jacque » Fri Feb 21, 2014 10:42 pm

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 » Sat Feb 22, 2014 9:40 am

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
Location: Palo Alto

Re: Ways to build a multilingual App?

Post by Simon » Sat Feb 22, 2014 10:07 am

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: 2251
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Ways to build a multilingual App?

Post by jmburnod » Sun Jun 24, 2018 3:53 pm

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 35 times
Best regards
Jean-Marc

Klaus
Posts: 10403
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Ways to build a multilingual App?

Post by Klaus » Sun Jun 24, 2018 3:58 pm


jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2251
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Ways to build a multilingual App?

Post by jmburnod » Sun Jun 24, 2018 5:47 pm

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

Klaus
Posts: 10403
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Ways to build a multilingual App?

Post by Klaus » Sun Jun 24, 2018 6:17 pm

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: 2251
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Ways to build a multilingual App?

Post by jmburnod » Mon Jun 25, 2018 8:21 pm

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 32 times

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”