4

I am trying to save time by adding custom labels directly in the CustomLabels.labels file using the Force.com IDE. Say I have a label like this:

<labels>
    <fullName>Comment</fullName>
    <language>en_US</language>
    <protected>false</protected>
    <shortDescription>Comment</shortDescription>
    <value>Comment or Question</value>
</labels>

And I add a translation like this:

<labels>
    <fullName>Comment</fullName>
    <language>fr</language>
    <protected>false</protected>
    <shortDescription>Comment</shortDescription>
    <value>Commenter</value>
</labels>

When I try to save the file, I get an error:

Duplicate name 'Comment' specified

I want to target the translation in my VisualForce page by

 {!$Label.Comment}

How can I add a French translation via the IDE?

1 Answer 1

4

The way you're adding the custom label is correct. But translations go into the translation file for the specific language. You can add translations to your IDE project by selecting it as metadata component.

For instance this is a translation of the ABSI_PAGE_LOGIN_ALREADYLOGGEDIN custom label to Dutch.

src/labels/CustomLabels.labels:

<labels>
        <fullName>ABSI_PAGE_LOGIN_ALREADYLOGGEDIN</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>login : already logged in</shortDescription>
        <value>You are already logged in, you can go straight to the homepage.</value>
</labels>

src/translations/nl_NL.translation

<customLabels>
        <label>U bent al aangemeld, u kan onmiddelijk naar de portaal pagina.</label>
        <name>ABSI_PAGE_LOGIN_ALREADYLOGGEDIN</name>
</customLabels>
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .