Hi I have created an extra xml file for localisation. This was done to help me when updating aspnetzero to latest version to avoid losing changes to MyProject.xml language file.
I named this MyProjectExtended.xml
However I dont know how the aspnetzero will read this.
How can it be done?
Thanks in advance
8 Answer(s)
-
0
Are you talking about Extending Localization Sources? https://aspnetboilerplate.com/Pages/Documents/Localization#extending-localization-sources
-
0
I followed the instructions there but they are not very clear and I can't make it work
namespace MyProject.Core.Extended { public class MyProjectCoreExtendedModule : AbpModule { public override void PreInitialize() { Configuration.Localization.Sources.Extensions.Add( new LocalizationSourceExtensionInfo(MyProjectConsts.LocalizationSourceName, new XmlEmbeddedFileLocalizationDictionaryProvider(Assembly.GetExecutingAssembly(), "MyProject.Core.Extended.Localization.MyProject" ) ) ); } public override void Initialize() { IocManager.RegisterAssemblyByConvention(typeof(MyProjectCoreExtendedModule).GetAssembly()); } } }
-
0
Hi, is your xml under
MyProject.Core.Extended.Localization.MyProject
having the same name asMyProjectConsts.LocalizationSourceName
?The xml filename has to be the same as
MyProjectConsts.LocalizationSourceName
for the extension to work. -
0
Yes it is the same.
-
0
please share the value of
MyProjectConsts.LocalizationSourceName
and the screenshot of the structure ofMyProject.Core.Extended.Localization.MyProject
in visual studio -
0
-
0
have you added the xml as embedded resource?
in your
MyProject.Core.Extended.csproj
<ItemGroup> <EmbeddedResource Include="Localization\MyProject\*.xml" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup>
also, you should add module dependency on your
MyProjectCoreExtendedModule
[DependsOn(typeof(MyProjectCoreModule))] public class MyProjectCoreExtendedModule : AbpModule { }
-
0
@ryancyq Thanks the EmbeddedResource did the trick.