Embedded localizations extensions not working in late versions of Abp
See original GitHub issueHi,
I’m having some issues in adding localization extensions when they are embedded. I’ve tested this in the following versions: 2.3.0, 3.7.2 and 3.8.3. It is only working in 2.3.0. In 3.7.2 and 3.8.3 the Middle localizations extension is not being added, but the Top and Bottom localizations are added.
Current Abp-versions for the assemblies: Top (2.3.0) Middle (2.3.0) Bottom (3.7.2)
However, I’ve also tested updating the Top and Middle to the same version as Bottom, but that didn’t work either. But when I downgraded the Bottom to version 2.3.0, it works.
The localization json files in Top and Middle are in the respective folders “Localization/Top” and “Localization/Middle” in their project where all of the json files have the build action “Embedded Resource”.
This is the code used to add the localization sources/extensions for the Bottom module:
public override void PreInitialize()
{
var topAssembly = System.Web.Compilation.BuildManager.GetReferencedAssemblies()
.Cast<Assembly>()
.FirstOrDefault(a => a.GetName().Name.Equals("TopAssembly"));
var middleAssembly = System.Web.Compilation.BuildManager.GetReferencedAssemblies()
.Cast<Assembly>()
.FirstOrDefault(a => a.GetName().Name.Equals("MiddleAssembly"));
Configuration.Localization.Sources.Add(
new DictionaryBasedLocalizationSource(
"Top",
new JsonEmbeddedFileLocalizationDictionaryProvider(
topAssembly,
$"{topAssembly.GetName().Name}.Localization.Top"
)
)
);
Configuration.Localization.Sources.Extensions.Add(
new Abp.Localization.Sources.LocalizationSourceExtensionInfo(
"Top",
new JsonEmbeddedFileLocalizationDictionaryProvider(
middleAssembly,
$"{middleAssembly.GetName().Name}.Localization.Middle"
)
)
);
Configuration.Localization.Sources.Extensions.Add(
new Abp.Localization.Sources.LocalizationSourceExtensionInfo(
"Top",
new JsonFileLocalizationDictionaryProvider(
HttpContext.Current.Server.MapPath("~/Localization/Bottom")
)
)
);
}
Is the way of adding embedded extensions changed in newer versions? I read the newest documentation and this seems like the correct way of doing it.
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (8 by maintainers)
Top GitHub Comments
@thomkle of course we can add optional parameter to specific localization file name. However, i don’t see much benefits from doing this.
By providing optional localization file name, we are
Currently localization source A in one project can only be extended by localization source A in another project Localization files used for localization source A in both projects must be named as A
Sorry, I just saw it, I will check it out.