ValidateI18N.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System.Resources;
  2. namespace IPL.HRMS.Common.I18N
  3. {
  4. /// <summary>
  5. /// 数据验证消息国际化
  6. /// </summary>
  7. public class ValidateI18N
  8. {
  9. private static readonly ResourceManager _resourceManager = new ResourceManager(typeof(ValidateI18N));
  10. /// <summary>
  11. /// 必填
  12. /// </summary>
  13. public static string Required => GetString("Required");
  14. /// <summary>
  15. /// 最长
  16. /// </summary>
  17. public static string Max => GetString("Max");
  18. /// <summary>
  19. /// 最小
  20. /// </summary>
  21. public static string Min => GetString("Min");
  22. /// <summary>
  23. /// 电话号码
  24. /// </summary>
  25. public static string PhoneNumber => GetString("PhoneNumber");
  26. /// <summary>
  27. /// 邮箱
  28. /// </summary>
  29. public static string Email => GetString("Email");
  30. /// <summary>
  31. /// 日期格式
  32. /// </summary>
  33. public static string DateFormat => GetString("Unknown");
  34. /// <summary>
  35. /// 未知校验错误
  36. /// </summary>
  37. public static string Unknown => GetString("Unknown");
  38. /// <summary>
  39. /// 获取对应的I18N消息
  40. /// </summary>
  41. /// <param name="name"></param>
  42. /// <returns></returns>
  43. public static string GetString(string name)
  44. {
  45. return _resourceManager.GetString(name);
  46. }
  47. }
  48. }