PDF templates do not respect localization in all cases.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hendrik Belitz
    Junior Member
    • Aug 2020
    • 13

    PDF templates do not respect localization in all cases.

    Hi there,

    I just tried to print a custom entity as a PDF file and while that basically works as expected, I encountered a problem when it comes to localized option fields. I am using an external reference to a contacts salutionName that I want to appear in the pdf. For some reason only the english version is printed out (Mr. Simpson) while the system is configured to use the German translation (Herr Simpson). Is there something I can use inside the template to enforce a localization the field's value?
  • esforim
    Active Community Member
    • Jan 2020
    • 2204

    #2
    Totally didn't aware of Localization in PDF Template, the demo is not loading for me so I can't confirm it.

    But I assume you already Localized/Translate the Salutation field in Language? More specifically:

    Admin > Label Manager (or use URL below + your website name)

    #Admin/labelManager/scope=Contact&language=en_US
    Under options
    #Admin/labelManager/scope=Contact&language=de_DE

    I had a quick check and it look Salutation isn't translated, so you have to translate it first?

    salutationName . Mr.
    Last edited by esforim; 08-25-2020, 07:20 AM.

    Comment

    • Hendrik Belitz
      Junior Member
      • Aug 2020
      • 13

      #3
      The field is localized, and the standard language of the installation is set to German. Everything works in the UI as expected, it's just the PDF that's wrong.

      Comment

      • Maximus
        Senior Member
        • Nov 2018
        • 2731

        #4
        Hi Hendrik,
        PDF document generator uses a language format that depends on the system language selected in Administration -> Settings -> Language. I your case it seems that the system language is English.
        If you need the system language - English, but a text in PDF should be translated, I believe you need to develop a custom template helper https://docs.espocrm.com/development...custom-helper/ to use the specific language with the way like this:
        Code:
         {{dateFormat createdAt_RAW format='MMMM DD' [COLOR=#c0392b]language='de_DE'[/COLOR]}}

        Comment

        • esforim
          Active Community Member
          • Jan 2020
          • 2204

          #5
          Hendrik Belitz Here to bring you some good news. I believe this patch has now fixed your issue (you can do a manual update or wait until v6). Please see this issue:

          In documentation: https://github.com/espocrm/documentation/blob/master/docs/administration/formula.md#language.

          Comment

          • Hendrik Belitz
            Junior Member
            • Aug 2020
            • 13

            #6
            Great. Thank you for that information.

            Comment

            Working...