Django

Code

Ticket #4365 (closed: fixed)

Opened 2 years ago

Last modified 1 year ago

[unicode] slug generation can be enhanced

Reported by: mtredinnick Assigned to: mtredinnick
Milestone: Component: Internationalization
Version: unicode Keywords: slug unicode i18n
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

It is worthwhile enhancing both the slugify filter and admin/media/js/admin/urlify.js to handle some foreign letters a bit better. We aren't looking to create a transliteration function, but some lightweight improvements are certainly possible.

A start was made by Bill de hÓra in this thread (django-developers) and there is also some good data in #2716.

Attachments

greek.js (0.8 kB) - added by orestis@orestis.gr on 06/05/07 06:13:38.
greek map for urlify.js
greek.2.js (0.8 kB) - added by orestis@orestis.gr on 06/05/07 06:15:21.
defaultfilters.py.patch (0.8 kB) - added by Jonas on 06/20/07 06:07:34.
Normallizes string
turkish.js (273 bytes) - added by Ahmet on 06/23/07 10:03:45.
Turkish map for urlify.js

Change History

05/26/07 08:23:24 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

06/05/07 06:13:38 changed by orestis@orestis.gr

  • attachment greek.js added.

greek map for urlify.js

06/05/07 06:15:21 changed by orestis@orestis.gr

  • attachment greek.2.js added.

06/05/07 06:17:49 changed by orestis@orestis.gr

Attached the GREEK_MAP, as requested from Bill de hÓra. Sorry for the double attachment, Trac barfed. They are the same. Note that it is encoded in UTF-8, you have to download the original and open it with an UTF-8 aware editor to see the greek characters.

06/20/07 06:06:28 changed by Jonas

  • keywords set to slug unicode i18n.
  • has_patch set to 1.

I found a solution for characters with accents, and anothers used on Europe.

Got from http://www.djangosnippets.org/snippets/98/ (_string_to_slug method) that points to http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/251871 (Aaron Bentley)

E.g:
It translates: Á È ï ô ü ñ
to:            A E i o u n

so it's very usefull for a lot of languages.

A patch is added.

06/20/07 06:07:34 changed by Jonas

  • attachment defaultfilters.py.patch added.

Normallizes string

06/23/07 10:03:45 changed by Ahmet

  • attachment turkish.js added.

Turkish map for urlify.js

07/04/07 04:28:30 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [5608]) unicode: Added unicode-aware slugify filter (in Python) and better non-ASCII handling for the Javascript slug creator in admin. Can never be perfect here, but this is more tolerant in many cases. Fixed #4365. Thanks, Bill de h?\195?\147ra, Baptiste, orestis@orestis.gr, Ahmet and Jonas for contributions to this.

07/04/07 06:31:03 changed by boobsd@gmail.com

  • status changed from closed to reopened.
  • has_patch deleted.
  • version changed from other branch to unicode.
  • resolution deleted.
  • needs_tests set to 1.

Slug don't work with Opera-9.20 browser.

07/04/07 07:32:12 changed by mtredinnick

Fixed (again) in [5610].

07/04/07 19:22:35 changed by John Shaffer <jshaffer2112@gmail.com>

  • status changed from reopened to closed.
  • resolution set to fixed.
  • needs_tests deleted.

Add/Change #4365 ([unicode] slug generation can be enhanced)




Change Properties
Action