on 06-30-2015 10:30 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Raj,
createResourceId
public static ResourceIdIfc createResourceId(java.lang.String bundle, java.lang.String resource)
resource = TypeFactory.createResourceId("zcustom", resourceId);
resourceRef = TypeFactory.createResourceReference(resource);
resourceValue = resourceRef.getValue(session);
Here, the createResourceId method will return an object 'Resource' of type 'ResourceIdIfc'. Next you are calling reference method but from here I am getting lost.
1. what that will return?
2. getValue() is present in Interface: ResourceReferenceIfc but its not implemented in your code. So how will it return value?
Regards
Manish Agrawal
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.