Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to get a localized string from lokalized ressources via beanshell?

Hi,

my next challenge

i defined some localized strings.

i wish to use the strings in my beanshell script.

the script should get the proper string for the current user language.

i can't find any solution for it.

i read i shoud read them directly from the database. is this right?

thank you for any tip.

Waldemar

Tags:
Former Member
Former Member replied

Hello Waldemar,

As per my understanding what you are trying to get is the Value for the given resource Id in Localized resources through scritping

You can do as below.

public String LocalizedResourceValue(String resourceId) {

//createResourceId(java.lang.String bundle, java.lang.String resource)

resource = TypeFactory.createResourceId("zcustom", resourceId);

resourceRef = TypeFactory.createResourceReference(resource);

resourceValue = resourceRef.getValue(session);

return resourceValue;

}


resourceStringValue = LocalizedResourceValue("resource_id");


Pass the ID as string in above method and you will get the value given for the respective LR.

Regards,

Raj

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question