Created
July 28, 2017 06:13
-
-
Save Sunil02kumar/5e616b66f007f11e170f72363f0fce0c to your computer and use it in GitHub Desktop.
Language Translation in VisualForce Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <apex:page standardcontroller="Account" extensions="SK_LocalizationDemoController" language="{!selectedLang}" sidebar="false"> | |
| <apex:form > | |
| <div > | |
| <div style="float:right"> | |
| <apex:selectList value="{!selectedLang}" size="1"> | |
| <apex:selectoptions value="{!AvailableLanguages}"/> | |
| <apex:actionsupport event="onchange"/> | |
| </apex:selectlist> | |
| </div> | |
| </div> | |
| <div id="maincontainer"> | |
| <apex:pageblock > | |
| <apex:pageblocksection > | |
| <apex:inputfield value="{!Account.Name}"/> | |
| <apex:inputfield value="{!Account.Type}"/> | |
| <apex:inputfield value="{!Account.Industry}"/> | |
| <apex:inputfield value="{!Account.BillingState}"/> | |
| <apex:inputfield value="{!Account.BillingCountry}"/> | |
| </apex:pageblocksection> | |
| </apex:pageblock> | |
| </div> | |
| </apex:form> | |
| </apex:page> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SK_LocalizationDemoController { | |
| public string selectedLang{get;set;} | |
| public SK_LocalizationDemoController(ApexPages.StandardController controller) { | |
| selectedLang='en'; | |
| } | |
| public List<selectoption> getAvailableLanguages(){ | |
| List<selectOption> options = new List<selectOption>(); | |
| options.add(new selectOption('en','English')); | |
| options.add(new selectOption('de','German')); | |
| options.add(new selectOption('es','Spanish')); | |
| options.add(new selectOption('fr','French')); | |
| options.add(new selectOption('it','Italian')); | |
| options.add(new selectOption('ja','Japanese')); | |
| options.add(new selectOption('sv','Swedish')); | |
| options.add(new selectOption('ko','Korean')); | |
| options.add(new selectOption('zh_TW','Chinese (Traditional)')); | |
| options.add(new selectOption('zh_CN','Chinese (Simplified)')); | |
| options.add(new selectOption('pt_BR','Portuguese (Brazil)')); | |
| options.add(new selectOption('nl_NL','Dutch')); | |
| options.add(new selectOption('da','Danish')); | |
| options.add(new selectOption('th','Thai')); | |
| options.add(new selectOption('fi','Finnish')); | |
| options.add(new selectOption('fr','French')); | |
| options.add(new selectOption('ru','Russian')); | |
| options.add(new selectOption('es_MX','Spanish (Mexico) ')); | |
| options.add(new selectOption('no','Norwegian')); | |
| options.add(new selectOption('pl','Polish')); | |
| options.add(new selectOption('cs','Czech')); | |
| options.add(new selectOption('tr','Turkish')); | |
| options.add(new selectOption('in','Indonesian')); | |
| options.add(new selectOption('uk','Ukrainian')); | |
| options.add(new selectOption('iw','Hebrew')); | |
| options.add(new selectOption('el','Greek')); | |
| options.add(new selectOption('en_GB','English (UK): ')); | |
| options.add(new selectOption('ar','Arabic')); | |
| options.add(new selectOption('in','Indonesian')); | |
| return options; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment