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

Talks with non-Latin titles generate empty slugs #479

Open
andrewshadura opened this issue Aug 31, 2019 · 6 comments
Open

Talks with non-Latin titles generate empty slugs #479

andrewshadura opened this issue Aug 31, 2019 · 6 comments

Comments

@andrewshadura
Copy link
Contributor

andrewshadura commented Aug 31, 2019

When I create a talk with a non-Latin title, for example Тестовый доклад, the generated slug is an empty string, which prevents the user submitting the talk from saving it:

NoReverseMatch at /talks/new/

Reverse for 'wafer_talk' with keyword arguments '{'pk': 2, 'slug': ''}' not found. 1 pattern(s) tried: ['talks/(?P<pk>\\d+)(?:-(?P<slug>[\\w-]+))?/$']

You may want to use e.g. transliterate module to transliterate the title for the purpose of generating the slug.

Alternatively the pattern can be modified to allow an empty slug.

@drnlm
Copy link
Member

drnlm commented Sep 25, 2019

Crashing on an empty slug is something we should fix.

We also should do something better with unicode talk titles. I'm not sure what the best approach is though.

People can add arbitrary unicode characters in the talk title anyway, so I don't think transliterate is a good solution here, given it's design goals.

We could use django.text.utls allow_unicode option and create urls with unicode characters - that should work, although the percent-encoded url isn't going to be particularly readable

Something more like text-unidecode is an alternative, which will produce more ascii friendly urls, although that will also produce not particularly meaningful character strings for many languages.

@andrewshadura
Copy link
Contributor Author

Why do you think transliteration isn’t a good solution? A lot of CMS do exactly that.

@drnlm
Copy link
Member

drnlm commented Sep 25, 2019

I mean that the "transliterate" module isn't a good solution (https://pypi.org/project/transliterate/) - it supports a very limited set of languages, requires knowing the language of the title ahead of time to get good results and doesn't support arbitary non-language unicode characters sensibly.

Nothing prevents someone from creating a talk titled "♠♡♢", for example, and we need to handle that with whatever solution we come up with.

@andrewshadura
Copy link
Contributor Author

andrewshadura commented Sep 25, 2019 via email

@hodgestar
Copy link
Member

hodgestar commented Sep 26, 2019 via email

@stefanor
Copy link
Member

stefanor commented Aug 1, 2021

Talks now have a language attribute. We could transliterate from that language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants