Showing posts with label Translation Workbench. Show all posts
Showing posts with label Translation Workbench. Show all posts

Monday, 14 August 2017

Language Translation in VisualForce Page | Translation Workbench


Salesforce offer functionality through that we'll be able to create single VF page which can be translated in several languages based on language/locale preference of current logged in user. We just need to upload the translation of all custom fields that you're going to use in VF page . To render the VF page in particular language, use Language attribute on <apex:page> tag.

Please follow below step to achieve the same. 
Step 1) Enable Translation Workbench and all Translation   Please follow below post to enable Translation Workbench
URL :-Translation Workbench - Salesforce ( Multilingual picklist values )

Step 2) You Can use the "Language" attribute of the VF page.

Step 3) Try to use Salesforce standard way to is to use apex:inputField tag with assigned sobject field. In this case a field will be generated automatically with respect to the current user language. 
Apex Class:-

public with sharing class TranslationWorkbenchController {
    public string selectedLang{get;set;}
    public List<selectoption> listOfLang {get;set;}
    public TranslationWorkbenchController(ApexPages.StandardController controller) {
        selectedLang='en';

        listOfLang = new List<selectOption>();
        listOfLang.add(new selectOption('en','English'));
        listOfLang.add(new selectOption('it','Italian'));
        listOfLang.add(new selectOption('es','Spanish'));
        listOfLang.add(new selectOption('de','German'));
        listOfLang.add(new selectOption('fr','French'));
    }
}


VF Page :-


<apex:page standardcontroller="Account" extensions="TranslationWorkbenchController" language="{!selectedLang}" >
<apex:form >

        <apex:selectList value="{!selectedLang}" size="1">
            <apex:selectoptions value="{!listOfLang}"/>
            <apex:actionsupport event="onchange"/>
        </apex:selectlist>
   
        <apex:pageblock >
            <apex:pageblocksection >
                <apex:inputfield value="{!Account.Name}"/>
                <apex:inputfield value="{!Account.Type}"/>
                <apex:inputfield value="{!Account.Industry}"/>
                <apex:inputfield value="{!Account.BillingCountry}"/>
            </apex:pageblocksection>
        </apex:pageblock>
   
</apex:form>
</apex:page>


Screen shot :-

English :-


Spanish:-




Thanks
Amit Chaudhary

Thursday, 1 January 2015

Translation Workbench - Salesforce ( Multilingual picklist values )

Translation Workbench | Salesforce  

ü  Enable the translation workbench with the languages you require.
ü  Create Translations for objects and fields

Enable the translation work bench
NavigationSetup  > Translation workbench > Translation settings


Note: In a Developer organization with a managed package containing translations, once the Translation Workbench is enabled, it can't be disabled.
Note: The “Manage Translation” permission is enabled by default in the System Administrator profile.
To disable the Translation Workbench, from Setup, Translation Workbench -> Translation Settings -> Disable

Adding Translated Languages and Translators

To add or edit translated languages and translators:

      1. From Setup, click Translation Workbench -> Translation Settings.
      2. Click Add to activate a new language or Edit to change an existing supported language.
      3. If adding a new language, choose a language.
      4. To make the entered translations available to your users - select Active. Users can change their           personal language anytime whether or not it's active in the Translation Workbench. Selecting              Active makes the translations available to the users in that language.
        Tip: We recommend you don't make a language active until the translators have translated all values.
      5. To assign translators for this language, select them from the Available List and click Add. If               you don’t    see the member you want to add, enter keywords in the search box and click Find.
      6. Click Save



 



Entering Translations and Overrides
  1. Click Translation Workbench -> Translate to translate customizations made to your Salesforce organization or Translation Workbench -> Override to override translations from managed packages.
  2. If you are overriding translations in managed packages, select the Package you are overriding.
  3. Select the Language you're translating into.
  4. Select a Setup Component. Click the pull-down menu to select from the list of translatable       customizations. See Translatable Customizations for a complete list of possible customizations.
  5. If necessary select an object and aspect. For example, workflow tasks have an object (Account, Contact, etc.) and aspect (Subject or Comment).
  6. Double click in the translation column to enter new values. You can press TAB to advance to the next editable field or SHIFT-TAB to go to the previous editable field.
  7. Click Save




How to see the Translation

  NavigationMy settings > Personal > Language & Time Zone
  Change the language in the below screen and verify the localized text which is entered


  
Best Practices for the Translation Workbench

To make the Translation Workbench most effective, administrators should:
  • Let translators know which languages they are responsible for translating.
  • Notify all translators when new translated components are added to your organization.
  • Advise users when customizing reports or list views to use filter criteria values in their personal language.

However, if they use the Starts With or Contains operators, advise them to choose the language of
the filter criteria values they entered.

Localize and Customize Labels and Messages of Visual Force Pages

The following steps are required for localize the labels
  1. Enable the translation workbench with the languages you require.
  2. Create labels for all the localizable text on the page.
  3. Replace the page text with the labels.
  4. Add a translation for each label.
  5. Change your profile language to test

Translate and Customize Labels

Navigation: Setup > Create > Custom Labels

Click on new custom label


Accessing custom label in the visual force page

<apex:page controller="TranslationWorkbenchDemoController">
  <h1>{!$Label.Welcome}</h1>
</apex:page>

Accessing Custom label in the apex classes

  ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, Label.Welcome ));


Thanks,
Amit Chaudhary