0

I am using a force.com site to show a visualforce page where I want the user to have the option to select a language. In the corresponding visualforce page I set the language. How do I get this into my controller extension?

VFP:

<apex:page standardController="Lead" extensions="WebToObjAttachments" showHeader="false" language="nl_NL"  standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0" rendered="{!Id=null}" action="{!addMore}" >

Tried in extension

public class WebToObjAttachments {
..
 language = Apexpages.currentPage().getparameters().get('language');
..
}
1

@sfdcfox is correct there is no way to get the page language from the page the way you have it set up, because its not a parameter. You can however dynamically set the page language by passing in the parameter. This question addresses this Assign language Value dynamically in Visualforce page

| improve this answer | |
0

The language attribute isn't a "page parameter" (those are strictly the values found in the URL after the ?). As far as I'm aware, there's no way to get this information from the page. Similarly, there's no way to detect most of the other settings, such as determining if the page is being rendered as a PDF.

| improve this answer | |
  • So should I add the parameter seperateley in the page as: <apex:param name="language" value="nl_NL" assignTo="{!language}"/>. ? – Thomas Mar 27 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.