Skip to main content

[![Build Status](https://travis-ci.org/eminbugrasaral/unicode-slugify-latin.svg?branch=master)](https://travis-ci.org/eminbugrasaral/unicode-slugify-latin)

Links

PyPi: https://pypi.python.org/pypi/unicode-slugify-latin

Github: https://github.com/eminbugrasaral/unicode-slugify-latin

# Unicode Slugify (with Latin Hack)

Unicode Slugify is a slugifier that generates unicode slugs. It was originally used in the Firefox Add-ons web site to generate slugs for add-ons and add-on collections. Many of these add-ons and collections had unicode characters and required more than simple transliteration.

## Install

pip install unicode-slugify-latin

## Usage

>>> import slugify
>>> slugify.slugify(u'Bän...g (bang)')
u'bäng-bang'

## Latin Hack

  • Replaces special Latin chars with similar ascii representations.

  • Problem: I want users who speak Latin languages with English keyboards to be able to search through my Latin strings.

  • Solution: Slugify that Latin string by enabling Latin replacement, and match this string with the slugified search word.

  • Example: Strore “Sabancı Üniversitesi” as “sabanci-universitesi” and then users will be able to search with any combination like “Sabanci”, “Sabancı” and “SABANCI”.

  • Note: Do not forget to slugify both strings with replace_latin=True

## Example

>>> from slugify import slugify
>>> string_without_latin_letters = slugify(u'ıspanaklı boğaz turşusu', replace_latin=True)
u'ispanakli-bogaz-tursusu'
>>> slugify(u'Ispanakli Bogaz Tursusu') == string_without_latin_letters
True
>>> u'Bogazici'.lower() in slugify(u'boğaziçi', replace_latin=True)
True
>>> slugify(u'çiçek', replace_turkish=True) in slugify(u'ÇİÇEK', replace_latin=True)
True
>>> u'cicek' in slugify(u'ÇİÇEK', replace_latin=True)
True

## List of common latin letters to be replaced

  • ı, ì, í, î, ï -> i

  • İ, Ì, Í, Î, Ï -> I

  • ö, ó, ò, ô, õ, ø -> o

  • Ö, Ò, Ó, Ô, Õ, Ø -> O

  • ü, ù, ú, û -> u

  • Ü, Ù, Ú, Û -> U

  • à, á, â, ã, ä, å -> a

  • À, Á, Â, Ã, Ä, Å -> A

  • æ -> ae

  • Æ -> AE

  • è, é, ê, ë -> e

  • È, É, Ê, Ë -> E

  • ñ -> n

  • Ñ -> N

  • ý, ÿ -> y

  • Ý, Ÿ -> Y

  • ş -> s

  • Ş -> S

  • ç -> c

  • Ç -> C

  • ğ -> g

  • Ğ -> G

## New parameters after this fork

  • replace_latin: Replace common Latin letters to be replaced with similar ascii representation.

  • unicode_pairs: You can give a dictionary of unicode characters with their replacement values. Like: {u’xe9’, ‘e’} - é will be replaced with e

## Sponsors

## Contact

Metadata

Release files for unicode-slugify-latin 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unicode-slugify-latin 0.2
File Size Uploaded Provenance Actions
unicode-slugify-latin-0.2.tar.gz 5.9 kB Without provenance Details for unicode-slugify-latin-0.2.tar.gz

Release files / unicode-slugify-latin-0.2.tar.gz

Download URL unicode-slugify-latin-0.2.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7dc3fcefd5df2f97cfdb12e8227dd4beffd162e121b8cc1cc08e9e0acc028134
BLAKE2b-256 checksum
How to use checksums
c1da0f6944188b7226c5959573d95fdf43ec3648264ffe375ea558a8e1c955c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for unicode-slugify-latin 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page