Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

LocalizationSourceExtensionInfo conflict #5109


User avatar
0
ivanosw1 created

Hi, My module has his own xml localization. I need to extend some default message of Abp, but on startup I receive this error:

FATAL 2018-05-11 17:20:40,450 [1 ] Abp.AbpBootstrapper - Abp.AbpInitializationException: Security source contains more than one dictionary for the culture: en at Abp.Localization.Dictionaries.Xml.XmlEmbeddedFileLocalizationDictionaryProvider.Initialize(String sourceName) at Abp.Localization.LocalizationManager.InitializeSources() at Abp.AbpKernelModule.PostInitialize() at System.Collections.Generic.List1.ForEach(Action1 action) at Abp.AbpBootstrapper.Initialize()

This is my code

public static  class SecurityLocalizationConfigurer
    {
        public static void Configure(ILocalizationConfiguration localizationConfiguration)
        {
            localizationConfiguration.Sources.Add(
                new DictionaryBasedLocalizationSource(
                    DomainConsts.LocalizationSourceName,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        Assembly.GetExecutingAssembly(),
                        "Uno.Security.Core.Localization"
                    )
                )
            );

            localizationConfiguration.Sources.Extensions.Add(
                new LocalizationSourceExtensionInfo(FrameworkConsts.LocalizationSourceName,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        Assembly.GetExecutingAssembly(),
                        "Uno.Security.Core.LocalizationExtensions"
                    )
                )
            );
        }
    }

and the folder structure is: root ---Localization ------Security.xml ---LocalizationExtensions ------Framework.xml

Note that localization works fine for my security.xml. When I add the extensions, the application hangs. How Can I override default message and also manage my own localization on same project?

Thanks Ivano


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It seems this is simlar to <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3161">https://github.com/aspnetboilerplate/as ... ssues/3161</a>. Could you upgrade your ABP nuget package version and try again ?

  • User Avatar
    0
    ivanosw1 created

    I found It !!

    After moving the xml localization file to different namespace that doesn't start with the same name, all works fine. I guess localizations are added by looking root namespace with a "start with" pattern.

    root ---Localization ------Extensions -----------Security.xml ------Sources -----------Framework.xml

    Problem resolved.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I guess localizations are added by looking root namespace with a "start with" pattern.

    Yes, correct.

    Thanks for the feedback :)