Thread Subject: Switching 2 languages in a guide

Subject: Switching 2 languages in a guide

From: MRR

Date: 12 Mar, 2009 11:25:04

Message: 1 of 4

Hi everybody,

Is it possible to switch two languages in a guide? I know the easiest way would be to have two different guides, and execute one of them. But what i want to do is to have a menu in which you select the language, and then the guide changes automatically all the strings displayed (all the uicontrols change its strings). Any suggestion?

Kind regards,

Mario

Subject: Switching 2 languages in a guide

From: Pj

Date: 12 Mar, 2009 13:06:39

Message: 2 of 4

"MRR" <mario_ruz@hotmail.com> wrote in message <gpareg$dve$1@fred.mathworks.com>...
> Hi everybody,
>
> Is it possible to switch two languages in a guide? I know the easiest way would be to have two different guides, and execute one of them. But what i want to do is to have a menu in which you select the language, and then the guide changes automatically all the strings displayed (all the uicontrols change its strings). Any suggestion?
>
> Kind regards,
>
> Mario

Why not contain all the strings you use (labels, lists, text etc.) within two cell arrays where each cell correponds to one label in the GUI and all GUI commands for text reference to that cell array location. Then set your language UIcontrol callback to switch which cell array you pass to the gui and redraw it?

Hope this work - it could get complicated but it is the most elegant solution I can think of off the top of my head - also easily extensible to multiple languages.

Subject: Switching 2 languages in a guide

From: Michael Katz

Date: 4 May, 2009 13:04:01

Message: 3 of 4

Mario,

 This is a great question. I've expanded upon the previous answer in my newest blog post:
http://blogs.mathworks.com/desktop/2009/05/04/internationalization-of-guis/

I hope it gives you some good ideas.

-Mike
http://blogs.mathworks.com/desktop

"MRR" <mario_ruz@hotmail.com> wrote in message <gpareg$dve$1@fred.mathworks.com>...
> Hi everybody,
>
> Is it possible to switch two languages in a guide? I know the easiest way would be to have two different guides, and execute one of them. But what i want to do is to have a menu in which you select the language, and then the guide changes automatically all the strings displayed (all the uicontrols change its strings). Any suggestion?
>
> Kind regards,
>
> Mario

Subject: Switching 2 languages in a guide

From: MRR

Date: 4 May, 2009 22:23:02

Message: 4 of 4

Hi Michael,

Thank you. I definitely solved the problem creating one guide per each language (I changed each string defined for each item). I created them with GUIDE, and I switch between languages by a menu (in each guide) which closes one and opens another gui when the user requests it. Of course it is not an elegant solution in comparison with those showed in your post. I will take a look to them for next guides I develope.

Thanks for your answer.

-Mario-
"Michael Katz" <michael.katz@mathworks.com> wrote in message <gtmp41$s1q$1@fred.mathworks.com>...
> Mario,
>
> This is a great question. I've expanded upon the previous answer in my newest blog post:
> http://blogs.mathworks.com/desktop/2009/05/04/internationalization-of-guis/
>
> I hope it gives you some good ideas.
>
> -Mike
> http://blogs.mathworks.com/desktop
>
> "MRR" <mario_ruz@hotmail.com> wrote in message <gpareg$dve$1@fred.mathworks.com>...
> > Hi everybody,
> >
> > Is it possible to switch two languages in a guide? I know the easiest way would be to have two different guides, and execute one of them. But what i want to do is to have a menu in which you select the language, and then the guide changes automatically all the strings displayed (all the uicontrols change its strings). Any suggestion?
> >
> > Kind regards,
> >
> > Mario

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
translate Michael Katz 4 May, 2009 09:09:08
gui Michael Katz 4 May, 2009 09:09:08
switching MRR 12 Mar, 2009 07:25:10
language MRR 12 Mar, 2009 07:25:10
guide MRR 12 Mar, 2009 07:25:10
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com