-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show only language dependent taxonomies #40
Comments
Having the same experience as the OP, as described in this thread: https://discourse.getgrav.org/t/taxonomylist-is-displaying-the-tags-of-all-languages/23481 |
Same here. It only changes to the correct language after I reload the page where the list is. |
I would like to confirm that this problem is dependent on having LangSwitcher installed – in a fresh multilanguage Grav install the taxonomies are displayed only in their language, as expected. Adding LangSwitcher to the plugins results in all the tags of every language displayed. |
I partly agree with @skinofthesoul : I have a site with two languages (English + Spanish). Upon cleaning the cache and being located in either of the two languages, the tag list is fine. When switching to the other one, suddenly all tags from both languages are displayed. Example: when located in Spanish, after clearing the cache and reloading the page, I get a clean list of tags in Spanish. If I then switch to English, I get a list of Spanish + English tags. Sames works the other way round: when located in English, clear cache + reload page = clean list of tags in English. Then switching to Spanish results in list with English + Spanish. |
Interesting! I just tried that on my fairly fresh test installation, and it does NOT work like that for me – clearing the cache has no effect on the muddled tags. |
Can someone create a zip bundle of the exact setup for you that causes issues? I have not been able to replicate this issue with any of my multi-site setups. |
Try this – languages are English and German, taxonomy list on the blog page shows three German tags and one English no matter what. Admin login is "admin" and "Admin1234!" (or copy in your own file of course). |
Ok, so the root cause of this is langswitcher plugin. Specifically the newish translated URLs functionality. This works by looping though all the languges and building the routes up for the other languages. The unintended consequence of this is that it also re-initializes the taxonomy as part of that process. As it has already initialized once, for the 'active' language, it just keeps appending the other language's taxonomy to the taxonomy object. This is a bit more fo a complex issue to solve that I had hoped for. I need to think of the best approach the keeps the translated URL functionality in langswitcher, but doesn't reinitialize everything causing taxonomy to get poluted with other languages. Alternatively I could rewrite how Taxonomy is processed and prefix everything with active language. This might be the better solution overall, but there could be other unforsee implciations. Short tterm fix is to turn off that translated_urls feature in langswitcher. |
That's my setup, with some sample data. I left the I have been reluctant to upload this version to my formal webserver, but could eventually do so. There, an Apache is running. I can however reproduce the same issue on my local Apache. |
Yes, I can confirm this and this works currently for me. Thanks! |
BTW, you need to rename your |
I think i have a solution.. Please test with this replacement for |
Yepp - works well for me! |
Yes, perfect! Thank you! |
Sorry, but I need to pick this issue up again. The fix worked for the taxonomy list in different languages. But I believe it broke something in page collections that are based on taxonomy options. This is my frontmatter that works with the original version of
When applying the fix, I am getting the following error message:
And it refers to You can see an example here, but being it a public site, there is not much more detail; I can provide additional detail and logs if required. |
I'll take a look. |
@sebastian0119 can you please provide the stacktrace for this error from the |
Also would be super helpful if i could get a copy of your 'user' folder so i can test that and see what you are doing different to me. perahps put it up on cloud hosting somewhere, and send a link to devs @ getgrav.org. |
Sure; please find attached the stacktrace from grav.log |
The problem is the error is defnitely in the Twig.. So it's probably something with your theme. I'll need a copy of your site to debug further, but this error is not coming from Taxonomy.php that I can see. |
Just sent it to you. |
Strange though, because be just switching out the modified Anyway, I sent you the user directory with a working (or not working ;-) ) example. Thanks in advance. |
I tested with your user folder and it worked fine for me. I suggest using this version: https://raw.githubusercontent.com/getgrav/grav/afb5b02e5750f0f9c0bcc73de5d3f62947881722/system/src/Grav/Common/Taxonomy.php Couple of things:
|
Yepp - the updated And thanks for the recommendations! I'll implement them right away. |
Will there be a new version of the plugin with this file? |
In my site I see all languages taxonomylist (PL and RU in my case):
How to show only current lang taxlist?
P.S. Is #22 a right workaround?
The text was updated successfully, but these errors were encountered: