Generally, style guides recommend this rather than underscores.
So, this patch adds a new option (radios) to the admin screen on the file settings page to select either underscore or hyphen. It then uses this when cleaning the file names. Defaults to an underscore.
Note:
1) This needs to match the regexp and I can not see other use cases for this, thus the two options only.
2) This was the primary reason behind #1919874: An alter hook for transliteration_clean_filename()?, but after looking at the clients data, there is a fair amount of custom cleaning up of the file names to do on top of just using transliteration_clean_filename().
Comments
Comment #1
alan d. commentedThe transliterate existing file names could be updated too:
I'll re-roll if there is interest
Comment #2
amateescu commentedYep, I'm definitely interested in this. I had a patch concerning this functionality a while back, in #862248-8: Option to keep space, would you be interested in moving that forward instead or you prefer to go with something basic (your patch) at first?
Comment #3
alan d. commentedHappy with either (I didn't see the other patch before)
I did attempt the file update page quickly for a project, but it failed badly (on an almost live site) so I manually went in and fixed the file names and db tables up - so probably not a good start for moving this forward....
Does Transliteration 7.x now have to try and stay in sync with Drupal 8.x core? Or are you happy letting these drift? I have only seen the module folder in core, so I'm not sure what made it in.
Comment #4
amateescu commentedOnly the equivalent of
_transliteration_process()made it in core, and it's only used for transliterating machine names. The filename related functionality is not in yet (I don't think there's even an issue for it), so yes, we can go crazy here.Or even better, take the file functionality from this project, improve it by finishing the patch referenced above and submit it as a core patch :)
Close to the release of D8 or when we know that transliteration features won't be added anymore, we will backport everything to a 7.x-4.x branch here.
Comment #5
r_morgan commentedI re-rolled this patch. Since neither this patch nor https://www.drupal.org/node/1919874 will apply to the current code base.
Comment #6
chris matthews commentedThe 2 year old patch in #2 does not apply to the latest 7.x-3.x development snapshot and may be too old to reroll, but I went ahead and tagged the issue accordingly.