v2-hub
v2-hub copied to clipboard
Taxonomy used in collection slug does not use translation
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:
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:
Screenshots
The routes yaml:
The 'product-group' taxonomy yaml:
The taxonomy-field 'product-group' in the fieldset used by products collection:
Environment details
- Statamic Version 2.11.14
- OS: macOs Mojave 10.14.6
- Browser: Chrome
- Web Server: Valet
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.
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:
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.)