statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Taxonomy used in collection slug does not use translation #2435

Open wautersj opened 5 years ago

wautersj commented 5 years ago

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

jasonvarga commented 4 years ago

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.

wautersj commented 4 years ago

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:

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

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