cancel
Showing results for 
Search instead for 
Did you mean: 

Translation of enumeration texts

Former Member
0 Kudos

I'm calling an RFC module, one of the parameters' type is a user-defined data element. Its value range is defined as

Fixed value | Short text

1 | Text1

2 | Text2

3 | Text3

When I choose Goto->Translation, I can see all of these texts are translated.

Now, I'm using following Java Web Dynpro code to get text on the screen:

ISimpleValueSet values =
wdContext.nodeP().getNodeInfo().getAttribute("D").getSimpleType().getSVS
ervices().getValues();

for (int j = 0; j < values.size(); j++) {
        if (someShort.compareTo((Short) values.getKey(j)) == 0)
                storeString = values.getText(j);
}

Now, the original language the type is defined in is English, the portal language is set to French. I use this code several times for different values of someShort, and for some I get the translated text, while for others, I get the original. Any ideas what might be the problem?

Accepted Solutions (0)

Answers (1)

Answers (1)

sridhar_k2
Active Contributor
0 Kudos

Can you explain it more detail, when you dont get correct translations.

Use the below code to get the text from the enumeration.

IWDAttributeInfo contextElementAttributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateTextView.IContextElement.TEST_ELE);

ISimpleTypeModifiable sim = contextElementAttributeInfo.getModifiableSimpleType();

IModifiableSimpleValueSet labelValues = sim.getSVServices().getModifiableSimpleValueSet();

labelValues.getText(key) - will retun text for the key from enumeration.

labelValues - will contain your enumeration types.

Regards,

Sridhar

Former Member
0 Kudos

Yes, that's equivalent to my code. I want to display all the possible values' texts on the screen. To keep it simple:

Text1

Text2

Text3

Text4

Text5

Text5

I just use the getText(i) method you suggested, and the result is something like:

Text1 (in French)

Text2 (in French)

Text3 (in French)

Text4 (in English)

Text5 (in Dutch)

Text5 (in Dutch)

sridhar_k2
Active Contributor
0 Kudos

Are you sure, you got this weird out put.

I never saw any thing like that, half in one language and others in different language.

Did you create simple type XXXXX.dtsimpletype_fr.xlf

Source Language : French

With these setting you should get everything in french? How abt other languages...like spanish.

Do you get same weird results?

Regards,

Sridhar

Former Member
0 Kudos

No, I did not created xlf files. Shouldn't these translations be handled automatically, when they are provided in R/3 ?

Former Member
0 Kudos

Solved, after server restart, translations are fetched.