4

I want to display the field validation error massage in other language (let say Spanish) on VF page without using java sript but with any availalbe SFDC inbuilt functionality?

Let Say First name is a requied field on my VF page, I want to display the validation "Enter field Value" in Spanish without using jQuery, Javascript.

Any options?

5

Is the first name a required field just in your VF page or is there a validation rule requiring the field?

If you're using a validation rule & translation workbench (to translate the error message) you could use which will display the Validation error message. Of course this means the user has to attempt to save the record to trigger the validation message itself.

You can also add your own custom error messages in your controller/extension using .addmessages ... example: ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.error,Label.Your_Error_Message_Label));

There's a post on the dev forums recommending using a custom label in your apexpages.messages for translation: http://boards.developerforce.com/t5/Visualforce-Development/Displaying-multilingual-error-message-in-visualforce/m-p/452239#M51505

  • Thanks @Salesforce Wizard; this is what I was looking for – Roshan Aug 21 '12 at 16:09
  • Using Custom Labels for Error messages is definitely the way to go. This also makes it way easier to write portable Test Code for your error-handling code branches, as you don't have to hard-code the language-specific error message. Instead you can just assert that the error message equals your Custom Label. – zachelrath Aug 21 '12 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.