We are using Custom Labels for the translation of our application. In Apex Code, the method getLabel() retrieve the value of a given label in the language of the user. For example to retrieve the value of custom label we use:
Schema.DescribeFieldResult F = Quote__c.Quote_Comment__c.getDescribe();
This getLabel() method returns the text label in the language of the user. However, we would like to get it in other languages.
Let's illustrate this with an example. We've built a multi-langual quote engine (that can print quote in pdf thanks to a Visualforce page). As of now the Quoteis generated in the language of the user. However, we would like the user to be able to manually select in which language the Quote needs to be printed.
Therefore we need to be able to retrieve all CustomLabels translation in the Apex Code controller of the page to display thefields in the correct language (as chosen by the user).
It does not seem possible to do something like getLabel('Spanish') to retrieve the label translated in Spanish. Does anyone can confirm Apex Code do not support such a functionality?
Thanks a lot in advance,
Quick question, though I think I know the answer. I've got a quite complex apex method running as a result of being called from a VF command button. During this method I insert and update several records. At the end I am trying to generate html and plain text representations of VF pages to persist to an SObject that can then be picked up by a custom C# app and posted via SMTP. This seems relatively straightforward, but I'm guessing that PageReference.getContent() runs in a separate execution context, so won't have access to data inserted in another context.
Question 1, if I call PageReference.getContent() from within an Apex method, does it run in a separate context and thus not have access to the DML changes in the current context?
Question 2, if 1 is true, is there any way to accomplish this? I've tried persisting SObject-based parameters, but this is just the same thing as above, really.
Hope this makes sense and appreciate any help anyone can offer.