Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Since we don't, and can't have transliteration in core for D7 I suggest we remove the automatic machine friendly name generation from the new node type creation pages, because it is broken for non-latin languages.
For more info see #567832: Transliteration in core
Comment | File | Size | Author |
---|---|---|---|
#14 | 576180-pluggeable-machine-name-generation.patch | 2.36 KB | Damien Tournoud |
#11 | 576180-pluggeable-machine-name-generation.patch | 2.12 KB | Damien Tournoud |
Comments
Comment #1
sunThat's why there is an "edit" link to alter the auto-generated machine-readable name.
And. For multilingual sites, the best practice is to use English labels/titles anyway, so you can properly localize/translate them -- which means that the machine-readable name can be properly generated via the existing JS.
Comment #2
snufkin CreditAttribution: snufkin commentedYou assume that a site is used as multilingual by default and I don't think this is true.
With the current setup any non-latin language (russian, chinese, arabic etc) will be forced to correct the machine suggestion (which will be a single underscore). This is a faulty behaviour, and so it should be removed entirely until proper transliteration can be brought into core.
Comment #3
xslim CreditAttribution: xslim commentedHi!
I posted the same issue - #646466: Machine name generating not correctly for languages other than English
maybe we can make a check in JS file - if transliteration module is present - make AJAX call to it?
Comment #4
Damien Tournoud CreditAttribution: Damien Tournoud commented@xslim: that's an excellent idea.
Comment #5
sunerrrr. We're talking JavaScript here. Transliteration module can replace the entire behavior or even the entire .js file.
Comment #6
xslim CreditAttribution: xslim commentedso we need to make a patch to transliteration ?
Comment #7
sunYes.
Comment #8
Damien Tournoud CreditAttribution: Damien Tournoud commentedErm. No! It's not because it's javascript that we should promote sloppy programming practices. We need to abstract the crappy regexp that is currently in *two places* of
Drupal.behaviors.machineReadableValue
to a separate function that Transliteration will be able to replace.And yes, we need to do it before releasing D7.
Comment #9
Damien Tournoud CreditAttribution: Damien Tournoud commentedComment #10
xslim CreditAttribution: xslim commentedWe can add additional function like transliterate() which can be overridden by transliteration module?
Comment #11
Damien Tournoud CreditAttribution: Damien Tournoud commentedHere.
Comment #12
mfer CreditAttribution: mfer commentedI like this idea but should the translate function live at Drupal.behaviors.machineReadableValue.attach.transliterate? Or, is another location more appropriate?
Comment #13
sun1) Custom methods should have JSDoc to explain them.
2) Missing space after function.
Powered by Dreditor.
Comment #14
Damien Tournoud CreditAttribution: Damien Tournoud commentedFixed the issues raised by sun.
Comment #15
Damien Tournoud CreditAttribution: Damien Tournoud commented@mfer: the function is at
Drupal.behaviors.machineReadableValue.transliterate()
, which makes sense to me.Comment #16
sunThanks!
Comment #17
webchickSeems like a reasonable improvement. It does not cause Drupal to cease to function, and therefore is not critical.
Committed to HEAD.