Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

An easy way to message translation

Problem

With the current possibilities in the SAP Cloud Applications Studio it is not possible to translate in BODL defined messages.

Example

message YOUR_MESSAGE text "some message text";

The content of the message can be raised to the UI and also in to the run logs but not directly translated with the translation mechanics build on the BO.

Solution

To solve the problem you can generate an generic message with no direct content but with an placeholder for every text you want to enter.

message TEXTMESSAGE text "&1" :LANGUAGEINDEPENDENT_EXTENDED_Text;

Than later in the ABSL Code on the place where you want to raise the message you set the text you want.

raise TEXTMESSAGE.Create("E", "some message text");

But this version has the downside, that you have to control the message texts and the translation with your ABSL code.

The better way is to use an translatable object in the studio to be able to raise the message according to the content of this.

To achieve this, we use an Business Configuration Object (BCO) which is configured with only an ID and an Description field and based on that BCO an Business Configuration Set  (BCC) to store the messages or other texts as key value pairs in this.

In this texts you can place also placeholders which you want to replace during run time with dynamic data (e.g. IDs).

To translate the messages you can use the context menu on the BCC and download the source file (XLIFF) simply within the studio and also upload the translated file again via the context menu. For the translation I recommend to use an special translation software like Virtaal.

To raise this messages you can use this simple code.

var message :MESSAGESCode;
message.content = "10";
var messageText = message.GetDescription();
raise TEXTMESSAGE.Create("E", messageText);

To reduce the code for every message you can encapsulate this code you can put the code for the description loading in an reuse library, so that you have only inline code like the following.

raise TEXTMESSAGE.Create("E", YourReuse.GetMessage("10"));


This post first appeared on Web Service Testing A Blackjack GUI And API, please read the originial post: here

Share the post

An easy way to message translation

×

Subscribe to Web Service Testing A Blackjack Gui And Api

Get updates delivered right to your inbox!

Thank you for your subscription

×