Skip to content

Transliterate Liquid Filter#19009

Open
urbanit wants to merge 7 commits intoOrchardCMS:mainfrom
urbanit:main
Open

Transliterate Liquid Filter#19009
urbanit wants to merge 7 commits intoOrchardCMS:mainfrom
urbanit:main

Conversation

@urbanit
Copy link
Copy Markdown
Contributor

@urbanit urbanit commented Mar 15, 2026

Add transliterate Liquid Filter

Based on https://github.com/orgs/OrchardCMS/discussions/10748 and fixes #4151 and fixes #4874

Summary

Introduces a new transliterate Liquid filter to the OrchardCore.Liquid module. It converts Unicode text (e.g. Greek,
Cyrillic, Arabic, Chinese, etc.) into its closest ASCII/Latin representation using the
https://github.com/anyascii/anyascii library.

Changes

  • Added AnyAscii (v0.3.2) package to Directory.Packages.props
  • Added TransliterateFilter.cs implementing ILiquidFilter
  • Registered the filter as transliterate in Startup.cs

Usage

Apply the filter to any string value in a Liquid template:

{{ "Ελληνικά" | transliterate }}
{# Output: Ellinika #}

{{ "Привет мир" | transliterate }}
{# Output: Privet mir #}

{{ "日本語" | transliterate }}
{# Output: Ri Ben Yu #}

Chaining with slugify

A common use case is generating URL slugs from non-Latin content — transliterate first, then slugify:

{{ ContentItem.DisplayText | transliterate | slugify }}

This is especially useful for auto-generating URL aliases for content items with titles in non-Latin scripts.

@Piedone Piedone requested a review from hishamco March 15, 2026 19:18
@hishamco
Copy link
Copy Markdown
Member

You remind me of the work that I did in Orchard Core Contrib (OCC) https://github.com/OrchardCoreContrib/OrchardCoreContrib/tree/main/src/OrchardCoreContrib.ContentLocalization.Abstractions/Transliteration 2 years ago

Please show me some usage examples before I review this

@Piedone
Copy link
Copy Markdown
Member

Piedone commented Mar 16, 2026

See the PR description for examples.

@hishamco
Copy link
Copy Markdown
Member

See the PR description for examples.

Thanks Zoltan, seems I'm blind at the beginning :)

@urbanit, how has the script been specified in your case? If you look into the related repo or the demo https://www.youtube.com/watch?v=MEmNL5tzezA, you will notice that we used a sort of script to transliterate

@sebastienros
Copy link
Copy Markdown
Member

He's back! (never left our hearts though)

@urbanit
Copy link
Copy Markdown
Contributor Author

urbanit commented Mar 23, 2026

Added:

  1. Slugify filter enriched with transliteration option
  2. MediaSlufigy functionality enriched with transliteration option

@urbanit urbanit requested a review from Piedone March 23, 2026 17:49
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add a note about the defaults changing like this to the v3 release notes, both for slugify and Media Slugify.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@urbanit are you aware of this comment of mine?

When you're done addressing all feedback of a review, click "Re-request review" in the top-right corner for each reviewer, so they know that you're done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slugify and diacritics Provide a transliteration filter

4 participants