mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using JetBrains.Annotations;
|
|
|
|
namespace Volo.Abp.Localization;
|
|
|
|
public class LocalizationResource : LocalizationResourceBase
|
|
{
|
|
[NotNull]
|
|
private Type ResourceType { get; }
|
|
|
|
public LocalizationResource(
|
|
[NotNull] Type resourceType,
|
|
[CanBeNull] string defaultCultureName = null,
|
|
[CanBeNull] ILocalizationResourceContributor initialContributor = null)
|
|
: base(
|
|
LocalizationResourceNameAttribute.GetName(resourceType),
|
|
defaultCultureName,
|
|
initialContributor)
|
|
{
|
|
ResourceType = Check.NotNull(resourceType, nameof(resourceType));
|
|
AddBaseResourceTypes();
|
|
}
|
|
|
|
protected virtual void AddBaseResourceTypes()
|
|
{
|
|
var descriptors = ResourceType
|
|
.GetCustomAttributes(true)
|
|
.OfType<IInheritedResourceTypesProvider>();
|
|
|
|
foreach (var descriptor in descriptors)
|
|
{
|
|
foreach (var baseResourceType in descriptor.GetInheritedResourceTypes())
|
|
{
|
|
BaseResourceNames.AddIfNotContains(LocalizationResourceNameAttribute.GetName(baseResourceType));
|
|
}
|
|
}
|
|
}
|
|
}
|