+ Start a Discussion
Cool_DevloperCool_Devloper 

Querying Translations (Custom Labels) - In Controller

Hello Friends,

 

I am facing an issue with the Custom Label translations!

 

The requierment is that, i need to translate the custom validation error messages which occur on my VF page as per the language. Also, i need to show translated values of the drop down values which I am populating in my controller.

 

For this, i need to query the Custom Labels in the controller so that I then show the translated values on my page. But, I have'nt really got any information regarding whether this is even possible or not :(

 

Can someone please shed some light on the same? Would be very helpful indeed.

Thanks,

Cool_D

Message Edited by Cool_Devloper on 12-29-2009 04:09 AM
Best Answer chosen by Admin (Salesforce Developers) 
paul-lmipaul-lmi

the only way to ensure your translated labels will show in the proper language is to call them from the page, not the controller.  this is a known limitation, and I don't believe SF has acknowledged plans to do anything about it.

 

calling the label from the controller only gives you the language version of the running user, which is probably not going to work for very many applications (pretty much anything running on Sites).

 

 the painful way we worked around this is to create a component to be the "error area", and we dynamically interact with it to tell it which error(s) to display.  it's not glamorous, but it worked for our needs.

All Answers

paul-lmipaul-lmi

the only way to ensure your translated labels will show in the proper language is to call them from the page, not the controller.  this is a known limitation, and I don't believe SF has acknowledged plans to do anything about it.

 

calling the label from the controller only gives you the language version of the running user, which is probably not going to work for very many applications (pretty much anything running on Sites).

 

 the painful way we worked around this is to create a component to be the "error area", and we dynamically interact with it to tell it which error(s) to display.  it's not glamorous, but it worked for our needs.

This was selected as the best answer
Cool_DevloperCool_Devloper

Thanks a ton Paul ;)

 

Yeah, me too was thinking on the same lines as a work around!

 

Too bad, this is not possible though:(

 

Thanks Again!

Cool_D