Repository navigation
Generate url_key with Magento's translit filter so non-Latin target languages work - #71
Merged
Merged
Conversation
Bashev
requested review from
a team,
SamueleMartini and
dadolun95
as code owners
August 24, 2026 14:34
Member
|
Good to me in concept, thank you @Bashev |
Collaborator
|
Hi @Bashev, Thank you so much for your contribution! Could you also update the changelog file? |
SamueleMartini
approved these changes
Aug 26, 2026
SamueleMartini
approved these changes
Aug 26, 2026
SamueleMartini
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the target store view uses a non-Latin script (Greek, Cyrillic, …), translating a category or product fails on save with:
AdminhtmlCategoryBeforeSavePlugin(andAdminhtmlProductBeforeSavePlugin) translate theurl_keyvalue and then sanitise it with:That regex simply strips every character that is not
a-z0-9. For a Latin-script target (de/fr/it) this is fine, but for Greek/Cyrillic/etc. every letter is removed and the key collapses to a single-, which Magento then rejects — the whole save blows up.Fix
Use the same transliteration Magento core uses to build url keys (
Magento\Catalog\Model\Category::formatUrlKey→FilterManager::translitUrl).translitUrltransliterates viaMagento\Framework\Filter\Translit(which already covers Greek and other scripts), lowercases, and normalises separators.FilterManageris injected through the constructor of both plugins.Result
Greek input now produces a proper Latin slug instead of an invalid key:
Βιολογικά βότανα και τσάι-(save error)biologika-botana-kai-tsaiΚαλλυντικά προϊόντα-(save error)kalluntika-proiontaFor a value that transliterates to nothing,
translitUrlreturns an empty string, so Magento auto-generates the key from the (translated) name — no more hard error.Notes