Skip to content
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

Issue with the translation of the "event" part of the slug #722

Closed
1 task done
Tracked by #744
patriciabt opened this issue Jul 4, 2024 · 15 comments · Fixed by #812
Closed
1 task done
Tracked by #744

Issue with the translation of the "event" part of the slug #722

patriciabt opened this issue Jul 4, 2024 · 15 comments · Fixed by #812
Assignees
Labels
bug Something isn't working i18n Internationalisation & Localisation
Milestone

Comments

@patriciabt
Copy link
Collaborator

Describe the bug

I saw a strange behaviour on a German site.

When I'm logged in and my profile is in English, the event link has "event" in the slug, before the url slug
When I'm logged out, and the site is set to German, the slug becomes "veranstaltung", and on that site, it lead to a 404
This was seen on a standalone site https://tuchlaubenkonzerte.ch/ (now set to English for their visitors to be able to see the events)
On this site, it was first installed with GP 0.27.0 some months ago, and it worked, and now I updated to 0.29.3 and used the Alpha plugin "Fix GatherPress".

I first saw the same issue on our Tests/Demo site (first installed with GP 0.29.2, then upgraded to GP 0.29.3)
in the German group
https://demo.gatherpress.org/sudsauerland/veranstaltung/ki-ai-rechtliche-aspekte-und-praktische-beispiele-beim-einsatz-in-wordpress/
But strangely, it now works, (tried as logged-out), so I'm not even sure how to reproduce

In French, it works with "évènements" in the URL, and if I manually type "events" it redirects well to "évènements" but it creates that encoded URL that is not nice to share (I should set to evenements in the translations, without accents)

Waiting for Spanish groups to test, and see how it will work with "eventos".

In my opinion, it would be better to have a setting under Permalinks (like the categories and tags) or under GatherPress settings, to be able to set a user-defined word for that slug, and also not to have different URLs depending on the language for a given event. In the current way, the event link would be different if the site admin changes the language. And we should even allow to not have anything between the domain name and the event slug in the permalinks

Steps to Reproduce

Not sure

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

Version 6.5.5
Permalink structure /%postname%/

Code of Conduct

  • I agree to follow this project's Code of Conduct
@patriciabt patriciabt added the bug Something isn't working label Jul 4, 2024
@patriciabt
Copy link
Collaborator Author

For now, I solved it temporarily on my friend's site by changing in the gatherpress-de_DE.po and .mo to:

#: includes/core/classes/class-event-setup.php:141
msgctxt "Post Type Slug"
msgid "event"
msgstr "event"


instead of "veranstaltung"

maybe good to have some input from @carstingaxion (when you are back from holidays :D )

@patriciabt
Copy link
Collaborator Author

For the change request and to have it in options, I was thinking something like in this example (bbPress), because for events, someone might well want to call them concerts, meetings, masses, whatever...

image

@mauteri
Copy link
Contributor

mauteri commented Jul 8, 2024

@patriciabt cool, let's chat about this in Friday's huddle and put an action item together. Just to check, did you try re-saving permalinks on the site? That can cause unexpected issues if the permalinks haven't been updated and usually best first step with issues like this. Thx!

@carstingaxion
Copy link
Collaborator

carstingaxion commented Jul 9, 2024

@mauteri: @patriciabt cool, let's chat about this in Friday's huddle and put an action item together. Just to check, did you try re-saving permalinks on the site? That can cause unexpected issues if the permalinks haven't been updated and usually best first step with issues like this. Thx!

This is related (#628 (comment)) to the missing has_archive property of the post type registration, I guess. @mauteri might have missed this relation in the first PR, when the translated slugs where introduced in #563 and #565.

Let's see if I can fix this.

@carstingaxion
Copy link
Collaborator

  • when site default is set to EN, and I as a user select German in my profile, I don't get any translations (because the translation files are not part of the plugin anymore and haven't been downloaded to the server yet) (this needs to be fixed in GatherPress)
  • when site default is set to DE and all language updates are installed, I can switch back to make the site default EN. Now I do get german translations, when set in my user profile. (But I'll not get any updates on that translations, until a site-admin will do the former steps again!) (This needs a workaround, too)

re-saving permalinks

... won't be enough, because GatherPress might have to change the logic here. Instead of using the users language, the language of the event slug should be dictated by the sites default language!

For all things going further, a site owner might have to use a dedicated multilingual plugin.

@patriciabt
Copy link
Collaborator Author

@mauteri
Copy link
Contributor

mauteri commented Jul 17, 2024

Should we flush rewrite rules when site language is changed?

@patriciabt
Copy link
Collaborator Author

resaving the permalinks doesn't solve this.

Also, in my opinion it's not a good idea to have a slug in the translation strings, because 1. if the site changes, the url to event changes which is not a good idea and 2. people might want to give another name than "event", see my last paragraph above in the first text in this issue and the bbPress example. I don't think "the language of the event slug should be dictated by the sites default language" as you say @carstingaxion I think the slug should be defined by the organizers

@mauteri
Copy link
Contributor

mauteri commented Jul 17, 2024

Ok, got it. So maybe this is a setting in GatherPress then. We should do the same for venue, topics, etc as well.

@patriciabt
Copy link
Collaborator Author

hmmm I feel the "decisions, not options" is in the way here :D
maybe to be discussed during next Friday's huddle

@patriciabt

This comment has been minimized.

@enrico-sorcinelli
Copy link

Hello Team!
I've been playing around with the demo site creating some contents and IMHO it is a very nice project! 👍
Me too I just ran into this issue.
IMHO I think that using translations for slugs settings (or generically settings used programmatically and not only as simple strings on FE side) it isn't a too safe idea. I mean that even if there is a context, translators might also use characters (like spaces. newlines, UTF8 characters and so on) that can break something or cause unexpected behaviors without a suitable validation.

@carstingaxion
Copy link
Collaborator

Hello Team! I've been playing around with the demo site creating some contents and IMHO it is a very nice project! 👍

Hello and thank you for your kind words @enrico-sorcinelli !

Me too I just ran into this issue. IMHO I think that using translations for slugs settings (or generically settings used programmatically and not only as simple strings on FE side) it isn't a too safe idea.

You are right and we agree. We came to that conclusion also and are looking forward to fix this.

I mean that even if there is a context, translators might also use characters (like spaces. newlines, UTF8 characters and so on) that can break something or cause unexpected behaviors without a suitable validation.

Another valid reason to not do it, like it is.
Thanks for that, too.

@carstingaxion
Copy link
Collaborator

carstingaxion commented Aug 23, 2024

@mauteri I can imagine, we split this into two parts.

  1. A fast fix, that applies approx. this logic:
    • on install and/or activation
    • get the current site language and set that locale for the setup, ignoring the language preferred by the user
    • get the translation of ‚events‘ to set a localised default for the site
    • run it through sanitize_title_with_dashes() etc. to make sure there is no invalid char
    • Save the string to GatherPress’ general settings
    • Introduce a gatherpress_post_type_slug filter at this point
    • get the filtered setting into register_post_type
    • Do the same for ‚venues‘ and ‚topics‘!
    • Done. For now.
  2. Add UI and additional rewrite_tags in a follow-up PR

@carstingaxion carstingaxion added the i18n Internationalisation & Localisation label Aug 26, 2024
@carstingaxion
Copy link
Collaborator

@patriciabt , @enrico-sorcinelli , @hagege

We have a fix for the rewrite base issue, we all encountered.

Please have a look at the the Playground Preview link of PR #812 to test this instantly.

@github-project-automation github-project-automation bot moved this from In Progress to Done in GatherPress Project Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working i18n Internationalisation & Localisation
Projects
Development

Successfully merging a pull request may close this issue.

4 participants