@aaron as far as I understand linked documentation, the culture specified in the files should be okay - I'm trying to extend CompanyName.ProjectName.Localization.ProjectName.ProjectName.xml
(which is culture="en"
) with CompanyName.ProjectName.Localization.ProjectNameExtended.ProjectName.xml
(which is culture="en"
as well).
@geertveenstra did you mean to move all default localization files from CompanyName.ProjectName.Localization.ProjectName
to CompanyName.ProjectName.Localization
? And the rootNamespace: "CompanyName.ProjectName.Localization.ProjectName"
for XmlEmbeddedFileLocalizationDictionaryProvider
still works?
6.8.0, Angular, .NET Framework
Is it possible to extend default localization resources like described here?: Extending Localization Sources
I'm asking because I get the following error when I try to do so:
FATAL 2019-03-29 13:39:47,595 [1 ] Abp.AbpBootstrapper - Abp.AbpInitializationException: ProjectName source contains more than one dictionary for the culture: en
bei Abp.Localization.Dictionaries.Xml.XmlEmbeddedFileLocalizationDictionaryProvider.Initialize(String sourceName)
bei Abp.Localization.MultiTenantLocalizationSource.Initialize(ILocalizationConfiguration configuration, IIocResolver iocResolver)
bei Abp.Localization.LocalizationManager.InitializeSources()
bei Abp.AbpKernelModule.PostInitialize()
bei System.Collections.Generic.List`1.ForEach(Action`1 action)
bei Abp.AbpBootstrapper.Initialize()
Abp.AbpInitializationException: ProjectName source contains more than one dictionary for the culture: en
bei Abp.Localization.Dictionaries.Xml.XmlEmbeddedFileLocalizationDictionaryProvider.Initialize(String sourceName)
bei Abp.Localization.MultiTenantLocalizationSource.Initialize(ILocalizationConfiguration configuration, IIocResolver iocResolver)
bei Abp.Localization.LocalizationManager.InitializeSources()
bei Abp.AbpKernelModule.PostInitialize()
bei System.Collections.Generic.List`1.ForEach(Action`1 action)
bei Abp.AbpBootstrapper.Initialize()
FATAL 2019-03-29 13:39:47,700 [1 ] soft.AspNetCore.Hosting.Internal.WebHost - Application startup exception
Abp.AbpInitializationException: ProjectName source contains more than one dictionary for the culture: en
bei Abp.Localization.Dictionaries.Xml.XmlEmbeddedFileLocalizationDictionaryProvider.Initialize(String sourceName)
bei Abp.Localization.MultiTenantLocalizationSource.Initialize(ILocalizationConfiguration configuration, IIocResolver iocResolver)
bei Abp.Localization.LocalizationManager.InitializeSources()
bei Abp.AbpKernelModule.PostInitialize()
bei System.Collections.Generic.List`1.ForEach(Action`1 action)
bei Abp.AbpBootstrapper.Initialize()
bei Abp.AspNetCore.AbpApplicationBuilderExtensions.InitializeAbp(IApplicationBuilder app)
bei Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app, Action`1 optionsAction)
bei CompanyName.ProjectName.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
My folder structure for localization resources looks like this:
ProjectNameLocalizationConfigurer.cs looks like this:
public static void Configure(ILocalizationConfiguration localizationConfiguration)
{
localizationConfiguration.Sources.Add(
new DictionaryBasedLocalizationSource(
ProjectNameConsts.LocalizationSourceName,
new XmlEmbeddedFileLocalizationDictionaryProvider(
typeof(ProjectNameLocalizationConfigurer).GetAssembly(),
"CompanyName.ProjectName.Localization.ProjectName"
)
)
);
localizationConfiguration.Sources.Extensions.Add(
new LocalizationSourceExtensionInfo(
"(ProjectName",
new XmlEmbeddedFileLocalizationDictionaryProvider(
typeof(ProjectNameLocalizationConfigurer).GetAssembly(),
"CompanyName.ProjectName.Localization.ProjectNameExtended"
)
)
);
}
Please, advise!
EDIT: Removed project name from code-block
@ismcagdas yes, that gave me the right hints on what to do!
In case somebody else wants to implement sorting or ASPNETZERO team decides to implement it:
FeatureMetadata.cs
and FlatFeatureSelectDto.cs
:
public int? SortIndex { get; set; }
CustomDtoMapper.cs
:
public class MapFeatureSortIndexAction : IMappingAction<Feature, FlatFeatureSelectDto>
{
public void Process(Feature source, FlatFeatureSelectDto destination)
{
destination.SortIndex = (source[FeatureMetadata.CustomFeatureKey] as FeatureMetadata)?.SortIndex;
}
}
configuration.CreateMap<FlatFeatureSelectDto, Feature>().ReverseMap();
to configuration.CreateMap<FlatFeatureSelectDto, Feature>().ReverseMap().AfterMap<MapFeatureSortIndexAction>();
TenantRegistrationAppService.cs
:public async Task<EditionsSelectOutput> GetEditionsForSelect()
{
...
var flatFeatures = ObjectMapper
.Map<List<FlatFeatureSelectDto>>(features)
.OrderByDescending(f => f.SortIndex.HasValue)
.ThenBy(f => f.SortIndex)
.ThenBy(f => f.DisplayName)
.ToList();
...
}
Cheers!
I just found a question by @vladsd asking for something similar: [Extending feature properties #4618](https://support.aspnetzero.com/QA/Questions/4618)
6.8.0, Angular, .NET Framework
I think it would be good to have a simple way to define sorting on the public pricing table page.
Right now sorting is done in alphabetic order based on feature names. But this might not always make sense (which is why I have to use a prefix ... and that's not so beautiful ...)
I suggest something like an additional property for FeatureMetadata
, e.g.: public int SortIndex { get; set; }
Prioritize this property for sorting if set and sort the rest in alphabetic order if not set (or value is 0). And if some values are the same, also use alphabetic order.
What do you think about it?
Thanks a lot @ryancyq!
Okay then! Thank your for clarification @aaron!
@aaron I get that. But when removing a feature from an edition or a tenant, permissions that have a dependency on removed feature remain granted for users. To me, this doesn't seem to be correct.
6.8.0, Angular, .NET Framework
I have some permissions that have a feature-dependency (meaning the permissions are only available when the feature they depend on is enabled). When I remove a feature from an edition I would expect all permissions for all users and roles of all tenants that are assigned to the specific edition to be cleaned up. But this is not the case. I think, this is not the correct behaviour, right!?
Although, it might come in handy when romving a feature by accident - because then you just need to add the feature again and everything is fine.
6.8.0, Angular, .NET Framework
It seems FeatureCheckerService
does not respect IgnoreFeatureCheckForHostUsers = true
.
I have an AppMenuItem that requires a certain feature as well as a certain permission.
When editing permissions for a host user I can see all permissions that would require certain features to be shown. So all is fine here.
But when it comes to feature-checking in app-navigation.service.ts
the result is for host is false
. I'd expect it to be true, since feature-check for host should be ignored, right!? Isn't it intended like that?