Entity item translation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zuzz
    Member
    • Nov 2023
    • 42

    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.
  • Kharg
    Senior Member
    • Jun 2021
    • 410

    #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

    • Zuzz
      Member
      • Nov 2023
      • 42

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

      Comment

      • Kharg
        Senior Member
        • Jun 2021
        • 410

        #4

        Comment

        • Zuzz
          Member
          • Nov 2023
          • 42

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

          Comment

          • Zuzz
            Member
            • Nov 2023
            • 42

            #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.
          • Zuzz
            Member
            • Nov 2023
            • 42

            #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...