From 447237426e69cf642820c435d6d03ffab2b2ea09 Mon Sep 17 00:00:00 2001 From: YinChang Date: Sun, 8 Dec 2019 17:43:23 +0800 Subject: [PATCH 1/6] modify several module's SettingDefinitionProvider to support multi-lingual --- .../Volo.Abp.Emailing.csproj | 10 ++++++ .../Volo/Abp/Emailing/AbpEmailingModule.cs | 10 ++++++ .../Volo/Abp/Emailing/EmailSettingProvider.cs | 24 ++++++++----- .../Emailing/Localization/EmailingResource.cs | 10 ++++++ .../Volo/Abp/Emailing/Localization/en.json | 23 ++++++++++++ .../Abp/Emailing/Localization/zh-Hans.json | 23 ++++++++++++ .../LocalizationSettingProvider.cs | 9 +++-- .../Resources/AbpValidation/en.json | 4 ++- .../Resources/AbpValidation/zh-Hans.json | 4 ++- .../Account/Localization/Resources/en.json | 6 +++- .../Localization/Resources/zh-Hans.json | 6 +++- .../AccountSettingDefinitionProvider.cs | 12 +++++-- .../Volo/Abp/Identity/Localization/en.json | 28 ++++++++++++++- .../Abp/Identity/Localization/zh-Hans.json | 29 ++++++++++++++- .../AbpIdentitySettingDefinitionProvider.cs | 35 +++++++++++-------- 15 files changed, 199 insertions(+), 34 deletions(-) create mode 100644 framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/EmailingResource.cs create mode 100644 framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/en.json create mode 100644 framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hans.json diff --git a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj index 5ed32e69616..51ba1544db1 100644 --- a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj +++ b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj @@ -18,6 +18,16 @@ + + + + + + + + + + diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs index 55ec63b9ac9..b8195ecf090 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.BackgroundJobs; +using Volo.Abp.Emailing.Localization; using Volo.Abp.Emailing.Templates; using Volo.Abp.Localization; using Volo.Abp.Modularity; @@ -30,6 +31,15 @@ public override void ConfigureServices(ServiceConfigurationContext context) options.FileSets.AddEmbedded(); }); + Configure(options => + { + options.Resources + .Add("en") + .AddBaseTypes( + typeof(EmailingResource) + ).AddVirtualJson("/Volo/Abp/Emailing/Localization"); + }); + Configure(options => { options.AddJob(); diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs index 32d1fb8c1ca..8e3ade25a91 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs @@ -1,3 +1,5 @@ +using Volo.Abp.Emailing.Localization; +using Volo.Abp.Localization; using Volo.Abp.Settings; namespace Volo.Abp.Emailing @@ -11,16 +13,20 @@ internal class EmailSettingProvider : SettingDefinitionProvider public override void Define(ISettingDefinitionContext context) { context.Add( - new SettingDefinition(EmailSettingNames.Smtp.Host, "127.0.0.1"), - new SettingDefinition(EmailSettingNames.Smtp.Port, "25"), - new SettingDefinition(EmailSettingNames.Smtp.UserName), - new SettingDefinition(EmailSettingNames.Smtp.Password, isEncrypted: true), - new SettingDefinition(EmailSettingNames.Smtp.Domain), - new SettingDefinition(EmailSettingNames.Smtp.EnableSsl, "false"), - new SettingDefinition(EmailSettingNames.Smtp.UseDefaultCredentials, "true"), - new SettingDefinition(EmailSettingNames.DefaultFromAddress, "noreply@abp.io"), - new SettingDefinition(EmailSettingNames.DefaultFromDisplayName, "ABP application") + 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, "noreply@abp.io", 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(name); + } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/EmailingResource.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/EmailingResource.cs new file mode 100644 index 00000000000..3560c0db26d --- /dev/null +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/EmailingResource.cs @@ -0,0 +1,10 @@ +using Volo.Abp.Localization; + +namespace Volo.Abp.Emailing.Localization +{ + [LocalizationResourceName("AbpEmailing")] + public class EmailingResource + { + + } +} diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/en.json b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/en.json new file mode 100644 index 00000000000..6fa4e626ff9 --- /dev/null +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/en.json @@ -0,0 +1,23 @@ +{ + "culture": "en", + "texts": { + "DisplayName:Abp.Mailing.DefaultFromAddress": "Default from address", + "DisplayName:Abp.Mailing.DefaultFromDisplayName": "Default from display name", + "DisplayName:Abp.Mailing.Smtp.Host": "Host", + "DisplayName:Abp.Mailing.Smtp.Port": "Port", + "DisplayName:Abp.Mailing.Smtp.UserName": "User name", + "DisplayName:Abp.Mailing.Smtp.Password": "Password", + "DisplayName:Abp.Mailing.Smtp.Domain": "Domain", + "DisplayName:Abp.Mailing.Smtp.EnableSsl": "Enable SSL", + "DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "Use default credentials", + "Description:Abp.Mailing.DefaultFromAddress": "The default from address", + "Description:Abp.Mailing.DefaultFromDisplayName": "The default from display name", + "Description:Abp.Mailing.Smtp.Host": "The name or IP address of the host used for SMTP transactions.", + "Description:Abp.Mailing.Smtp.Port": "The port used for SMTP transactions.", + "Description:Abp.Mailing.Smtp.UserName": "User name associated with the credentials.", + "Description:Abp.Mailing.Smtp.Password": "The password for the user name associated with the credentials.", + "Description:Abp.Mailing.Smtp.Domain": "The domain or computer name that verifies the credentials.", + "Description:Abp.Mailing.Smtp.EnableSsl": "Whether the SmtpClient uses Secure Sockets Layer (SSL) to encrypt the connection.", + "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "Whether the DefaultCredentials are sent with requests." + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hans.json b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hans.json new file mode 100644 index 00000000000..0e2d25bff16 --- /dev/null +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hans.json @@ -0,0 +1,23 @@ +{ + "culture": "zh-Hans", + "texts": { + "DisplayName:Abp.Mailing.DefaultFromAddress": "默认发件人地址", + "DisplayName:Abp.Mailing.DefaultFromDisplayName": "默认发件人名字", + "DisplayName:Abp.Mailing.Smtp.Host": "主机", + "DisplayName:Abp.Mailing.Smtp.Port": "端口", + "DisplayName:Abp.Mailing.Smtp.UserName": "用户名", + "DisplayName:Abp.Mailing.Smtp.Password": "密码", + "DisplayName:Abp.Mailing.Smtp.Domain": "域", + "DisplayName:Abp.Mailing.Smtp.EnableSsl": "启用SSL", + "DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "使用默认凭据", + "Description:Abp.Mailing.DefaultFromAddress": "默认的发件人地址.", + "Description:Abp.Mailing.DefaultFromDisplayName": "默认的发件人名字.", + "Description:Abp.Mailing.Smtp.Host": "SMTP 事务的主机名或主机 IP 地址.", + "Description:Abp.Mailing.Smtp.Port": "SMTP 事务的端口.", + "Description:Abp.Mailing.Smtp.UserName": "凭据关联的用户名.", + "Description:Abp.Mailing.Smtp.Password": "凭据关联的用户名的密码.", + "Description:Abp.Mailing.Smtp.Domain": "验证凭据的域名或计算机名.", + "Description:Abp.Mailing.Smtp.EnableSsl": "指定 SmtpClient 是否使用安全套接字层 (SSL) 加密连接.", + "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "控制默认凭据是否随请求一起发送." + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs index c7481565062..8b0ef510299 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs @@ -1,4 +1,5 @@ -using Volo.Abp.Settings; +using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Settings; namespace Volo.Abp.Localization { @@ -7,8 +8,12 @@ public class LocalizationSettingProvider : SettingDefinitionProvider public override void Define(ISettingDefinitionContext context) { context.Add( - new SettingDefinition(LocalizationSettingNames.DefaultLanguage, "en", isVisibleToClients: true) + new SettingDefinition(LocalizationSettingNames.DefaultLanguage, "en", L("DisplayName:Abp.Localization.DefaultLanguage"), L("Description:Abp.Localization.DefaultLanguage"), isVisibleToClients: true) ); } + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json index b6ff1bb26c9..417dfcd8c93 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json @@ -29,6 +29,8 @@ "ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "This field must be a string with a maximum length of {0}.", "ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "This field must be a string with a minimum length of {1} and a maximum length of {0}.", "ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "This field is not a valid fully-qualified http, https, or ftp URL.", - "ThisFieldIsInvalid.": "This field is invalid." + "ThisFieldIsInvalid.": "This field is invalid.", + "DisplayName:Abp.Localization.DefaultLanguage": "Default language", + "Description:Abp.Localization.DefaultLanguage": "The default language of the application." } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json index d56c893c384..3731d6d01e0 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json @@ -29,6 +29,8 @@ "ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "字段必须是长度为{0}的字符串.", "ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "字段必须是最小长度为{1}并且最大长度{*}的字符串.", "ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "字段{0}不是有效的完全限定的http,https或ftp URL.", - "ThisFieldIsInvalid.": "字段是无效值." + "ThisFieldIsInvalid.": "字段是无效值.", + "DisplayName:Abp.Localization.DefaultLanguage": "默认语言", + "Description:Abp.Localization.DefaultLanguage": "应用程序默认语言." } } \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json index bc507158b1e..1f8c0f2eca8 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json @@ -35,6 +35,10 @@ "PasswordChanged": "Password changed", "NewPasswordConfirmFailed": "Please confirm the new password.", "Manage": "Manage", - "ManageYourProfile": "Manage your profile" + "ManageYourProfile": "Manage your profile", + "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "Is self-registration enabled", + "Description:Abp.Account.IsSelfRegistrationEnabled": "Whether a user can register the account by him or herself.", + "DisplayName:Abp.Account.EnableLocalLogin": "Authenticate with a local account", + "Description:Abp.Account.EnableLocalLogin": "Indicates if Server will allow users to authenticate with a local account." } } \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json index 1db38474ae9..044041f026d 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json @@ -35,6 +35,10 @@ "PasswordChanged": "修改密码", "NewPasswordConfirmFailed": "请确认新密码", "Manage": "管理", - "ManageYourProfile": "管理你的个人资料" + "ManageYourProfile": "管理你的个人资料", + "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "启用自行注册", + "Description:Abp.Account.IsSelfRegistrationEnabled": "是否允许用户自行注册帐户.", + "DisplayName:Abp.Account.EnableLocalLogin": "使用本地帐户进行身份验证", + "Description:Abp.Account.EnableLocalLogin": "伺服器是否将允许用户使用本地帐户进行身份验证。" } } diff --git a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs b/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs index be16fa7045b..1a613704f7c 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs @@ -1,4 +1,6 @@ -using Volo.Abp.Settings; +using Volo.Abp.Account.Localization; +using Volo.Abp.Localization; +using Volo.Abp.Settings; namespace Volo.Abp.Account.Web.Settings { @@ -7,12 +9,16 @@ public class AccountSettingDefinitionProvider : SettingDefinitionProvider public override void Define(ISettingDefinitionContext context) { context.Add( - new SettingDefinition(AccountSettingNames.IsSelfRegistrationEnabled, "true") + new SettingDefinition(AccountSettingNames.IsSelfRegistrationEnabled, "true", L("DisplayName:Abp.Account.IsSelfRegistrationEnabled"), L("Description:Abp.Account.IsSelfRegistrationEnabled")) ); context.Add( - new SettingDefinition(AccountSettingNames.EnableLocalLogin, "true") + new SettingDefinition(AccountSettingNames.EnableLocalLogin, "true", L("DisplayName:Abp.Account.EnableLocalLogin"), L("Description:Abp.Account.EnableLocalLogin")) ); } + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json index 5b5927b9a14..e7a038fd57f 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json @@ -71,6 +71,32 @@ "Permission:Delete": "Delete", "Permission:ChangePermissions": "Change permissions", "Permission:UserManagement": "User management", - "Permission:UserLookup": "User lookup" + "Permission:UserLookup": "User lookup", + "DisplayName:Abp.Identity.Password.RequiredLength": "Required length", + "DisplayName:Abp.Identity.Password.RequiredUniqueChars": "Required unique characters number", + "DisplayName:Abp.Identity.Password.RequireNonAlphanumeric": "Required non-alphanumeric character", + "DisplayName:Abp.Identity.Password.RequireLowercase": "Required lower case character", + "DisplayName:Abp.Identity.Password.RequireUppercase": "Required upper case character", + "DisplayName:Abp.Identity.Password.RequireDigit": "Required digit", + "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Allowed for new users", + "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Lockout duration(seconds)", + "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Max failed access attempts", + "DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail": "Require confirmed email", + "DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "Require confirmed phoneNumber", + "DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled": "Is username update enabled", + "DisplayName:Abp.Identity.User.IsEmailUpdateEnabled": "Is email update enabled", + "Description:Abp.Identity.Password.RequiredLength": "The minimum length a password must be.", + "Description:Abp.Identity.Password.RequiredUniqueChars": "The minimum number of unique characters which a password must contain.", + "Description:Abp.Identity.Password.RequireNonAlphanumeric": "If passwords must contain a non-alphanumeric character.", + "Description:Abp.Identity.Password.RequireLowercase": "If passwords must contain a lower case ASCII character.", + "Description:Abp.Identity.Password.RequireUppercase": "If passwords must contain a upper case ASCII character.", + "Description:Abp.Identity.Password.RequireDigit": "If passwords must contain a digit.", + "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Whether a new user can be locked out.", + "Description:Abp.Identity.Lockout.LockoutDuration": "The duration a user is locked out for when a lockout occurs.", + "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "The number of failed access attempts allowed before a user is locked out, assuming lock out is enabled.", + "Description:Abp.Identity.SignIn.RequireConfirmedEmail": "Whether a confirmed email address is required to sign in.", + "Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "Whether a confirmed telephone number is required to sign in.", + "Description:Abp.Identity.User.IsUserNameUpdateEnabled": "Whether the username can be updated by the user.", + "Description:Abp.Identity.User.IsEmailUpdateEnabled": "Whether the email can be updated by the user." } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json index 28786b87674..f57029eb9ea 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json @@ -71,6 +71,33 @@ "Permission:Delete": "删除", "Permission:ChangePermissions": "更改权限", "Permission:UserManagement": "用户管理", - "Permission:UserLookup": "用户查询" + "Permission:UserLookup": "用户查询", + "DisplayName:Abp.Identity.Password.RequiredLength": "要求长度", + "DisplayName:Abp.Identity.Password.RequiredUniqueChars": "要求唯一字符数量", + "DisplayName:Abp.Identity.Password.RequireNonAlphanumeric": "要求非字母数字", + "DisplayName:Abp.Identity.Password.RequireLowercase": "要求小写字母", + "DisplayName:Abp.Identity.Password.RequireUppercase": "要求大写字母", + "DisplayName:Abp.Identity.Password.RequireDigit": "要求数字", + "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "允许新用户", + "DisplayName:Abp.Identity.Lockout.LockoutDuration": "锁定时间(秒)", + "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "最大失败访问尝试次数", + "DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail": "要求验证的电子邮箱", + "DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "要求验证的电话号码", + "DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled": "启用用户名更新", + "DisplayName:Abp.Identity.User.IsEmailUpdateEnabled": "启用电子邮箱更新", + "Description:Abp.Identity.Password.RequiredLength": "密码的最小长度.", + "Description:Abp.Identity.Password.RequiredUniqueChars": "密码必须包含唯一字符的数量.", + "Description:Abp.Identity.Password.RequireNonAlphanumeric": "密码是否必须包含非字母数字.", + "Description:Abp.Identity.Password.RequireLowercase": "密码是否必须包含小写字母.", + "Description:Abp.Identity.Password.RequireUppercase": "密码是否必须包含大写字母.", + "Description:Abp.Identity.Password.RequireDigit": "密码是否必须包含数字.", + "Description:Abp.Identity.Lockout.AllowedForNewUsers": "允许新用户被锁定.", + "Description:Abp.Identity.Lockout.LockoutDuration": "当锁定发生时用户被的锁定的时间(秒).", + "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "如果启用锁定, 当用户被锁定前失败的访问尝试次数.", + "Description:Abp.Identity.SignIn.RequireConfirmedEmail": "登录时是否需要验证的电子邮箱.", + "Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "登录时是否需要验证的电话号码.", + "Description:Abp.Identity.User.IsUserNameUpdateEnabled": "是否允许用户更新用户名.", + "Description:Abp.Identity.User.IsEmailUpdateEnabled": "是否允许用户更新电子邮箱." + } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs index 0edeacf8489..faf6c5b5dd3 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs @@ -1,4 +1,6 @@ -using Volo.Abp.Identity.Settings; +using Volo.Abp.Identity.Localization; +using Volo.Abp.Identity.Settings; +using Volo.Abp.Localization; using Volo.Abp.Settings; namespace Volo.Abp.Identity @@ -8,23 +10,28 @@ public class AbpIdentitySettingDefinitionProvider : SettingDefinitionProvider public override void Define(ISettingDefinitionContext context) { context.Add( - new SettingDefinition(IdentitySettingNames.Password.RequiredLength, 6.ToString(), null, null, true), - new SettingDefinition(IdentitySettingNames.Password.RequiredUniqueChars, 1.ToString(), null, null, true), - new SettingDefinition(IdentitySettingNames.Password.RequireNonAlphanumeric, true.ToString(), null, null, true), - new SettingDefinition(IdentitySettingNames.Password.RequireLowercase, true.ToString(), null, null, true), - new SettingDefinition(IdentitySettingNames.Password.RequireUppercase, true.ToString(), null, null, true), - new SettingDefinition(IdentitySettingNames.Password.RequireDigit, true.ToString(), null, null, true), + new SettingDefinition(IdentitySettingNames.Password.RequiredLength, 6.ToString(), L("DisplayName:Abp.Identity.Password.RequiredLength"), L("Description:Abp.Identity.Password.RequiredLength"), true), + new SettingDefinition(IdentitySettingNames.Password.RequiredUniqueChars, 1.ToString(), L("DisplayName:Abp.Identity.Password.RequiredUniqueChars"), L("Description:Abp.Identity.Password.RequiredUniqueChars"), true), + new SettingDefinition(IdentitySettingNames.Password.RequireNonAlphanumeric, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireNonAlphanumeric"), L("Description:Abp.Identity.Password.RequireNonAlphanumeric"), true), + new SettingDefinition(IdentitySettingNames.Password.RequireLowercase, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireLowercase"), L("Description:Abp.Identity.Password.RequireLowercase"), true), + new SettingDefinition(IdentitySettingNames.Password.RequireUppercase, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireUppercase"), L("Description:Abp.Identity.Password.RequireUppercase"), true), + new SettingDefinition(IdentitySettingNames.Password.RequireDigit, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireDigit"), L("Description:Abp.Identity.Password.RequireDigit"), true), - new SettingDefinition(IdentitySettingNames.Lockout.AllowedForNewUsers, true.ToString(), null, null, true), - new SettingDefinition(IdentitySettingNames.Lockout.LockoutDuration, (5*60).ToString(), null, null, true), - new SettingDefinition(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, 5.ToString(), null, null, true), + new SettingDefinition(IdentitySettingNames.Lockout.AllowedForNewUsers, true.ToString(), L("DisplayName:Abp.Identity.Lockout.AllowedForNewUsers"), L("Description:Abp.Identity.Lockout.AllowedForNewUsers"), true), + new SettingDefinition(IdentitySettingNames.Lockout.LockoutDuration, (5*60).ToString(), L("DisplayName:Abp.Identity.Lockout.LockoutDuration"), L("Description:Abp.Identity.Lockout.LockoutDuration"), true), + new SettingDefinition(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, 5.ToString(), L("DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts"), L("Description:Abp.Identity.Lockout.MaxFailedAccessAttempts"), true), - new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedEmail, false.ToString(), null, null, true), - new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, false.ToString(), null, null, true), + new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedEmail, false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail"), L("Description:Abp.Identity.SignIn.RequireConfirmedEmail"), true), + new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"), L("Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"), true), - new SettingDefinition(IdentitySettingNames.User.IsUserNameUpdateEnabled, true.ToString(), null, null, true), - new SettingDefinition(IdentitySettingNames.User.IsEmailUpdateEnabled, true.ToString(), null, null, true) + new SettingDefinition(IdentitySettingNames.User.IsUserNameUpdateEnabled, true.ToString(), L("DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled"), L("Description:Abp.Identity.User.IsUserNameUpdateEnabled"), true), + new SettingDefinition(IdentitySettingNames.User.IsEmailUpdateEnabled, true.ToString(), L("DisplayName:Abp.Identity.User.IsEmailUpdateEnabled"), L("Description:Abp.Identity.User.IsEmailUpdateEnabled"), true) ); } + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } + } } From 49a9eb0a0c2c52aa9739aab8aead9ddc0c835030 Mon Sep 17 00:00:00 2001 From: YinChang Date: Sat, 14 Dec 2019 08:33:48 +0800 Subject: [PATCH 2/6] configure embedded resources by wildcard --- framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj index 51ba1544db1..aad33abfbc7 100644 --- a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj +++ b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj @@ -19,13 +19,11 @@ - - + - - + From 9b502bd69afa7e7dcf67a3013de81a8eaaaadf62 Mon Sep 17 00:00:00 2001 From: YinChang Date: Mon, 16 Dec 2019 18:08:25 +0800 Subject: [PATCH 3/6] fix EmailingResource's Definition --- .../Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs index b8195ecf090..c2e29a7ff74 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AbpEmailingModule.cs @@ -35,9 +35,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) { options.Resources .Add("en") - .AddBaseTypes( - typeof(EmailingResource) - ).AddVirtualJson("/Volo/Abp/Emailing/Localization"); + .AddVirtualJson("/Volo/Abp/Emailing/Localization"); }); Configure(options => From 97353bf5f9217abb6f6eb85a6d3cbea2713dad10 Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 17 Dec 2019 17:41:54 +0800 Subject: [PATCH 4/6] Formatting code. --- .../Volo.Abp.Emailing.csproj | 3 - .../Volo/Abp/Emailing/EmailSettingProvider.cs | 60 ++++++++++-- .../LocalizationSettingProvider.cs | 7 +- .../AccountSettingDefinitionProvider.cs | 13 ++- .../AbpIdentitySettingDefinitionProvider.cs | 97 +++++++++++++++---- 5 files changed, 148 insertions(+), 32 deletions(-) diff --git a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj index aad33abfbc7..1bd548e6c2d 100644 --- a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj +++ b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj @@ -20,9 +20,6 @@ - - - diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs index 8e3ade25a91..0fb34027408 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs @@ -13,17 +13,59 @@ 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, "noreply@abp.io", 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")) + 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, + "noreply@abp.io", + 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(name); diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs index 8b0ef510299..14afe69dacb 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/LocalizationSettingProvider.cs @@ -8,9 +8,14 @@ public class LocalizationSettingProvider : SettingDefinitionProvider public override void Define(ISettingDefinitionContext context) { context.Add( - new SettingDefinition(LocalizationSettingNames.DefaultLanguage, "en", L("DisplayName:Abp.Localization.DefaultLanguage"), L("Description:Abp.Localization.DefaultLanguage"), isVisibleToClients: true) + new SettingDefinition(LocalizationSettingNames.DefaultLanguage, + "en", + L("DisplayName:Abp.Localization.DefaultLanguage"), + L("Description:Abp.Localization.DefaultLanguage"), + isVisibleToClients: true) ); } + private static LocalizableString L(string name) { return LocalizableString.Create(name); diff --git a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs b/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs index 1a613704f7c..53c2df6fbd7 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs @@ -9,13 +9,22 @@ public class AccountSettingDefinitionProvider : SettingDefinitionProvider public override void Define(ISettingDefinitionContext context) { context.Add( - new SettingDefinition(AccountSettingNames.IsSelfRegistrationEnabled, "true", L("DisplayName:Abp.Account.IsSelfRegistrationEnabled"), L("Description:Abp.Account.IsSelfRegistrationEnabled")) + new SettingDefinition( + AccountSettingNames.IsSelfRegistrationEnabled, + "true", + L("DisplayName:Abp.Account.IsSelfRegistrationEnabled"), + L("Description:Abp.Account.IsSelfRegistrationEnabled")) ); context.Add( - new SettingDefinition(AccountSettingNames.EnableLocalLogin, "true", L("DisplayName:Abp.Account.EnableLocalLogin"), L("Description:Abp.Account.EnableLocalLogin")) + new SettingDefinition( + AccountSettingNames.EnableLocalLogin, + "true", + L("DisplayName:Abp.Account.EnableLocalLogin"), + L("Description:Abp.Account.EnableLocalLogin")) ); } + private static LocalizableString L(string name) { return LocalizableString.Create(name); diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs index faf6c5b5dd3..efae6e467a6 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs @@ -10,28 +10,91 @@ public class AbpIdentitySettingDefinitionProvider : SettingDefinitionProvider public override void Define(ISettingDefinitionContext context) { context.Add( - new SettingDefinition(IdentitySettingNames.Password.RequiredLength, 6.ToString(), L("DisplayName:Abp.Identity.Password.RequiredLength"), L("Description:Abp.Identity.Password.RequiredLength"), true), - new SettingDefinition(IdentitySettingNames.Password.RequiredUniqueChars, 1.ToString(), L("DisplayName:Abp.Identity.Password.RequiredUniqueChars"), L("Description:Abp.Identity.Password.RequiredUniqueChars"), true), - new SettingDefinition(IdentitySettingNames.Password.RequireNonAlphanumeric, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireNonAlphanumeric"), L("Description:Abp.Identity.Password.RequireNonAlphanumeric"), true), - new SettingDefinition(IdentitySettingNames.Password.RequireLowercase, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireLowercase"), L("Description:Abp.Identity.Password.RequireLowercase"), true), - new SettingDefinition(IdentitySettingNames.Password.RequireUppercase, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireUppercase"), L("Description:Abp.Identity.Password.RequireUppercase"), true), - new SettingDefinition(IdentitySettingNames.Password.RequireDigit, true.ToString(), L("DisplayName:Abp.Identity.Password.RequireDigit"), L("Description:Abp.Identity.Password.RequireDigit"), true), - - new SettingDefinition(IdentitySettingNames.Lockout.AllowedForNewUsers, true.ToString(), L("DisplayName:Abp.Identity.Lockout.AllowedForNewUsers"), L("Description:Abp.Identity.Lockout.AllowedForNewUsers"), true), - new SettingDefinition(IdentitySettingNames.Lockout.LockoutDuration, (5*60).ToString(), L("DisplayName:Abp.Identity.Lockout.LockoutDuration"), L("Description:Abp.Identity.Lockout.LockoutDuration"), true), - new SettingDefinition(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, 5.ToString(), L("DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts"), L("Description:Abp.Identity.Lockout.MaxFailedAccessAttempts"), true), - - new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedEmail, false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail"), L("Description:Abp.Identity.SignIn.RequireConfirmedEmail"), true), - new SettingDefinition(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"), L("Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"), true), - - new SettingDefinition(IdentitySettingNames.User.IsUserNameUpdateEnabled, true.ToString(), L("DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled"), L("Description:Abp.Identity.User.IsUserNameUpdateEnabled"), true), - new SettingDefinition(IdentitySettingNames.User.IsEmailUpdateEnabled, true.ToString(), L("DisplayName:Abp.Identity.User.IsEmailUpdateEnabled"), L("Description:Abp.Identity.User.IsEmailUpdateEnabled"), true) + new SettingDefinition( + IdentitySettingNames.Password.RequiredLength, + 6.ToString(), + L("DisplayName:Abp.Identity.Password.RequiredLength"), + L("Description:Abp.Identity.Password.RequiredLength"), + true), + + new SettingDefinition( + IdentitySettingNames.Password.RequiredUniqueChars, + 1.ToString(), + L("DisplayName:Abp.Identity.Password.RequiredUniqueChars"), + L("Description:Abp.Identity.Password.RequiredUniqueChars"), + true), + + new SettingDefinition( + IdentitySettingNames.Password.RequireNonAlphanumeric, + true.ToString(), + L("DisplayName:Abp.Identity.Password.RequireNonAlphanumeric"), + L("Description:Abp.Identity.Password.RequireNonAlphanumeric"), + true), + + new SettingDefinition( + IdentitySettingNames.Password.RequireLowercase, + true.ToString(), L("DisplayName:Abp.Identity.Password.RequireLowercase"), + L("Description:Abp.Identity.Password.RequireLowercase"), + true), + + new SettingDefinition( + IdentitySettingNames.Password.RequireUppercase, + true.ToString(), L("DisplayName:Abp.Identity.Password.RequireUppercase"), + L("Description:Abp.Identity.Password.RequireUppercase"), + true), + + new SettingDefinition( + IdentitySettingNames.Password.RequireDigit, + true.ToString(), L("DisplayName:Abp.Identity.Password.RequireDigit"), + L("Description:Abp.Identity.Password.RequireDigit"), + true), + + new SettingDefinition( + IdentitySettingNames.Lockout.AllowedForNewUsers, + true.ToString(), L("DisplayName:Abp.Identity.Lockout.AllowedForNewUsers"), + L("Description:Abp.Identity.Lockout.AllowedForNewUsers"), + true), + + new SettingDefinition( + IdentitySettingNames.Lockout.LockoutDuration, + (5*60).ToString(), L("DisplayName:Abp.Identity.Lockout.LockoutDuration"), + L("Description:Abp.Identity.Lockout.LockoutDuration"), + true), + + new SettingDefinition( + IdentitySettingNames.Lockout.MaxFailedAccessAttempts, + 5.ToString(), L("DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts"), + L("Description:Abp.Identity.Lockout.MaxFailedAccessAttempts"), + true), + + new SettingDefinition( + IdentitySettingNames.SignIn.RequireConfirmedEmail, + false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail"), + L("Description:Abp.Identity.SignIn.RequireConfirmedEmail"), + true), + new SettingDefinition( + IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, + false.ToString(), L("DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"), + L("Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber"), + true), + + new SettingDefinition( + IdentitySettingNames.User.IsUserNameUpdateEnabled, + true.ToString(), L("DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled"), + L("Description:Abp.Identity.User.IsUserNameUpdateEnabled"), + true), + + new SettingDefinition( + IdentitySettingNames.User.IsEmailUpdateEnabled, + true.ToString(), L("DisplayName:Abp.Identity.User.IsEmailUpdateEnabled"), + L("Description:Abp.Identity.User.IsEmailUpdateEnabled"), + true) ); } + private static LocalizableString L(string name) { return LocalizableString.Create(name); } - } } From 87eb1891f5c1193f5b12c6d3ff2cc75d2c80fdc5 Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 17 Dec 2019 17:52:32 +0800 Subject: [PATCH 5/6] Change some simplified Chinese translations. --- .../Abp/Localization/Resources/AbpValidation/zh-Hans.json | 4 ++-- .../Volo/Abp/Account/Localization/Resources/zh-Hans.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json index 3731d6d01e0..5e535d5b67b 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json @@ -29,8 +29,8 @@ "ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "字段必须是长度为{0}的字符串.", "ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "字段必须是最小长度为{1}并且最大长度{*}的字符串.", "ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "字段{0}不是有效的完全限定的http,https或ftp URL.", - "ThisFieldIsInvalid.": "字段是无效值.", + "ThisFieldIsInvalid.": "该字段无效.", "DisplayName:Abp.Localization.DefaultLanguage": "默认语言", - "Description:Abp.Localization.DefaultLanguage": "应用程序默认语言." + "Description:Abp.Localization.DefaultLanguage": "应用程序的默认语言." } } \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json index 044041f026d..391dee05310 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json @@ -39,6 +39,6 @@ "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "启用自行注册", "Description:Abp.Account.IsSelfRegistrationEnabled": "是否允许用户自行注册帐户.", "DisplayName:Abp.Account.EnableLocalLogin": "使用本地帐户进行身份验证", - "Description:Abp.Account.EnableLocalLogin": "伺服器是否将允许用户使用本地帐户进行身份验证。" + "Description:Abp.Account.EnableLocalLogin": "服务器是否将允许用户使用本地帐户进行身份验证。" } } From 3ba06fe0227b86099f3aa718b5d3976bb0e4bbe0 Mon Sep 17 00:00:00 2001 From: YinChang Date: Sat, 21 Dec 2019 13:30:08 +0800 Subject: [PATCH 6/6] move AbpValidationResource to Volo.Abp.Validation from Volo.Abp.Localization --- .../Volo.Abp.Localization.csproj | 1 + .../Abp/Localization/AbpLocalizationModule.cs | 11 ++++++++-- .../AbpLocalizationResource.cs | 10 ++++++++++ .../Resources/AbpLocalization/en.json | 7 +++++++ .../Resources/AbpLocalization/zh-Hans.json | 7 +++++++ .../AbpValidation/AbpValidationResource.cs | 5 ++++- .../Volo.Abp.Validation.csproj | 8 +++++++- .../Abp/Validation/AbpValidationModule.cs | 20 +++++++++++++++++++ .../Localization/AbpValidationResource.cs | 10 ++++++++++ .../Volo/Abp/Validation/Localization}/cs.json | 0 .../Volo/Abp/Validation/Localization}/en.json | 4 +--- .../Volo/Abp/Validation/Localization}/es.json | 0 .../Volo/Abp/Validation/Localization}/pl.json | 0 .../Abp/Validation/Localization}/pt-BR.json | 0 .../Volo/Abp/Validation/Localization}/tr.json | 0 .../Volo/Abp/Validation/Localization}/vi.json | 0 .../Abp/Validation/Localization}/zh-Hans.json | 4 +--- 17 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs create mode 100644 framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/en.json create mode 100644 framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hans.json create mode 100644 framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/AbpValidationResource.cs rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/cs.json (100%) rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/en.json (93%) rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/es.json (100%) rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/pl.json (100%) rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/pt-BR.json (100%) rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/tr.json (100%) rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/vi.json (100%) rename framework/src/{Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation => Volo.Abp.Validation/Volo/Abp/Validation/Localization}/zh-Hans.json (93%) diff --git a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj index 65ceed101e5..3bc8eafb119 100644 --- a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj +++ b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj @@ -14,6 +14,7 @@ + diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs index 60df66feeca..175e3f9d124 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/AbpLocalizationModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Localization.Resources.AbpLocalization; +using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; using Volo.Abp.Settings; using Volo.Abp.VirtualFileSystem; @@ -27,10 +28,16 @@ public override void ConfigureServices(ServiceConfigurationContext context) .Resources .Add("en"); + //TODO: Obsolete, Remove in the future version options .Resources .Add("en") - .AddVirtualJson("/Localization/Resources/AbpValidation"); + .AddVirtualJson("/Volo/Abp/Validation/Localization");//load from Volo.Abp.Validation + + options + .Resources + .Add("en") + .AddVirtualJson("/Localization/Resources/AbpLocalization"); }); } } diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs new file mode 100644 index 00000000000..abfd1688b77 --- /dev/null +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/AbpLocalizationResource.cs @@ -0,0 +1,10 @@ +using System; + +namespace Volo.Abp.Localization.Resources.AbpLocalization +{ + [LocalizationResourceName("AbpLocalization")] + public class AbpLocalizationResource + { + + } +} diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/en.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/en.json new file mode 100644 index 00000000000..aee47a44b66 --- /dev/null +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/en.json @@ -0,0 +1,7 @@ +{ + "culture": "en", + "texts": { + "DisplayName:Abp.Localization.DefaultLanguage": "Default language", + "Description:Abp.Localization.DefaultLanguage": "The default language of the application." + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hans.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hans.json new file mode 100644 index 00000000000..7167aac9fd5 --- /dev/null +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hans.json @@ -0,0 +1,7 @@ +{ + "culture": "zh-Hans", + "texts": { + "DisplayName:Abp.Localization.DefaultLanguage": "默认语言", + "Description:Abp.Localization.DefaultLanguage": "应用程序的默认语言." + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/AbpValidationResource.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/AbpValidationResource.cs index 667244886c5..5d0151fe661 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/AbpValidationResource.cs +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/AbpValidationResource.cs @@ -1,8 +1,11 @@ -namespace Volo.Abp.Localization.Resources.AbpValidation +using System; + +namespace Volo.Abp.Localization.Resources.AbpValidation { //TODO: Move to Volo.Abp.Validation! [LocalizationResourceName("AbpValidation")] + [Obsolete("This resource is obsolete.Use Volo.Abp.Validation.Localization.AbpValidationResource instead.", false)] public class AbpValidationResource { diff --git a/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj b/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj index c8cc738e98f..9e1e81b1d9f 100644 --- a/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj +++ b/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj @@ -1,4 +1,4 @@ - + @@ -13,8 +13,14 @@ + + + + + + diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs index bb2d41f927c..ad2be911de4 100644 --- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs @@ -1,10 +1,16 @@ using System; using System.Collections.Generic; using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Localization; using Volo.Abp.Modularity; +using Volo.Abp.Validation.Localization; +using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.Validation { + [DependsOn( + typeof(AbpLocalizationModule) + )] public class AbpValidationModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -12,6 +18,20 @@ public override void PreConfigureServices(ServiceConfigurationContext context) context.Services.OnRegistred(ValidationInterceptorRegistrar.RegisterIfNeeded); AutoAddObjectValidationContributors(context.Services); } + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Add("en") + .AddVirtualJson("/Volo/Abp/Validation/Localization"); + }); + } private static void AutoAddObjectValidationContributors(IServiceCollection services) { diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/AbpValidationResource.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/AbpValidationResource.cs new file mode 100644 index 00000000000..0de105747d4 --- /dev/null +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/AbpValidationResource.cs @@ -0,0 +1,10 @@ +using Volo.Abp.Localization; + +namespace Volo.Abp.Validation.Localization +{ + [LocalizationResourceName("AbpValidation")] + public class AbpValidationResource + { + + } +} diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/cs.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/cs.json similarity index 100% rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/cs.json rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/cs.json diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json similarity index 93% rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json index 417dfcd8c93..b6ff1bb26c9 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json @@ -29,8 +29,6 @@ "ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "This field must be a string with a maximum length of {0}.", "ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "This field must be a string with a minimum length of {1} and a maximum length of {0}.", "ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "This field is not a valid fully-qualified http, https, or ftp URL.", - "ThisFieldIsInvalid.": "This field is invalid.", - "DisplayName:Abp.Localization.DefaultLanguage": "Default language", - "Description:Abp.Localization.DefaultLanguage": "The default language of the application." + "ThisFieldIsInvalid.": "This field is invalid." } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/es.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/es.json similarity index 100% rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/es.json rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/es.json diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pl.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pl.json similarity index 100% rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pl.json rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pl.json diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pt-BR.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pt-BR.json similarity index 100% rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/pt-BR.json rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/pt-BR.json diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/tr.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/tr.json similarity index 100% rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/tr.json rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/tr.json diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/vi.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/vi.json similarity index 100% rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/vi.json rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/vi.json diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json similarity index 93% rename from framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json index 5e535d5b67b..ac0c0149671 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/zh-Hans.json +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json @@ -29,8 +29,6 @@ "ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "字段必须是长度为{0}的字符串.", "ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "字段必须是最小长度为{1}并且最大长度{*}的字符串.", "ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "字段{0}不是有效的完全限定的http,https或ftp URL.", - "ThisFieldIsInvalid.": "该字段无效.", - "DisplayName:Abp.Localization.DefaultLanguage": "默认语言", - "Description:Abp.Localization.DefaultLanguage": "应用程序的默认语言." + "ThisFieldIsInvalid.": "该字段无效." } } \ No newline at end of file