mirror of https://github.com/abpframework/abp.git
12 changed files with 165 additions and 87 deletions
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending |
||||
|
{ |
||||
|
[Serializable] |
||||
|
public class LocalizableStringDto |
||||
|
{ |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[CanBeNull] |
||||
|
public string Resource { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -1,37 +0,0 @@ |
|||||
using System; |
|
||||
using JetBrains.Annotations; |
|
||||
using Volo.Abp.Localization; |
|
||||
|
|
||||
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending |
|
||||
{ |
|
||||
[Serializable] |
|
||||
public class LocalizedDisplayNameDto |
|
||||
{ |
|
||||
public string Name { get; set; } |
|
||||
|
|
||||
public string Resource { get; set; } |
|
||||
|
|
||||
[CanBeNull] |
|
||||
public static LocalizedDisplayNameDto CreateOrNull(ILocalizableString localizableString) |
|
||||
{ |
|
||||
if (localizableString is LocalizableString localizableStringInstance) |
|
||||
{ |
|
||||
return new LocalizedDisplayNameDto |
|
||||
{ |
|
||||
Name = localizableStringInstance.Name, |
|
||||
Resource = LocalizationResourceNameAttribute.GetName(localizableStringInstance.ResourceType) |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
if (localizableString is FixedLocalizableString fixedLocalizableString) |
|
||||
{ |
|
||||
return new LocalizedDisplayNameDto |
|
||||
{ |
|
||||
Name = fixedLocalizableString.Value, |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
return null; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace Microsoft.Extensions.Localization |
||||
|
{ |
||||
|
public static class AbpStringLocalizerFactoryExtensions |
||||
|
{ |
||||
|
public static IStringLocalizer CreateDefaultOrNull(this IStringLocalizerFactory localizerFactory) |
||||
|
{ |
||||
|
return (localizerFactory as IAbpStringLocalizerFactoryWithDefaultResourceSupport) |
||||
|
?.CreateDefaultOrNull(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using JetBrains.Annotations; |
||||
|
|
||||
|
namespace Microsoft.Extensions.Localization |
||||
|
{ |
||||
|
public interface IAbpStringLocalizerFactoryWithDefaultResourceSupport |
||||
|
{ |
||||
|
[CanBeNull] |
||||
|
IStringLocalizer CreateDefaultOrNull(); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue