Announcement

Collapse
No announcement yet.

Translate Contact Salutation Name/Title in Email Template

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Translate Contact Salutation Name/Title in Email Template

    Hello,
    I would like to translate the salutation name/title within an email template for Contact.

    I have tried these, but they don't work.

    Code:
    {{translate Person.salutationName field='salutationName' scope='Contact' language='en_UK'}}
    {{translateOption Person.salutationName field='salutationName' scope='Contact' language='en_UK'}}
    In effect, I would like to have something like:
    Hello Mr. John Smith
    Where "Mr." would be translated to the language I specify.

    Does anyone have any idea how to achieve this?

    Thanks.

  • #2
    You could achieve this by formula, but from your question it is not quite clear, if you have anything written in the salutatioName-field. A formula would depend on this. And there might be more than one solution depending on how it works in the moment.

    Comment


    • #3
      Originally posted by shalmaxb View Post
      You could achieve this by formula, but from your question it is not quite clear, if you have anything written in the salutatioName-field. A formula would depend on this. And there might be more than one solution depending on how it works in the moment.
      The salutationName field will have either "Mr.", "Mrs.", etc... which is defined by default in the Contact entity.

      You can reproduce this if you create an email template and in there try to have the salutationName translated into another specific language, which is different from the language of the interface you are on.

      I have attached two screenshots which show where I am trying to apply this translation and where it will be used.

      Comment


      • #4
        It works in email template this way (without formula):

        {{#ifEqual Person.salutationName Mr.}}your translation{{/ifEqual}}
        {{#ifEqual Person.salutationName Mrs.}}your translation{{/ifEqual}}​

        Comment


        • #5
          Originally posted by shalmaxb View Post
          It works in email template this way (without formula):

          {{#ifEqual Person.salutationName Mr.}}your translation{{/ifEqual}}
          {{#ifEqual Person.salutationName Mrs.}}your translation{{/ifEqual}}​
          It doesn't seem to work. It gives the error I have attached.

          I also tried with these:
          Code:
          {{#ifEqual Person.salutationName 'Mr.'}}your translation{{/ifEqual}}
          {{#ifEqual Person.salutationName 'Mrs.'}}your translation{{/ifEqual}}​
          and
          Code:
          {{#ifEqual Person.salutationName 'Mr'}}your translation{{/ifEqual}}
          {{#ifEqual Person.salutationName 'Mrs'}}your translation{{/ifEqual}}​

          It doesn't work either. It does not output anything when the template is loaded.

          I also tried to match without the dot:
          Code:
          {{#ifEqual Person.salutationName Mr}}your translation{{/ifEqual}}
          {{#ifEqual Person.salutationName Mrs}}your translation{{/ifEqual}}​
          ​It outputs 'your translation' twice, which means both cases have been matched.

          However, while this solution might be a quick workaround, it is bound to fail. It assumes the language for the current user interface is set to English. If the current user interface will be set to another language, the ifEqual will not match. The absolute correct way to achieve this would be to output the choice of the salutation option according to the translation on the specific language.
          Last edited by shef; 04-03-2023, 12:58 PM.

          Comment


          • #6
            Hi shef,

            Try use the following lines:
            Code:
            {{#ifEqual salutationName 'Mr'}}your translation{{/ifEqual}}
            {{#ifEqual salutationName 'Mrs'}}your translation{{/ifEqual}}

            Here it is important to understand why we are using salutationName and not Person.salutationName.

            When we select the Parent when forming an email, the attributes from the Email Template are already oriented towards the Parent, that is, as happens when working with the PDF Template, which always focuses on only one Target Entity and uses simple attributes, without preliminary inserts such as Person, User, etc. .

            Comment


            • #7
              Originally posted by lazovic View Post
              Hi shef,

              Try use the following lines:
              Code:
              {{#ifEqual salutationName 'Mr'}}your translation{{/ifEqual}}
              {{#ifEqual salutationName 'Mrs'}}your translation{{/ifEqual}}

              Here it is important to understand why we are using salutationName and not Person.salutationName.

              When we select the Parent when forming an email, the attributes from the Email Template are already oriented towards the Parent, that is, as happens when working with the PDF Template, which always focuses on only one Target Entity and uses simple attributes, without preliminary inserts such as Person, User, etc. .
              Thanks for your update, but unfortunately it doesn't work. It doesn't output anything. You can test this yourself, too. Just create an email template. Then try to send an email to a Contact that has the salutation title specified and choose that template and see what it does.

              Comment


              • lazovic
                lazovic commented
                Editing a comment
                Sorry, I checked again. Try the following:

                {{#ifEqual salutationName 'Mr.'}}your translation{{/ifEqual}}
                {{#ifEqual salutationName 'Mrs.'}}your translation{{/ifEqual}}

              • shef
                shef commented
                Editing a comment
                It doesn't work. It doesn't output anything.

            • #8
              shef,

              Please take a look at the following screenshots. Everything works as you need. Check carefully the settings of your Email Template, the settings of the Salutation field.

              Click image for larger version

Name:	Screenshot from 2023-04-18 16-42-38.png
Views:	385
Size:	32.8 KB
ID:	91155
              Click image for larger version

Name:	Screenshot from 2023-04-18 16-44-20.png
Views:	339
Size:	17.7 KB
ID:	91156
              Click image for larger version

Name:	image.png
Views:	348
Size:	18.1 KB
ID:	91157
              Click image for larger version

Name:	image.png
Views:	339
Size:	18.2 KB
ID:	91158
              Click image for larger version

Name:	image.png
Views:	350
Size:	16.6 KB
ID:	91159​​​​

              Comment

              Working...
              X