Skip to content

Fix default template engine not loading Razor/Liquid processors - #111

Closed
linckez wants to merge 1 commit into
OrchardCoreContrib:mainfrom
linckez:main
Closed

linckez wants to merge 1 commit into
OrchardCoreContrib:mainfrom
linckez:main

Conversation

@linckez

@linckez linckez commented Mar 7, 2026

Copy link
Copy Markdown

Fix Razor/Liquid template extraction not running by default

After the migration to CommandLineUtils, template.Value() returns null when -t isn't specified, but TemplateEngine.Both was string.Empty. Since null != "", the Razor and Liquid processors never got added unless -t was explicitly passed.

Fixed TemplateEngine.Both to be null instead of string.Empty.

Reproduce:

Create a Razor file with localizable strings, e.g.:

@inject IStringLocalizer<Home> S
<p>@S["Welcome to MudBlazor"]</p>
<p>@S["This is a test of string extraction."]</p>
<p>@S.Plural(5,"You have {0} notification.", "You have {0} notifications.", 6)</p>
<p>@S["Hello {0}, you have {1} notifications.", "User", 5]</p>
# before fix
dotnet run --project src/OrchardCoreContrib.PoExtractor -- /path/to/project /tmp/output
# shows: Found 0 strings.

# after fix
dotnet run --project src/OrchardCoreContrib.PoExtractor -- /path/to/project /tmp/output
# shows: Found 4 strings.

Confirmed working on v1.2.0 (d85eda7) as a reference.

@hishamco

hishamco commented Mar 7, 2026

Copy link
Copy Markdown
Member

@linckez, could you please add a unit test?

@linckez linckez closed this by deleting the head repository Mar 26, 2026
@hishamco

Copy link
Copy Markdown
Member

Why is this closed? If you need help with the unit testing, let me know

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.

2 participants