You need to sign in to do that
Don't have an account?
Picklist with multi lingual org to be displayed as multi select picklist
Hello,
I have a scenario where I am stucked.
I have an org which support two languages (English and Japanese). I have used translation workbench and uploaded translation.
There is a requirement to create a search page for opportunity. A picklist field in opportunity is search parameter to be displayed as multi-select picklist. Using below function I created multi-select picklist from pick list.
//controller code
private static List<SelectOption> getPicklistValue(sObject obj, String fld)
{
List<SelectOption> options = new List<SelectOption>();
Schema.sObjectType objType = obj.getSObjectType();
Schema.DescribeSObjectResult objDescribe = objType.getDescribe();
Map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap();
List<Schema.PicklistEntry> values = fieldMap.get(fld).getDescribe().getPickListValues();
for (Schema.PicklistEntry a : values)
options.add(new SelectOption(a.getLabel(), a.getValue()));
return options;
}//End Func getPicklistValue
Challenge that I am facing is: this picklist is always showing English values in multi-select picklist and this is obvious because I am fetching Label from picklist and displaying.
I want for Japanese users it must show Japanese translation of this picklist (already uploaded in Translation workbench). I am in search of some straight forward solution to this one.
Thanks,
Rehan
why dont you create an instance of opportunity and expose the field in the visualforce page instead of using the selectoption
Thanks Sandy for your reply. This approch will not work because I have to display normal picklist as Multi-Select Picklist on Visualforce page
Please let me know how did you solve this issue? i also need to implement similar requirement that i need to display the same page which has dynamic select options in different languages.
I used the same code just changed one line (highlighted) in the code :
//controller code
private static List<SelectOption> getPicklistValue(sObject obj, String fld) {
List<SelectOption> options = new List<SelectOption>();
Schema.sObjectType objType = obj.getSObjectType();
Schema.DescribeSObjectResult objDescribe = objType.getDescribe();
Map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap();
List<Schema.PicklistEntry> values = fieldMap.get(fld).getDescribe().getPickListValues();
for (Schema.PicklistEntry a : values)
options.add(new SelectOption(a.getValue(),a.getLabel()));
return options;
}//End Func getPicklistValue