Friday, July 28, 2017

Language Translation in VisualForce Page

Salesforce provide functionality through which you can create single VF page and that can be translated in different languages based on language or locale preference of current logged in user.

You need to upload the translation of all custom fields which you are going to use in VF page and can utilize custom labels to display warning, error information on VF page.

In order to render the VF page in particular language, use Language attribute on <apex:page> tag. You can also bind this values with controller variable so that you can render VF page in different language.

<apex:page controller="SK_LocalizationTestController" language="{!selectedLang}">

I have created a very simple VF page to illustrate this functionality by displaying account information. I have dropdown on VF page through which user will select language and VF page will re render to display page in selected language.





Note:
  • If you are displaying page message using <apex:pageMessages>, then use custom label on apex class to display message. Upload all translation for custom label in salesforce.
  • For custom fields also you need to upload language translation. Please refer Translation Workbench under Set Up.
  • The language attribute does accept ISO country codes plus an optional locale like en,en_US,de,de_DE etc.
  • For displaying header or pageblock section title, use custom labels.

More Blogs>>: 
USING DATABASE.UPSERT WITH EXTERNAL ID   
DYNAMIC APEX IN SALESFORCE   
SOQL INJECTION IN SOQL   
CUSTOM METADATA AND CUSTOM SETTINGS IMPLEMENTATION TRICKS   
SMART TABLE USING ANGULARJS IN VISUALFORCE PAGE   
REST API TUTORIAL FOR SALESFORCE   
VISUALFORCE COMPONENT FOR RECORD STATUS BAR   
DYNAMICALLY CREATING AND DESTROYING LIGHTNING COMPONENTS    
RAISING AND HANDLING CUSTOM EVENTS IN sALESFORCE lIGHTNING    
WHY TO USE DESIGN RESOURCE AND HOW TO ADD DYNAMIC OPTION TO DATASOURCE    
PASSING INNER WRAPPER CLASS TO LIGHTNING COMPONENT    
LIGHTNING COMPONENT FOR RECORDTYPE SELECTION FOR ANY SOBJECT    
FETCHING FILE FROM EXTERNAL/PUBLIC URL AND STORING IT IN SALESFORCE   

7 comments:

  1. Croma campus do guide our participants for respective Certifications for Salesforce Training in Noida which is an added advantage to the current market.

    ReplyDelete
  2. Excellent…Amazing…. I’m satisfied to find so many helpful information here within the put up,for latest php jobs in hyderabad. we want work out extra strategies in this regard, thanks for sharing.

    ReplyDelete
  3. This paragraph gives clear idea for the new viewers of blogging, Thanks you.
    Salesforce Training in Noida

    ReplyDelete
  4. I just see the post i am so happy the post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be subscribing to your feed and I hope you post again soon.

    best selenium training institute in hyderabad
    best selenium online training institute in hyderabad
    best institute for selenium training in hyderabad
    best software testing training institute in hyderabad

    ReplyDelete