You need to sign in to do that
Don't have an account?
Setting label language in Apex
I have a VF page that uses custom labels, which are translated, and are properly localized when setting the page language via a URL param. I also have a custom radio button list that uses labels for some of the values, which is created on the fly in the controller. I'm running into an issue where the VF-included labels are properly grabbing the correct language translation, but the Apex-included labels are not.
So...howdo I override the controller itself to be using a specific language, rather than just the VF page?
In Apex, you can only call a label via System.Label.labelname , so it seems like it's completely dependent on the user's browsing/set language. I need this for Sites, so I would like to ensure that the language param passed to the VF page overrides any SF magic/automation on language detection/setting.
hmmm
i'm already calling this with the $Label global. i'll try it, but i have doubts.
I have found a sort of workaround, but it's really "cludgy." What I ended up doing is placing some inputHidden components on my page and bound them to string variables in the controller. Then in the VF page, I added Javascript when the page loads to populate the hidden fields with the value of the labels I needed via $Label.labelname.
What a bummer - I was totally blind-sided by this. I have a controller that has almost a hundred labels and just now realized those labels are being translated. I'm going to workaround it with a variant of what you suggested @eoates.
Force.com Prod Mgmt: PLEASE FIX THIS ASAP!