v2-hub icon indicating copy to clipboard operation
v2-hub copied to clipboard

Taxonomy used in collection slug does not use translation

Open wautersj opened this issue 5 years ago • 2 comments

Describe the bug I'm using a taxonomy field's value (its slug) in a collection's slug. It does use the right taxonomy item, but uses its original language slug when browsing in other languages.

In my case, I have a 'products' collection, in which connected fieldset holds a taxonomy-field with name 'product-group' scoped for taxonomy items from the Taxonomy 'product-group'.

Now, in the collection slug, it uses the taxonomies originals language slug, but I obviously need it to use the available translated slug.

This is the current result: Screenshot 2019-08-23 at 14 38 49

Expected behavior I'd expect the translated slug of the taxonomy to be used (if available, and in my case, it is indeed available)

This is the desired result: Screenshot 2019-08-23 at 14 39 25

Screenshots The routes yaml: Screenshot 2019-08-23 at 14 32 36

The 'product-group' taxonomy yaml: Screenshot 2019-08-23 at 14 27 55

The taxonomy-field 'product-group' in the fieldset used by products collection: Screenshot 2019-08-23 at 14 35 41 Screenshot 2019-08-23 at 14 36 09

Environment details

  • Statamic Version 2.11.14
  • OS: macOs Mojave 10.14.6
  • Browser: Chrome
  • Web Server: Valet

wautersj avatar Aug 23 '19 12:08 wautersj

While I agree that this would be a good feature, I'm not really sure if this is considered a bug.

The route variables simply inject the values from the entry into the URL. There's not any magic where it dives into the term and translates it, etc.

Since the base locale's slug is stored for the taxonomy term, that's what you're getting in the URL.

jasonvarga avatar Oct 01 '19 14:10 jasonvarga

While we are building a second website with Statamic, this again is an issue. I can't explain to my clients that parts of the url will be in the original language, though he is visiting the site in a translation.

Maybe I wasn't clear in my explanation; I'll try to demonstrate this with a more simple example:

  • I have a 'Category' taxonomy, and an 'Articles' collection, for a multi-language website.

  • I'm providing all the necessary translations for the collection items, as for the taxonomy items. (Title and Slug, translated in the correct language, for each language)

For example: Articles items: Cat, Dog, Apple, Grape Category items: Animals, Fruit

  • I'm connecting 1 Category taxonomy to each Articles collection item, by adding a Field of type 'Taxonomy' in my Articles fieldset, named 'article-category'.

  • The detail page for my Articles collection has the following desirable slug in routs.yaml: Screenshot 2020-01-28 at 17 36 08

The website will use the correct slug, but the 'article-category' part will always show me the english slug, in whatever language i'm in. It would work like: ...

Website in English: www.site.com/category/animals/articles/dog Website in Dutch: www.site.com/nl/categorie/animals/artikels/hond

I can't believe this is as intended, or desirable. To my opinion it should fetch the slug of the translated taxonomy, since it is available.

(If I use the article-category taxonomy object in m template, it does give me the translated object, the correct one I'm expecting.)

wautersj avatar Jan 28 '20 16:01 wautersj