using Translations inside formula scripts?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamie
    Senior Member
    • Aug 2025
    • 101

    #1

    using Translations inside formula scripts?

    Hi,

    Just wondering how one would use translations inside the formula scripts? language\translate(LABEL, CATEGORY, SCOPE) doesn't give a whole lot of clarity on how to select a particular translation. Normally, it's language\translate('file.tag')
    Last edited by jamie; 09-30-2025, 12:50 PM.
  • rabii
    Active Community Member
    • Jun 2016
    • 1321

    #2
    it is simple

    in the documentation there is an example that explain it all

    PHP Code:
    language\translate('passwordWillBeSent''messages''User'

    So here we are translating the key passwordWillBeSent which exist under category messages of the User which will return this (Password will be sent to user's email address.)

    This is the key in the json file


    Rabii
    say hey

    Comment

    • jamie
      Senior Member
      • Aug 2025
      • 101

      #3
      rabii o, sweet, that does help, it's inverted from what I thought.

      Though I am looking to do my own translations, for example, to send out an invoice that automatically translates 'pay via bank account', or 'click here for terms and conditions'

      You have shown me how to access them, though, with the location of the translations, i worry that they aren't "upgrade safe", perhaps yuri could clear that up for me?

      Comment


      • rabii
        rabii commented
        Editing a comment
        what do you mean by

        i worry that they aren't "upgrade safe" ??
    • jamie
      Senior Member
      • Aug 2025
      • 101

      #4
      rabii well if i add or edit the system files with the next espo upgrade, they will be removed. it would be much better to have a list of my own translations that i can referance

      Comment


      • rabii
        rabii commented
        Editing a comment
        Simply add these list of translation in the metadata in custom folder and espocrm will merge them and will prioritise custom ones on original.
    • jamie
      Senior Member
      • Aug 2025
      • 101

      #5
      rabii too cool! but how will espo know what folder to look in? sorry i am well new to espo as i am sure you can tell, feel free to talk to me like a total newb that wants to learn

      Comment

      • rabii
        Active Community Member
        • Jun 2016
        • 1321

        #6
        jamie

        No worries i totally understand and that is why we are here to share and help each other

        totally fine. espocrm looks for two folder paths for metadata

        PHP Code:
        custom/Espo/Custom/Resources/i18n/en_US

        OR

        PHP Code:
        custom/Espo/Modules/YourModuleName/Resources/i18n/en_US

        This above for looking for translation files e.g same goes for metadata entityDefs - clientDefs - selectDefs etc

        Espocrm metedata is briallntly done and give you so much flexibility - it is very powerful. you can read more on docs

        Rabii
        say hey

        Comment


        • jamie
          jamie commented
          Editing a comment
          Hey man, you're just the best! Thanks for taking the time to explain it to
      Working...