diff --git a/framework/src/Volo.Abp.TextTemplating/Volo.Abp.TextTemplating.csproj b/framework/src/Volo.Abp.TextTemplating/Volo.Abp.TextTemplating.csproj
index 404259ae17..7bcc0400b5 100644
--- a/framework/src/Volo.Abp.TextTemplating/Volo.Abp.TextTemplating.csproj
+++ b/framework/src/Volo.Abp.TextTemplating/Volo.Abp.TextTemplating.csproj
@@ -19,6 +19,7 @@
+
diff --git a/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/AbpTextTemplatingModule.cs b/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/AbpTextTemplatingModule.cs
index aca0ac8f53..8d76391829 100644
--- a/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/AbpTextTemplatingModule.cs
+++ b/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/AbpTextTemplatingModule.cs
@@ -1,13 +1,15 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.TextTemplating
{
[DependsOn(
- typeof(AbpVirtualFileSystemModule)
+ typeof(AbpVirtualFileSystemModule),
+ typeof(AbpLocalizationAbstractionsModule)
)]
public class AbpTextTemplatingModule : AbpModule
{
diff --git a/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateContentProvider.cs b/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateContentProvider.cs
index 8710068bca..55a3979e21 100644
--- a/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateContentProvider.cs
+++ b/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateContentProvider.cs
@@ -63,21 +63,18 @@ namespace Volo.Abp.TextTemplating
var contributors = CreateTemplateContentContributors(scope.ServiceProvider);
//Try to get from the requested culture
- if (cultureName != null)
- {
- templateString = await GetContentOrNullAsync(
- contributors,
- new TemplateContentContributorContext(
- templateDefinition,
- scope.ServiceProvider,
- cultureName
- )
- );
+ templateString = await GetContentOrNullAsync(
+ contributors,
+ new TemplateContentContributorContext(
+ templateDefinition,
+ scope.ServiceProvider,
+ cultureName
+ )
+ );
- if (templateString != null)
- {
- return templateString;
- }
+ if (templateString != null)
+ {
+ return templateString;
}
if (!tryDefaults)
diff --git a/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateDefinition.cs b/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateDefinition.cs
index 769b970733..db2ccf6f63 100644
--- a/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateDefinition.cs
+++ b/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateDefinition.cs
@@ -1,14 +1,29 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
+using Volo.Abp.Localization;
namespace Volo.Abp.TextTemplating
{
public class TemplateDefinition
{
+ public const int MaxNameLength = 128;
+
[NotNull]
public string Name { get; }
+ [NotNull]
+ public ILocalizableString DisplayName
+ {
+ get => _displayName;
+ set
+ {
+ Check.NotNull(value, nameof(value));
+ _displayName = value;
+ }
+ }
+ private ILocalizableString _displayName;
+
public bool IsLayout { get; }
[CanBeNull]
@@ -44,14 +59,16 @@ namespace Volo.Abp.TextTemplating
public Dictionary Properties { get; }
public TemplateDefinition(
- [NotNull] string name,
- [CanBeNull] Type localizationResource = null,
+ [NotNull] string name,
+ [CanBeNull] Type localizationResource = null,
+ [CanBeNull] ILocalizableString displayName = null,
bool isLayout = false,
- string layout = null,
+ string layout = null,
string defaultCultureName = null)
{
- Name = Check.NotNullOrWhiteSpace(name, nameof(name));
+ Name = Check.NotNullOrWhiteSpace(name, nameof(name), MaxNameLength);
LocalizationResource = localizationResource;
+ DisplayName = displayName ?? new FixedLocalizableString(Name);
IsLayout = isLayout;
Layout = layout;
DefaultCultureName = defaultCultureName;