You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are many objects which have a "slug" as well as a name: e.g. Site, Region, Rack Group, Rack Role, Device Roles, Platforms, Manufacturers, etc
Currently, when user creates one of these objects, then as they type a slug is generated from the ASCII parts of the text. Symbols and spaces are replaced with dash; high unicode characters do nothing.
In the limiting case of someone using a non-Roman alphabet, the name they enter will have no slug at all. The form cannot be saved, so they are forced to assign a Roman slug of their own.
Possible solutions:
Allow non-ASCII slugs. Django's slugify function has an allow_unicode option.
>>> slugify('What does 台灣 mean?', allow_unicode=True)
'what-does-台灣-mean'
Since slugs are intended for use in URLs, this opens a can of worms about how such slugs are actually used in URLs (percent-encoded UTF-8?)
Auto-generate proposed slugs using a library such as unidecode (Python/AJAX) or entirely in the browser using a native Javascript version.
This may work better for some languages (e.g. Chinese) than others (e.g. Japanese).
Use Case
Speakers of languages which are not based on the Roman alphabet
Database Changes
None
External Dependencies
Possibly a unidecode library.
The text was updated successfully, but these errors were encountered:
I don't think this has been fixed as of v2.8.0. To replicate:
Devices > Device Roles > +
Enter a Device Role consisting of entirely non-ASCII characters
Click Create
The creation is blocked:
If you mix in some ASCII characters, only the ASCII characters appear in the slug:
However, the fix for #3721 now allows general Unicode characters in the slug. Hence the code which generates the slug could be changed to allow everything through (except spaces to dashes)
Uh oh!
There was an error while loading. Please reload this page.
Environment
Proposed Functionality
There are many objects which have a "slug" as well as a name: e.g. Site, Region, Rack Group, Rack Role, Device Roles, Platforms, Manufacturers, etc
Currently, when user creates one of these objects, then as they type a slug is generated from the ASCII parts of the text. Symbols and spaces are replaced with dash; high unicode characters do nothing.
In the limiting case of someone using a non-Roman alphabet, the name they enter will have no slug at all. The form cannot be saved, so they are forced to assign a Roman slug of their own.
Possible solutions:
Allow non-ASCII slugs. Django's slugify function has an
allow_unicode
option.Since slugs are intended for use in URLs, this opens a can of worms about how such slugs are actually used in URLs (percent-encoded UTF-8?)
Auto-generate proposed slugs using a library such as
unidecode
(Python/AJAX) or entirely in the browser using a native Javascript version.This may work better for some languages (e.g. Chinese) than others (e.g. Japanese).
Use Case
Speakers of languages which are not based on the Roman alphabet
Database Changes
None
External Dependencies
Possibly a
unidecode
library.The text was updated successfully, but these errors were encountered: