Browse Source

Seperate validations to AbpValidationResource.

pull/179/head
Halil İbrahim Kalkan 9 years ago
parent
commit
5d67d427ca
  1. 5
      src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs
  2. 2
      src/Volo.Abp.Identity.Web/Localization/Resource/en.json
  3. 2
      src/Volo.Abp.Identity.Web/Localization/Resource/tr.json
  4. 13
      src/Volo.Abp/Volo.Abp.csproj
  5. 6
      src/Volo.Abp/Volo/Abp/AbpKernelModule.cs
  6. 8
      src/Volo.Abp/Volo/Abp/Localization/Resources/Validation/IdentityResource.cs
  7. 7
      src/Volo.Abp/Volo/Abp/Localization/Resources/Validation/en.json
  8. 7
      src/Volo.Abp/Volo/Abp/Localization/Resources/Validation/tr.json
  9. 3
      test/Volo.Abp.Tests/Volo/Abp/Localization/AbpLocalization_Tests.cs

5
src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs

@ -6,6 +6,7 @@ using Volo.Abp.Identity.Web.Localization.Resource;
using Volo.Abp.Identity.Web.Navigation;
using Volo.Abp.Identity.Web.ObjectMappings;
using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.Validation;
using Volo.Abp.Modularity;
using Volo.Abp.Ui.Navigation;
using Volo.Abp.VirtualFileSystem;
@ -41,7 +42,9 @@ namespace Volo.Abp.Identity.Web
services.Configure<AbpLocalizationOptions>(options =>
{
options.Resources.AddJson<IdentityResource>("en");
//TODO: Declare base type by attribute
options.Resources.AddJson<IdentityResource>("en")
.InheritFrom(typeof(AbpValidationResource));
});
services.Configure<AbpAutoMapperOptions>(options =>

2
src/Volo.Abp.Identity.Web/Localization/Resource/en.json

@ -15,8 +15,6 @@
"Save": "Save",
"Password": "Password",
"UserDeletionConfirmationMessage": "User '{0}' will be deleted. Do you confirm that?",
"MaxLengthKey": "The field {0} must be a string or array type with a maximum length of '{1}'.",
"The {0} field is required.": "The {0} field is required.",
"TwoFactorVerification": "Two factor verification",
"AccountLockoutOnFailedLoginAttempts": "Locking account after failed login attempts"
}

2
src/Volo.Abp.Identity.Web/Localization/Resource/tr.json

@ -15,8 +15,6 @@
"Save": "Kaydet",
"Password": "Şifre",
"UserDeletionConfirmationMessage": "{0} kullanıcısı silinecektir. Onaylıyor musunuz?",
"The field {0} must be a string or array type with a maximum length of '{1}'.": "{0} alanı en fazla '{1}' karakter uzunluğunda olmalıdır.",
"The {0} field is required.": "{0} alanı zorunludur.",
"TwoFactorVerification": "İki aşamalı doğrumala",
"AccountLockoutOnFailedLoginAttempts": "Başarısız giriş denemeleri sonrası hesabı kilitleme"
}

13
src/Volo.Abp/Volo.Abp.csproj

@ -13,6 +13,19 @@
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Volo\Abp\Localization\Resources\**\*.json" />
</ItemGroup>
<ItemGroup>
<Content Include="Volo\Abp\Localization\Resources\Validation\en.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="Volo\Abp\Localization\Resources\Validation\tr.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="2.0.0" />

6
src/Volo.Abp/Volo/Abp/AbpKernelModule.cs

@ -2,6 +2,7 @@
using Volo.Abp.ApiVersioning;
using Volo.Abp.Data;
using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.Validation;
using Volo.Abp.Modularity;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Reflection;
@ -52,6 +53,11 @@ namespace Volo.Abp
options.Contributers.Add<OnPostApplicationInitializationModuleLifecycleContributer>();
options.Contributers.Add<OnApplicationShutdownModuleLifecycleContributer>();
});
services.Configure<AbpLocalizationOptions>(options =>
{
options.Resources.AddJson<AbpValidationResource>("en");
});
}
}
}

8
src/Volo.Abp/Volo/Abp/Localization/Resources/Validation/IdentityResource.cs

@ -0,0 +1,8 @@
namespace Volo.Abp.Localization.Resources.Validation
{
[ShortLocalizationResourceName("AbpValidation")]
public class AbpValidationResource
{
}
}

7
src/Volo.Abp/Volo/Abp/Localization/Resources/Validation/en.json

@ -0,0 +1,7 @@
{
"culture": "en",
"texts": {
"The field {0} must be a string or array type with a maximum length of '{1}'.": "The field {0} must be a string or array type with a maximum length of '{1}'.",
"The {0} field is required.": "The {0} field is required."
}
}

7
src/Volo.Abp/Volo/Abp/Localization/Resources/Validation/tr.json

@ -0,0 +1,7 @@
{
"culture": "tr",
"texts": {
"The field {0} must be a string or array type with a maximum length of '{1}'.": "{0} alanı en fazla '{1}' karakter uzunluğunda olmalıdır.",
"The {0} field is required.": "{0} alanı zorunludur."
}
}

3
test/Volo.Abp.Tests/Volo/Abp/Localization/AbpLocalization_Tests.cs

@ -112,7 +112,8 @@ namespace Volo.Abp.Localization
{
options.Resources.AddJson<LocalizationTestValidationResource>("en");
options.Resources.AddJson<LocalizationTestCountryNamesResource>("en");
//TODO: Declare base type by attribute
options.Resources.AddJson<LocalizationTestResource>("en")
.InheritFrom(
typeof(LocalizationTestValidationResource),

Loading…
Cancel
Save