Problem/Motivation
In some languages including german it is very common to combine words so they can become pretty long. Since not all browsers have the ability to use automatic hyphenation, especially on Windows (see https://caniuse.com/?search=hyphen) and simple text fields don't allow the usage of the HTML entity ­ a common workaround is using the unicode character for a soft hyphen (see https://en.wikipedia.org/wiki/Soft_hyphen) as a workaround.
Because pathauto treats it like a special character but doesn't make it configurable what to do with it, the soft hyphens become "real", visible hyphens (or replaced by another seperator if another is configured) in the path generation which is unintended and breaks the readability of the path.
Example
Donaudampfschifffahrtsgesellschaft
The above word contains some unicode soft hyphens which will only become visible when the word needs to be broken apart to fit it's container
When using pathauto with this string it becomes:
donau-dampf-schiff-fahrts-gesell-schaft
Steps to reproduce
Use a soft hyphen for example in the title of a node and generate a path alias with it. It will fill in the soft hyphens with visible hyphens.
Proposed resolution
Add the option to configure how soft hyphens should be handled just like with other punctuation symbols.
Remaining tasks
Review the patch I made, for me it is working, seems like a no-brainer.
User interface changes
New option to configure how soft hyphens are handled will appear on the settings page of pathauto.
API changes
None
Data model changes
None except that the exported pathauto config will include a new "soft_hyphen" setting.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | softhyphens-3181986.png | 5.52 KB | alessons |
| #3 | soft_hyphen_support-3181986-3.patch | 1.44 KB | fisherman90 |
Issue fork pathauto-3181986
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
fisherman90Here is a simple patch I made.
Comment #3
fisherman90Added a new version of the patch because I forgot the tests.
Comment #4
fisherman90Updated issue description to make clear that the soft hyphens get replaced by the separator which is a normal hyphen by default.
Comment #5
alessons commentedHi there!, I've tested the patch and seems to work as expected.
Comment #9
mably commented