Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: GUI with multiple languages option

  • Subject: Re: GUI with multiple languages option
  • From: Rick Branch <rbranch@cinci.rr.com>
  • Date: Wed, 12 Jan 2005 14:57:20 GMT
  • In-reply-to: <eef856f.-1@webx.raydaftYaTP>
  • Newsgroups: comp.soft-sys.matlab
  • Organization: Road Runner High Speed Online http://www.rr.com
  • References: <eef856f.-1@webx.raydaftYaTP>
  • User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
  • Xref: news.mcc.ac.uk comp.soft-sys.matlab:203599
Tony Jones wrote:
I am attempting to write a multi-window GUI for customers in several
countries.

As such, I'd like to be able to have them select the language to be
used on a welcome screen, and then set the text on all the succeeding
pages depending on what is chosen. This would include titles,
tooltips, button text and so on. I can't immediately see any way to
do this. Does anyone have any ideas?

Thanks in advance!

One idea would be to have the all of the strings that your program uses in an cell array. Anytime you need to access a particular bit of text in your GUI, access it from the array. (No hardcoded text anywhere in your code) An easy way to do this would be to setup an array of constants that are the offsets into the cell array of text strings.


A simple example....

%In English:

language={'Enter a Number '; 'That''s not a number'; 'Are you sure?' };
QUESTION1 = 1;
RESPONSE1 = 2;
RESPONSE2 = 3;
disp(language(QUESTION1))
disp(language(RESPONSE1))
disp(language(RESPONSE2))

%In my version of French (Sorry if its wrong):

language={'Ecrivez un nombre'; 'Ce n''est pas un nombre'; 'Etes-vous sur?'};
disp(language(QUESTION1))
disp(language(RESPONSE1))
disp(language(RESPONSE2))

Once you get the GUI working in one language, save the cell array of text strings as a MAT file with a name indicating which language it contains.

Then, when you want to deploy the program in a different language, translate the strings in that cell array, and store that away in a different MAT file whose name indicates the language it contains. The name of the cell array must be the same for both languages since your GUI will be coded referring to the cell array name ('language' in the example above.)

So, as your system runs and the user selects their preferred language, load the appropriate MAT file and the correct language will be used in the GUI.

I would not want to convert the strings and create multiple versions of the code. That would be a maintenance headache. This way, you just have to maintain one set of code and the multiple language files. If you need to deploy the application in a different language, you just create a new MAT file and use the exact same code base.

Of course it's extra work to do it this way, but if you need to deploy in multiple languages, IMO this is the least amount of work in the long run, and the most robust.

I worked for a software company that basically did their internationalization this way. They just shipped off the files with the English text in it to various companies that then translated the strings and sent them back. Instant French, German, Swedish, etc.....

Hope that makes sense......


[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index