Answers.Body: <p>It depends on the <strong>Propagation Method</strong> of your Matrix field.</p>
  <p>If you set this to <strong>Only save entries to the site they were created in</strong>, each site will get its own entries for the matrix field. If you create a new entry in a matrix field in one site (programmatically or through the Control Panel), it will not appear in any of the other sites. In this case, to translate your content, just create separate entries in the matrix field for every site. The translation method of all the fields used inside the entry types that the matrix field allows doesn't matter – since the entry can only exist in one site anyway.</p>
  <p>If you set the <strong>Propagation Method</strong> to any of the other options, the entries in the matrix fields will propagate to some or all other sites (depending on the selected option, similar to entry propagation in sections). In this case, you need to configure a <strong>Translation Method</strong> for all the fields that are used in the entry types that the matrix field allows. For every field in your matrix entry type that you want to translate between sites, set the translation method to <strong>Translate for each site</strong>, or one of the other options as appropriate. Any field that you leave at <strong>Not translatable</strong> will share the same value in all sites that the matrix field propagates to.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-10-31T10:10:43.853Z
Answers.Text: Thanks for the explanation, it's much clearer now. If I decide to save the elements on all the sites where the owner element is saved how do I translate them using the code?
  https://craftcms.com/docs/5.x/reference/field-types/matrix.html#saving-matrix-fields here it talks about how to save them but it doesn't talk about translations
Answers.UserDisplayName: Daniele Scoch Scotti
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-06T08:26:52.867Z
Answers.Text: @DanieleScochScotti You want to programmatically create entries in multiple languages? Yeah that's not super well documented. I usually create the entry in one language, then save it (which propagates it to other sites). Then retrieve the entry in the other site, translate some fields and then save it again. Not sure if that's the best approach, but it works.
Answers.UserDisplayName: MoritzLost
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-10-28T19:21:19.680Z
Answers.LastActivityDate: 2024-10-28T19:21:19.680Z
Answers.UserDisplayName: MoritzLost
Body: <p>I'm importing data from a complex excel file. I need to create or update Entries on the various sites that exist on my Craft installation. I have some Martix fields that are translatable by site but, unlike the other fields, I cannot translate their contents.
  How do you translate the contents of the Matrix fields for the various sites? Do we need to make queries and update the translations of the different entries or is there a simpler way?</p>
  
Tags: <matrix><localization><craft5>
Title: How does the value of a Matrix field translate for different sites in Craft5?
ThreadText: # How does the value of a Matrix field translate for different sites in Craft5?
  
  (Asked by: username_0 on 2024-10-27)
  
  I'm importing data from a complex excel file. I need to create or update Entries on the various sites that exist on my Craft installation. I have some Martix fields that are translatable by site but, unlike the other fields, I cannot translate their contents.
  How do you translate the contents of the Matrix fields for the various sites? Do we need to make queries and update the translations of the different entries or is there a simpler way?
  
  **Tags:** matrix, localization, craft5
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-10-28. Score: 0
  
  It depends on the **Propagation Method** of your Matrix field.
  
  If you set this to **Only save entries to the site they were created in**, each site will get its own entries for the matrix field. If you create a new entry in a matrix field in one site (programmatically or through the Control Panel), it will not appear in any of the other sites. In this case, to translate your content, just create separate entries in the matrix field for every site. The translation method of all the fields used inside the entry types that the matrix field allows doesn't matter – since the entry can only exist in one site anyway.
  
  If you set the **Propagation Method** to any of the other options, the entries in the matrix fields will propagate to some or all other sites (depending on the selected option, similar to entry propagation in sections). In this case, you need to configure a **Translation Method** for all the fields that are used in the entry types that the matrix field allows. For every field in your matrix entry type that you want to translate between sites, set the translation method to **Translate for each site**, or one of the other options as appropriate. Any field that you leave at **Not translatable** will share the same value in all sites that the matrix field propagates to.
  
  > **Comments:**
  > **username_0**: Thanks for the explanation, it's much clearer now. If I decide to save the elements on all the sites where the owner element is saved how do I translate them using the code? https://craftcms.com/docs/5.x/reference/field-types/matrix.html#saving-matrix-fields here it talks about how to save them but it doesn't talk about translations  
  > **username_1**: @username_0 You want to programmatically create entries in multiple languages? Yeah that's not super well documented. I usually create the entry in one language, then save it (which propagates it to other sites). Then retrieve the entry in the other site, translate some fields and then save it again. Not sure if that's the best approach, but it works.  
  
  ---
  
  