function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anto HotelbedsAnto Hotelbeds 

How to use the translation workbench in visualforce?

Hi developers,

 

I would like to know if it is possible to use the translation workbench in visualforce.

 

I have my code, that at some stage looks like this:

 

<tr>
<td class="labelCol"><b>Currency to Invoice </b></td>
<td class="dataCol col02"> {!Lead.Currency_to_Invoice__c}</td>
<td class="labelCol"><b> Billing Language</b></td>
<td class="dataCol col02"> {!Lead.Billing_Language__c}</td>
</tr>

 

Lets take Billing_Language_c as example. This field is a picklist with the values: CAS, ENG, FRE that corresponds in the translation workbench to Spanish, English and French. When I show the value of the picklist in my code, instead of showing English, visualforce is showing ENG.

 

Can I somehow show the translated value of ENG,CAS or FRE in my visualforce page?

 

Thanks a lot. Regards,

 

Antonio

Best Answer chosen by Admin (Salesforce Developers) 
Platy ITPlaty IT

You may need to put the field references into an outputField tag for this to work- like <apex:outputField value="{!Lead.Billing_Language__c}"/>

 

Also a note since you have the field names hard-coded in your example, that to get the translated field names you can reference them like this-  {!$ObjectType.Lead.Fields.Billing_Language__c.Label}

All Answers

sanjdevsanjdev

Hi ,

 

Visibility of the picklist value in different language depends upon the locale setting of a particular user if translation work bench is set and enabled.

 

Hope this help you.

 

Cheers

Sanj

Anto HotelbedsAnto Hotelbeds

Hi,

 

the translation workbench is set and enabled but still wont show the translated values.

 

Thanks

yvk431yvk431

The system wont show all the values by default, you have to mention the corresponding translation then only it will get displayed based on users locale.

 

Go to Translate Workbench->Translate -> Language->Setup Component(pick list)->Object

 

You have to fill in the translations for all the lovs you want.

 

 

--yvk

Anto HotelbedsAnto Hotelbeds

Hi,

 

I already did translate all the values but still cant see the translation in my visualforce page:

 

Instead of showing spanish, its showing CAS

 

Any help please?

yvk431yvk431

Can you share your visual force code, also whats the logged in user's language ?

 

 

--yvk

Platy ITPlaty IT

You may need to put the field references into an outputField tag for this to work- like <apex:outputField value="{!Lead.Billing_Language__c}"/>

 

Also a note since you have the field names hard-coded in your example, that to get the translated field names you can reference them like this-  {!$ObjectType.Lead.Fields.Billing_Language__c.Label}

This was selected as the best answer
Anto HotelbedsAnto Hotelbeds

Thanks a lot for your help!

 

Finally the solution was to put in the code the following:

 

<td class="labelCol"><b>Currency to Invoice </b></td>
<td class="dataCol col02"> <apex:outputField value="{!Lead.Currency_to_invoice__c}"/></td>

 

Just as Platy IT indicated!

 

Really appreciate!

 

Antonio