Answers.Body: <p>Since the URL is specific for each multisite, simply do not use <code>section.handle</code> in the structure's URI definition, but go for the term you want as a string instead, e.g.</p>
  <ul>
  <li>English: <code>{parent.uri ?? 'products'}/{slug}</code></li>
  <li>German: <code>{parent.uri ?? 'produkte'}/{slug}</code></li>
  <li>French: <code>{parent.uri ?? 'produits'}/{slug}</code></li>
  </ul>
  <p>and so on...</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-22T20:55:41.907Z
Answers.Text: But then won't `parent.uri` still overwrite whatever I put instead of `section.handle`?
Answers.UserDisplayName: idix
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-22T21:36:34.803Z
Answers.Text: Yes, it does, but only from the second level of the section and deeper. And since the first level already contains the translated version, this will be inherited to all levels below. `parent.uri ?? 'products'` means: take `parent.uri` if defined and not empty, otherwise go for the the string after `??`. In the 2nd level and deeper, `parent.uri` is defined and will contain the translated string you need.
Answers.UserDisplayName: Matthias Redl-Mann
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-23T07:11:29.517Z
Answers.Text: Ah of course, that's actually embarrassingly simple. I was so confused as to how `parent.uri` would be generated but it makes complete sense now that I see your explanation. Thanks!
Answers.UserDisplayName: idix
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-22T18:42:20.457Z
Answers.LastActivityDate: 2020-11-22T18:42:20.457Z
Answers.UserDisplayName: Matthias Redl-Mann
Body: <p>I'm working on a multilingual website where I have one structure called <strong>Products</strong>. Currently, this structure's URI format is configured like this:</p>
  <pre><code>{parent.uri ?? section.handle}/{slug}
  </code></pre>
  <p>Which returns URLs like this:</p>
  <pre><code>/products/topLevelProduct1
  /products/topLevelProduct1/nestedProduct1
  /products/topLevelProduct1/nestedProduct2
  
  /products/topLevelProduct2
  /products/topLevelProduct2/nestedProduct1
  /products/topLevelProduct2/nestedProduct2
  
  etc
  </code></pre>
  <p>The main thing I'm struggling with now is: how do I translate the top-level part of the URI (i.e. <code>/products</code>)? I guess I could use the built-in <code>t()</code> function on <code>section.handle</code> (is that even a good idea?) but that would still be overwritten by <code>parent.uri</code>.</p>
  
Tags: <craft3><localization><url><structure>
Title: How to translate a structure url
ThreadText: # How to translate a structure url
  
  (Asked by: username_0 on 2020-11-22)
  
  I'm working on a multilingual website where I have one structure called **Products**. Currently, this structure's URI format is configured like this:
  
  ```
  {parent.uri ?? section.handle}/{slug}
  
  ```
  
  Which returns URLs like this:
  
  ```
  /products/topLevelProduct1
  /products/topLevelProduct1/nestedProduct1
  /products/topLevelProduct1/nestedProduct2
  
  /products/topLevelProduct2
  /products/topLevelProduct2/nestedProduct1
  /products/topLevelProduct2/nestedProduct2
  
  etc
  
  ```
  
  The main thing I'm struggling with now is: how do I translate the top-level part of the URI (i.e. `/products`)? I guess I could use the built-in `t()` function on `section.handle` (is that even a good idea?) but that would still be overwritten by `parent.uri`.
  
  **Tags:** craft3, localization, url, structure
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-11-22. Score: 2 | Accepted answer
  
  Since the URL is specific for each multisite, simply do not use `section.handle` in the structure's URI definition, but go for the term you want as a string instead, e.g.
  
  * English: `{parent.uri ?? 'products'}/{slug}`
  * German: `{parent.uri ?? 'produkte'}/{slug}`
  * French: `{parent.uri ?? 'produits'}/{slug}`
  
  and so on...
  
  > **Comments:**
  > **username_0**: But then won't `parent.uri` still overwrite whatever I put instead of `section.handle`?  
  > **username_1**: Yes, it does, but only from the second level of the section and deeper. And since the first level already contains the translated version, this will be inherited to all levels below. `parent.uri ?? 'products'` means: take `parent.uri` if defined and not empty, otherwise go for the the string after `??`. In the 2nd level and deeper, `parent.uri` is defined and will contain the translated string you need.  
  > **username_0**: Ah of course, that's actually embarrassingly simple. I was so confused as to how `parent.uri` would be generated but it makes complete sense now that I see your explanation. Thanks!  
  
  ---
  
  