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
grigri9grigri9 

multi-lingual field labels of more than 40 characters?

I am building a questionnaire with about 500 fields (questions) that need to be translated into about a dozen languages. 

 

I was hoping to use the translation workbench and put the question text into the field labels but the 40 character limit on field labels is way too small. I.E. I have a field "Time with Employer" with associated question text "How long have you been with your current employer (in years and months)?"

 

My other idea was to put the question text into custom labels but I wasn't able to access the custom labels dynamically which is a requirement because all my fields are being created with dynamic vf bindings.

 

I.E.

 

<apex:repeat value="{!fields}" var="f">
{!$Label[f.custom_label_name__c]} <!--labels can't be accessed dynamically like this-->
<apex:inputField value="{!mapToObject[f.API_Object_Name__c[f.API_Field_Name__c]}">
</apex:repeat>

 

 

Has anyone found a way to dynamically reference a customlabel or gotten salesforce to increase the field label character limit?

 

Shashikant SharmaShashikant Sharma

I would suggest yo to use a Map of Field and Map 

 

Map<String , String> mapLabel = new MAP<String, String>();

 

it should have a field API Name as key and Custom Label Text as Value.

You can use it like.

<apex:repeat value="{!fields}" var="f">
{!mapLabel[f.API_Field_Name__c]} <!--labels can't be accessed dynamically like this-->
<apex:inputField value="{!mapToObject[f.API_Object_Name__c[f.API_Field_Name__c]}">
</apex:repeat>

 let me know if any issues in it.

grigri9grigri9

How can I create that map dynamically in my controller? As far as I'm aware the only way to access a label from apex is this:

 

 

String test = Label.<custom label name>;

 

So unless I want to hard-code every custom label I create into my controller there is no way for me to grab the label associated with the field I want to display.

grigri9grigri9

I contacted salesforce support about increasing the field label length but that was a no go.

 

So there is no way to provide multi-lingual support for dynamic visualforce pages without rebuilding the translation workbench?

 

Has anyone found a good work-around for this?