cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

How to translate dialogs and menus for a custom application

dgopois
12-Amethyst

How to translate dialogs and menus for a custom application

Hello,

I have developped a custom application (with ACL language). But I would like to have a multilingual application (French / English). What is the best way to translate the dialogs and the menus ?

Kind regards

David

1 ACCEPTED SOLUTION

Accepted Solutions

In the base app, they do this using text entities and parameterized catalog entries. For example, the standard Find dialog includes this at the top:

 

<!DOCTYPE window PUBLIC "-//Arbortext//DTD XUI XML 1.1//EN"
 "xui.dtd" [
<!ENTITY % xuidlgStrings PUBLIC "-//Arbortext//ENTITIES XUI XML 1.0//EN" "">
%xuidlgStrings;
]>

 

 

If you look in the main catalog file, the entry for this public ID looks like this:

 

PUBLIC "-//Arbortext//ENTITIES XUI XML 1.0//EN" "../lib/locale/%L/dialogStrings.ent"

 

Note the "%L" parameter there, which will capture the user's configured locale and use it to load the appropriate text entities.

 

So, you should be able to add two folders in your custom/lib/locale folder: custom/lib/locale/en for English, and custom/lib/locale/fr for French. Put the corresponding language files in these folders, add a catalog entry similar to the one above, and a parameter entity reference similar to the one in the Find dialog above into your dialog. Then, replace the literal strings in your XUI dialog file with entity references, and you should get the right strings based on the user's configured locale.

 

If you are lucky, and your controls all have fairly generic labels like "OK", "Cancel", "Save", etc., you may even be able to just use the included localization entities and have it work. Otherwise, you'll have to pull out all your strings as entities and define the two entity files, one for each language.

(Of course, if you have a user who chooses "es" as their locale, they'll come up empty, so you might want to include fallback copies of the English entities file in other locale folders just in case.)

View solution in original post

2 REPLIES 2

In the base app, they do this using text entities and parameterized catalog entries. For example, the standard Find dialog includes this at the top:

 

<!DOCTYPE window PUBLIC "-//Arbortext//DTD XUI XML 1.1//EN"
 "xui.dtd" [
<!ENTITY % xuidlgStrings PUBLIC "-//Arbortext//ENTITIES XUI XML 1.0//EN" "">
%xuidlgStrings;
]>

 

 

If you look in the main catalog file, the entry for this public ID looks like this:

 

PUBLIC "-//Arbortext//ENTITIES XUI XML 1.0//EN" "../lib/locale/%L/dialogStrings.ent"

 

Note the "%L" parameter there, which will capture the user's configured locale and use it to load the appropriate text entities.

 

So, you should be able to add two folders in your custom/lib/locale folder: custom/lib/locale/en for English, and custom/lib/locale/fr for French. Put the corresponding language files in these folders, add a catalog entry similar to the one above, and a parameter entity reference similar to the one in the Find dialog above into your dialog. Then, replace the literal strings in your XUI dialog file with entity references, and you should get the right strings based on the user's configured locale.

 

If you are lucky, and your controls all have fairly generic labels like "OK", "Cancel", "Save", etc., you may even be able to just use the included localization entities and have it work. Otherwise, you'll have to pull out all your strings as entities and define the two entity files, one for each language.

(Of course, if you have a user who chooses "es" as their locale, they'll come up empty, so you might want to include fallback copies of the English entities file in other locale folders just in case.)

Hello Clay,

For my application, I chose to use XLIFF files and the "amo" ACL functions (amo_open, amo_text, amo_close) but the solution with the entities is also interesting.

Thank you for your help.

David

Top Tags