[SOLVED] Scripting for autogenerate slug from Ukrainian

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

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.

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:)

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


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

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

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?

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

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