Announcement

Collapse
No announcement yet.

Entity item translation

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

  • Entity item translation

    Entity1 item with name = 'dog', nameGerman = 'Hund​', nameFrench = 'chien'

    Entity2 with related Field from Entity1

    How I can show correct languege field in place and select form (screenshots in attach) depend on user language ?
    Attached Files
    Last edited by Zuzz; 09-02-2024, 04:33 PM.

  • #2
    Hello,

    There's an extension that allows this:

    EspoCRM extension "Multi language fields" from BPM4B. Extension can be customized, extended, and configured to meet the unique needs of your business.


    Or you could assign different layouts to users based on their language.

    Comment


    • #3
      Please, how I can use layouts in this case?

      Comment


      • #5
        I've read this, thanx. I don't understand how to use this to correct field in place (first screenshot)

        Comment


        • #6
          I've solved it by modifying
          Espo\Custom\Controllers \Entity2 extends \Espo\Core\Templates\Controllers\Base getActionRead
          Espo\Custom\Controllers \Entity1 extends \Espo\Core\Templates\Controllers\Base getActionList

          Comment


          • Kharg
            Kharg commented
            Editing a comment
            feel free to share your code with the community

          • esforim
            esforim commented
            Editing a comment
            Wow a coder! Yes, as above Kharg comments.

        • #7
          file: /custom/Espo/Custom/Controllers/Entity1.php

          class Entity1 extends \Espo\Core\Templates\Controllers\Base
          {
          ​....
          public function getActionList(Request $request, Response $response): stdClass
          {

          $rr = parent::getActionList( $request, $response);
          $list = $rr->list;

          foreach ($list as $item) {
          $this->ModifyNameField($item);
          }


          return $rr;
          }​
          ----------------------------------------
          file: /custom/Espo/Custom/Controllers/Entity2.php

          class Entity2 extends \Espo\Core\Templates\Controllers\Base
          {
          ​....
          public function getActionRead(Request $request, Response $response): stdClass
          {
          $rr = parent::getActionRead( $request, $response);
          $this->Set_Entity1Name($rr) ; // relate entity represents by Entity1Id and Entity1Name fields. The idea is to modify Entity1Name on server API side


          return $rr;
          }​
          -----------------------------------​

          Comment

          Working...
          X