You need to sign in to do that
Don't have an account?
Translation problem of custom label with Apex class and visualforce page
Hi All,
I got a problem about custom label translation if I am specified the language in visualForce page different from the current user’s language. I created the visualforce page with specified language and then I get the value of Radio button’s option from class, but the label of radio button is translated to be user’s language instead of visualforce page’s languaged. Example: if my user's language is 'Chinese' and I set my visual force page language is 'Japanese' then the label of my radio button is 'Chinese', but other label fields in visual force page are translated to 'Japanese'. My code is as following.
visualforce page
<apex:page controller="testCon" language="ja" sidebar="false" showheader="false">
<apex:form >
<apex:panelGrid columns="1" width="600px" style="text-align:center">
<apex:pageBlock >
<apex:pageBlockSection columns="1" >
<apex:pageBlockSectionItem >
<apex:outputText value="{!$Label.Gender}"/>
<apex:selectRadio value="{!Gender}">
<apex:selectOptions value="{!pGenders}" />
</apex:selectRadio>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:panelGrid>
</apex:form>
</apex>
class controller
public class testCon {
String Gender = 'Male';
public List<SelectOption> getpGenders() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('Male',System.Label.Male));
options.add(new SelectOption('Female',System.Label.Female));
return options;
}
public String getGender() {
return Gender;
}
public void setGender(String Gender) {
this.Gender = Gender;
}
}
Anyone can be suggest me?
Thanks you,
Prapp
Ok. Thanks you for your reply.