You need to sign in to do that
Don't have an account?
Displaying multilingual error message in visualforce
Hi,
I am using a visualforce page in my project which also display some error messages to the users. I want to know if it is possible to change the text of the error message based on the current user's locale. Can we leverage the translational workbench for this? I'm guessing that
All inputs are welcome.
Thanks,
Jerun Jose
You can use Custom Labels instead of a hardcoded text-message and translate it using the translational workbench.
e.g. apex-code:
VF page:
To create Custom Label go to "App Setup" -> "Create" -> "Custom Labels".
Hope, it will be the answer on your question.
All Answers
u can us
& on page use <apex:pagemessage attrubute>
Agree that we can use the pageMessages tag to display error messages.
My question was more on how can we modify the message displayed depending on the user's locale.
Say like, if an English user is logged in the message would be 'Record Not Saved', but if a French user logged in the message should be "Enregistrement n'est pas enregistré" (source google translate)
Thanks,
Jerun Jose
Yes put try catch
Then in catch block check the user location & add what ever msg u want to add
catch(exception ex)
{
If(userlocat = 'india')
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'India Error'));
else
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Other Error'));
}
You can use Custom Labels instead of a hardcoded text-message and translate it using the translational workbench.
e.g. apex-code:
VF page:
To create Custom Label go to "App Setup" -> "Create" -> "Custom Labels".
Hope, it will be the answer on your question.
Thanks,
I couldnt find translation for custom label in admin setup -> translational workbench ->translate, so thats when I thought we cant translate custom labels and decided to post this question.
Your response got me looking further and its app setup->create->labels (pick ur label).
That should work.
Thanks,
Jerun Jose