1.I has enable PlugInSources:
return services.AddAbp<AdminWebMvcModule>(options =>
{
var plusPath = Path.Combine(_hostingEnvironment.WebRootPath, "PlugIns");
if (!Directory.Exists(plusPath))
Directory.CreateDirectory(plusPath);
options.PlugInSources.AddFolder(plusPath);
});
2.I write a RazorPageBase.cs :
public abstract class RazorPageBase<TModel> : AbpRazorPage<TModel>
{
protected RazorPageBase()
{
LocalizationSourceName = DemoConsts.LocalizationSourceName;
}
}
3.And add _ViewImports.cshtml:
@using Abp.Localization
@inherits Magicodes.UI.Demo.Views.RazorPageBase<TModel>
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4.When I use L method(E.g @L("UICollorCollection")) in view,I will get exception:
An unhandled exception occurred while processing the request.
FileNotFoundException: 未能加载文件或程序集“Magicodes.UI.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”或它的某一个依赖项。系统找不到指定的文件。
System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
9 Answer(s)
-
0
Hi,
Your code seems correct to me. Let me try the same scenario and get back to you.
Thanks.
-
0
<cite>ismcagdas: </cite> Hi,
Your code seems correct to me. Let me try the same scenario and get back to you.
Thanks.
I use .NET Core. Thanks!
-
0
Hi,
I couldn't repeat the problem, can you send your project to <a href="mailto:[email protected]">[email protected]</a> ?
Thanks.
-
0
I upgraded the project,I'll try again later.
-
0
Ok, please let us know if it does not work.
Thanks.
-
0
Now,no exception,but L function not work.I use this code in view:
<p> @L("Test") <br /> @(LocalizationHelper.GetString(TestDemoConsts.LocalizationSourceName, "Test")) </p>
It's not work.it print "[Test] ". And the xml content is:
<?xml version="1.0" encoding="utf-8"?> <localizationDictionary culture="en"> <texts> <text name="Test" value="Test Test Test" /> </texts> </localizationDictionary>
I has config "TestLocalizationConfigurer":
namespace TestDemo.Localization { public class TestLocalizationConfigurer { public static void Configure(ILocalizationConfiguration localizationConfiguration) { localizationConfiguration.Sources.Add( new DictionaryBasedLocalizationSource( TestDemoConsts.LocalizationSourceName, new XmlEmbeddedFileLocalizationDictionaryProvider( Assembly.GetExecutingAssembly(), "TestDemo.Localization" ) ) ); } } }
And write in AbpModule:
public override void Initialize() { //设置语言资源 TestLocalizationConfigurer.Configure(Configuration.Localization); IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); }
-
0
Hi,
Does your main module depends on your Test module ?
-
0
-
0
Hi,
I think it should be reverse, AdminWebMvcModule should depend on TestModule.