mozilla / unicode-slugify

A slugifier that works in unicode
BSD 3-Clause "New" or "Revised" License
321 stars 52 forks source link

replace_latin boolean #13

Closed ebsaral closed 9 years ago

ebsaral commented 9 years ago

Mentioned in my first merge request, smart_boolean enables to replace common latin letters with their ascii representations.

Example:

from slugify import slugify
>>> slugify(u'Bakıcı geldi')
u'bak\u0131c\u0131-geldi'
>>> slugify(u'Bakıcı geldi', smart_replace=True)
u'bakici-geldi'

So that people who does not have 'ı' letter in their keyboards will be able to match the string by using either 'ı' or 'i' from their keyboards.

For current version, 'bakici' cannot match 'bakıcı'. But with smart_replace, 'bakıcı' and 'bakici' can both match 'bakıcı' because 'bakici' may represent 'bakıcı' within an English keyboard.

List of common latin letters to replace

davedash commented 9 years ago

This looks good, if you can make those minor changes that'd be great, and I'll merge this.

davedash commented 9 years ago

Also... may want to consider this library too:

https://github.com/dimka665/awesome-slugify

It might do everything this one does and then some already.

ebsaral commented 9 years ago

I checked that library but I liked this one since it's simple.

Made the changes.

ebsaral commented 9 years ago

If it's possible to build a new version with that merge, I would like to use this package in my requirements.