[SOLVED] Scripting for autogenerate slug from Ukrainian


#1

Hi!
This is my script for autogenerate slug, when slug field is empty.
(see below)

I create new article with title “Тарас Шевченко” and wait to get ‘taras-shevchenko’ slug.

But after create, I see the following


#2


#3

The question is: What do you want to see? The slug tries to use ascii characters only, but I have no idea what the correct approach for Ukrainian is.


#4

After I created a title in Ukrainian, in the description of the content the slug is displayed in Ukrainian and at the same time displayed correctly in the editor (English).

If I enter the editor of this article and put a space in the slug and resave, the API will return the correct URL to me.

That is, the editor converts to the slug correctly, but the API does not return the “taras-shevchenko” but the “Тарас-Шевченко”.

Sorry for my English:)


#5

I still don’t get it. Perhaps a language barrier.


#7

https://drive.google.com/file/d/15kV5GyCvFztBopshDUfjTbmLHA5jf3hh/view


#8

If you understand what I mean without words
In editor and in preview after save different slug values


#9

Thanks for the animation, it is very clear now :slight_smile:


#10

It only happens with the slug editor. Because the javascript slug editor has different settings for slugs than the scripting system.

What is the desired behavior? To replace the Ukrainian letters to a-z or not?


#11

Yes, replace the Ukrainian letters to a-z immediately after saving, I think.


#12

Okay, I use the same table like the JavaScript implementation now.