Base solution for your next web application
Open Closed

Merge Localization Sources #2068


User avatar
0
mfl created

Hi,

Is it possible to merge localization sources?

For example, i have in another assembly custom localization xml files and registred like the code below:

public override void PreInitialize()
        {
            //Add/remove localization sources
            Configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(
                    "MyApp",
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        Assembly.GetExecutingAssembly(),
                        "MyAppCore.Localization.MyApp"
                        )
                    )
                );
        }

I would like to merge this localization with the default AspNetZero localization source. Because in the angular application, when i need to localize some stuff from the MyApp resources, I always need to specify the source like this: abp.localization.localize('something', 'MyApp');

I would like to avoid this and have those sources merged to simplify the use of localization in the angular application by calling always app.localize('something');

Thanks


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

    Hi,

    That is not possible. But you can create shortcut functions like this.

    var appLocalizationSource1 = abp.localization.getSource('LocalizationSource1');
    app.localize1 = function () {
        return appLocalizationSource1.apply(this, arguments);
    };
    
    
    var appLocalizationSource2 = abp.localization.getSource('LocalizationSource2');
    app.localize2 = function () {
        return appLocalizationSource2.apply(this, arguments);
    };