function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TehNrdTehNrd 

How to use standard labels for multilingual apps?

I am creating a multilingual app and I'm trying to keep the number of hard coded labels to an absolute minimum. I am using the following markup whenever possible:

 

{!$ObjectType.Account.Fields.Name.Label}


But what about standard labels like "Save" and "Cancel"? Is there anyway to make these dynamic so that I don't need to create custom labels for these common values?


I also think Global Variables are still one of the most poorly documented areas of salesforce.com. For example, you can do this to get the plural label for an object:

 

{!$ObjectType.Product2.LabelPlural}

 

but it isn't documented anywhere in the "Understand Global Variables" help section. I figured it out by guessing.

incuGuSincuGuS

As far as i know there's no way to accomplish that, but if you do find anything please share it ! :)

sforce2009sforce2009

I can see for 'Submit' but not for 'save or cancel'.

here is the link

http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global.htm

you might be familiar with this already. But i have not explored much on this, if you get the answer, do post it here. Even if I get something useful for you definitely do that.

 

Thanks

Ron HessRon Hess

 

 

Visualforce supports $ObjectType by performing a describe for you, take a look at this apex code

 

 

Schema.DescribeFieldResult f = Schema.sObjectType.Account.fields.Name;

 

compare with

 

{!$ObjectType.Account.Fields.Name.Label}

 

 

 

and you can see the pattern

 

 

So, now you can reference this page :

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_describe_objects_understanding.htm

and

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_sobject_describe.htm

 

So understanding this , you can try many of the methods shown there,  by my logic and a quick test, these are valid :

 

 

{!$ObjectType.Account.KeyPrefix}

{!$ObjectType.Account.Fields.Name.Length}

{!$ObjectType.Account.Fields.Name.InlineHelpText}

{!$ObjectType.Account.Fields.mydouble__c.Scale}

{!$ObjectType.Account.Fields.Name.Type}

 

OlgaOlga

I just tried the following code:

 

<apex:commandButton action="{!save}" value="{!$label.site.save}"/>
<apex:commandButton action="{!cancel}" value="{!$label.site.cancel}"/>

 

And it does the trick!