By default, if we use cyrillic in the names of entries, the slug is also created in сyrillic. This is not good. And here we need transliteration such as б → b, д → d, etc.

By the way, if we create for example a new section in сyrillic, the handle, Entry URI Format and Template is created almost correctly, the exception is the characters 'Ь' and 'Ъ' - they are replaced by a space.

enter image description here

Ok, in general.php add

'limitAutoSlugsToAscii' => true

to replace characters according to ASCII character mapping. Now slug in entries should be created correctly, but again a new problem with the characters 'Ь' and 'Ъ', they are not converted.

enter image description here

in general.php add

'customAsciiCharMappings' => [
    ' ' => ['ь', 'Ь', 'ъ', 'Ъ'],

and we get the same result as when creating a new section - space.

Tried this variant:

'customAsciiCharMappings' => [
    '' => ['ь', 'Ь', 'ъ', 'Ъ'],

does not work

In the correct convertation there should be no spaces or replacement, 'Ь' and 'Ъ' should be removed (Мальчик → malchik). How to remove these spaces?


Ignoring customAsciiCharMappings for the moment, Craft uses Stringy for this type of thing.

The have some special logic for German and Bulgarian character replacements and it looks like those particular characters will only get replaced if the locale of the site you're currently editing is bg: https://github.com/danielstjules/Stringy/blob/master/src/Stringy.php#L1874-L1877

  • Yes, I saw. I tried to put the BG as the language of the site, but nothing has changed. Looking at the code, they make a replacement for these characters (Ъ → A, Ь → Y). In Russian, when convertation Cyrillic into Latin 'Ь' and 'Ъ' are not used.
    – Sol
    Jun 14 '18 at 0:02
  • Ahh... this is for Russian? Since customAsciiCharMappings is deprecated and will go away in the future, it seems like the proper thing to do would be to make a pull request to github.com/danielstjules/Stringy/blob/master/src/… and update it with the Russian-specific conversions?
    – Brad Bell
    Jun 14 '18 at 23:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.