How to Translate Report Labels

Report and label text object, or label, strings must be converted to calls to the program TranStr.prg (Translate String) to be translated. The TranStr program is passed the string and an “R” Use ID value that identifies the string as a report/label string.  The format of the call is as follows:

TranStr("Label","R")

where Label is the text object string.

For example, the following call to TranStr.prg, passes the string “Date” and the “R” Use ID:

TranStr("Date","R")

String and String Translations records for report/label strings are given the “R” Use ID to make it easy for you to create translations that are specific to reports. For example, the string “First Name” may need abbreviated translations for reports while full translations of “First Name” may be just fine for forms. The “R” Use Id lets you enter translations of “First Name” for reports that are different than the translations you enter when “First Name” is used for forms. The String record for “First Name” when used for forms would have a Use ID that is blank or different than “R”. See How to Create Alternative Translations for the Same String.

When the Create String Records utility goes through a report/label file to create String and String Translations records for text object (label) strings, the text object in the report/label file is converted into an expression. The expression is a call o the TranStr program.

Tip: Instead of entering label text (text object) in reports, you can enter TranStr(“LabelText”,”R”) directly, where LabelText is the label text string. You might want to do this when you are modifying an existing report by adding just a few labels. You could then either create a String record manually for the label or let VPM’s “Add Missing Strings” functionality create the String record (see Add Missing String Records).

When a report/label is run, the TranStr program returns the translated string that will appear in the report/label. TranStr runs the TranslateString method of the Multilingual object , _screen.oApp.oInt, passing on the parameters and returning the translated string.

A function call is used instead of a call to the TranslateString method for two reasons:

·       The call to TranStr is shorter than a call to a method of the Multilingual object, making it easier to see the string in the Report Designer.

·       TranStr can test to see if the Multilingual object has been instantiated, and if not, simply return the string it tried to pass. This allows the report/label to be run outside the application (like in VPM’s Report Builder) where the Multilingual object has not been instantiated.

 

More:

How to Localize Data Sources