-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modify several module's SettingDefinitionProvider to support multi-lingual #2392
Conversation
Thank you for your great contribution. @maliming you can merge it after reviewing, then create an |
@hikalkan |
@yinchang0626 You can continue to commit new code on this branch without reopening pr. |
@hikalkan @maliming namespace Volo.Abp.Localization.Resources.AbpValidation
{
//TODO: Move to Volo.Abp.Validation!
[LocalizationResourceName("AbpValidation")]
public class AbpValidationResource
{
}
} and let [DependsOn(
typeof(AbpLocalizationModule)
)]
public class AbpValidationModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpValidationModule>();
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<AbpValidationResource>("en")
.AddVirtualJson("/Volo/Abp/Validation/Localization/Resource");
});
...... but after moved,will cause breaking change,because of all other modules and template(app,module) is depend Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<IdentityResource>("en")
.AddBaseTypes(
typeof(AbpValidationResource)
).AddVirtualJson("/Volo/Abp/Identity/Localization");
}); so exised module need to modify to |
options.Resources | ||
.Add<EmailingResource>("en") | ||
.AddBaseTypes( | ||
typeof(EmailingResource) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does EmailingResource inherit EmailingResource(AddBaseTypes
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinks,I fixed it
How about defining setting localization resources in just one resource, (e.g., "SettingResource")? |
@wakuflair |
No need to modify, the future module could inherit "SettingResource", or just add its own resources by using the |
@wakuflair internal class EmailSettingProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
context.Add(
new SettingDefinition(EmailSettingNames.Smtp.Host, "127.0.0.1", L("DisplayName:Abp.Mailing.Smtp.Host"), L("Description:Abp.Mailing.Smtp.Host")),
new SettingDefinition(EmailSettingNames.Smtp.Port, "25", L("DisplayName:Abp.Mailing.Smtp.Port"), L("Description:Abp.Mailing.Smtp.Port")),
new SettingDefinition(EmailSettingNames.Smtp.UserName, displayName: L("DisplayName:Abp.Mailing.Smtp.UserName"), description: L("Description:Abp.Mailing.Smtp.UserName")),
new SettingDefinition(EmailSettingNames.Smtp.Password, displayName: L("DisplayName:Abp.Mailing.Smtp.Password"), description: L("Description:Abp.Mailing.Smtp.Password"), isEncrypted: true),
new SettingDefinition(EmailSettingNames.Smtp.Domain, displayName: L("DisplayName:Abp.Mailing.Smtp.Domain"), description: L("Description:Abp.Mailing.Smtp.Domain")),
new SettingDefinition(EmailSettingNames.Smtp.EnableSsl, "false", L("DisplayName:Abp.Mailing.Smtp.EnableSsl"), L("Description:Abp.Mailing.Smtp.EnableSsl")),
new SettingDefinition(EmailSettingNames.Smtp.UseDefaultCredentials, "true", L("DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials"), L("Description:Abp.Mailing.Smtp.UseDefaultCredentials")),
new SettingDefinition(EmailSettingNames.DefaultFromAddress, "[email protected]", L("DisplayName:Abp.Mailing.DefaultFromAddress"), L("Description:Abp.Mailing.DefaultFromAddress")),
new SettingDefinition(EmailSettingNames.DefaultFromDisplayName, "ABP application", L("DisplayName:Abp.Mailing.DefaultFromDisplayName"), L("Description:Abp.Mailing.DefaultFromDisplayName"))
);
}
private static LocalizableString L(string name)
{
return LocalizableString.Create<EmailingResource>(name);
}
} and then |
Yeah I prefer using
I can't see the |
@wakuflair namespace Volo.Abp.Localization.Resources.AbpValidation
{
//TODO: Move to Volo.Abp.Validation!
[LocalizationResourceName("AbpValidation")]
public class AbpValidationResource
{
}
} but I think after moved ,will cause breaking change |
@hikalkan |
configure embedded resources by wildcard and rebase from latest dev branch
@maliming please help to add to Milestone 1.2
#2332