GlobalizationHelper.cs 571 B

1234567891011121314151617181920212223242526
  1. using System.Globalization;
  2. using Abp.Extensions;
  3. namespace Abp.Localization
  4. {
  5. internal static class GlobalizationHelper
  6. {
  7. public static bool IsValidCultureCode(string cultureCode)
  8. {
  9. if (cultureCode.IsNullOrWhiteSpace())
  10. {
  11. return false;
  12. }
  13. try
  14. {
  15. CultureInfo.GetCultureInfo(cultureCode);
  16. return true;
  17. }
  18. catch (CultureNotFoundException)
  19. {
  20. return false;
  21. }
  22. }
  23. }
  24. }