Salesforce

How Do I Translate My Application to Another Language? (Magic xpa 2.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Translate My Application to Another Language? (Magic xpa 2.x)

In today’s global economy, it is no longer enough to create an application in your own language. You do not know, when you build the application, exactly what language your end users might speak. Fortunately, Magic xpa has built-in support for multiple languages, so you can add language support after your application is already built.

This is done using the MLS, or Magic Language Service. The MLS changes what is displayed to the user. The actual source application doesn’t change at all. This section discusses how to add MLS to your application.

1. Create the Translation File

You will need a translation file for each language that you want to translate your application into. The steps in doing this are discussed in How Do I Define a Translation File?.

2. Setting the Language Files

Next, you need to point Magic xpa to your language files.

  1. Go to Options->Settings->Languages.

  2. Enter the name of the language, such as “Spanish”. This is the name you will use when selecting the current language to use.

  3. Enter the name of the Translation file. This is the name of the file created by MLS_BLD.

These will become entries in the Magic.ini file, in the [MAGIC_LANGUAGE] section.

[MAGIC_LANGUAGE]

French = D:\Projects\PetPictures\PetPictures.frn

Spanish = D:\Projects\PetPictures\PetPictures.spn

3. Choose the Language at Runtime

Now, the program can be set to translate at runtime. This can be done with an entry in the Magic.ini, the StartingLanguage. In this example, the application will start in Spanish.

Alternatively, you can use the SetLang() function to change the language translation at runtime.

In this example, the user can set the language, and call the same program with different translation files. The program text shows up in English, Spanish, or Greek, depending on what the user chooses.

4. Other MLS Considerations

If no match is found for a specific phrase, then that phrase won't be translated. Also, the text must be identical in the phrase and the translation file, or a match won't be found. This means that "Studio" and "Studio:" must be separate entries in the translation file.

Since expressions are evaluated at runtime, they must be handled differently. This is covered in How Do I Translate an Expression’s Value to Another Language?.

Not all translations are done by the MLS. For Date fields, Magic xpa has built-in support for different date formats, which is set up in Options->Settings->Environment->International->Date Mode. Money fields can be handled using a picture format that can be changed at runtime.

The Magic xpa runtime itself will appear in different languages depending on how it is installed. Most of the text that is language-dependent is in the MGCONST.xxx files, where .xxx is the language.

Once you have followed these steps, you will have an application that will run in two or more different language environments.

Related Topics

The Online and Rich Client Samples projects (program EV13 and REV13)

Reference
Attachment 
Attachment