Page 1 of 1

Ways to build a multilingual App?

Posted: Fri Feb 21, 2014 6:31 pm
by DevBoyLars
Hi there,
what kind of ways are out there to build a multilingual App in LC?

Re: Ways to build a multilingual App?

Posted: Fri Feb 21, 2014 7:26 pm
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

Re: Ways to build a multilingual App?

Posted: Fri Feb 21, 2014 7:32 pm
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.

Re: Ways to build a multilingual App?

Posted: Fri Feb 21, 2014 10:04 pm
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

Re: Ways to build a multilingual App?

Posted: Fri Feb 21, 2014 10:42 pm
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

Re: Ways to build a multilingual App?

Posted: Sat Feb 22, 2014 9:40 am
by DevBoyLars
Could someone please upload a sample stack for me please? :)

Re: Ways to build a multilingual App?

Posted: Sat Feb 22, 2014 10:07 am
by Simon

Re: Ways to build a multilingual App?

Posted: Sun Jun 24, 2018 3:53 pm
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 61 times
Best regards
Jean-Marc

Re: Ways to build a multilingual App?

Posted: Sun Jun 24, 2018 3:58 pm
by Klaus

Re: Ways to build a multilingual App?

Posted: Sun Jun 24, 2018 5:47 pm
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

Re: Ways to build a multilingual App?

Posted: Sun Jun 24, 2018 6:17 pm
by Klaus
It also works without renaming when you select "All files" in the popup below the filelist! 8)

Re: Ways to build a multilingual App?

Posted: Mon Jun 25, 2018 8:21 pm
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 54 times