alpha.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. export var alpha = {
  2. 'en-US': /^[A-Z]+$/i,
  3. 'az-AZ': /^[A-VXYZÇƏĞİıÖŞÜ]+$/i,
  4. 'bg-BG': /^[А-Я]+$/i,
  5. 'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
  6. 'da-DK': /^[A-ZÆØÅ]+$/i,
  7. 'de-DE': /^[A-ZÄÖÜß]+$/i,
  8. 'el-GR': /^[Α-ώ]+$/i,
  9. 'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i,
  10. 'fa-IR': /^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i,
  11. 'fi-FI': /^[A-ZÅÄÖ]+$/i,
  12. 'fr-FR': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
  13. 'it-IT': /^[A-ZÀÉÈÌÎÓÒÙ]+$/i,
  14. 'nb-NO': /^[A-ZÆØÅ]+$/i,
  15. 'nl-NL': /^[A-ZÁÉËÏÓÖÜÚ]+$/i,
  16. 'nn-NO': /^[A-ZÆØÅ]+$/i,
  17. 'hu-HU': /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
  18. 'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
  19. 'pt-PT': /^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
  20. 'ru-RU': /^[А-ЯЁ]+$/i,
  21. 'sl-SI': /^[A-ZČĆĐŠŽ]+$/i,
  22. 'sk-SK': /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
  23. 'sr-RS@latin': /^[A-ZČĆŽŠĐ]+$/i,
  24. 'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i,
  25. 'sv-SE': /^[A-ZÅÄÖ]+$/i,
  26. 'th-TH': /^[ก-๐\s]+$/i,
  27. 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i,
  28. 'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i,
  29. 'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
  30. 'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
  31. ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
  32. he: /^[א-ת]+$/,
  33. fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i,
  34. 'hi-IN': /^[\u0900-\u0961]+[\u0972-\u097F]*$/i
  35. };
  36. export var alphanumeric = {
  37. 'en-US': /^[0-9A-Z]+$/i,
  38. 'az-AZ': /^[0-9A-VXYZÇƏĞİıÖŞÜ]+$/i,
  39. 'bg-BG': /^[0-9А-Я]+$/i,
  40. 'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
  41. 'da-DK': /^[0-9A-ZÆØÅ]+$/i,
  42. 'de-DE': /^[0-9A-ZÄÖÜß]+$/i,
  43. 'el-GR': /^[0-9Α-ω]+$/i,
  44. 'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,
  45. 'fi-FI': /^[0-9A-ZÅÄÖ]+$/i,
  46. 'fr-FR': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
  47. 'it-IT': /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,
  48. 'hu-HU': /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
  49. 'nb-NO': /^[0-9A-ZÆØÅ]+$/i,
  50. 'nl-NL': /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,
  51. 'nn-NO': /^[0-9A-ZÆØÅ]+$/i,
  52. 'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
  53. 'pt-PT': /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
  54. 'ru-RU': /^[0-9А-ЯЁ]+$/i,
  55. 'sl-SI': /^[0-9A-ZČĆĐŠŽ]+$/i,
  56. 'sk-SK': /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
  57. 'sr-RS@latin': /^[0-9A-ZČĆŽŠĐ]+$/i,
  58. 'sr-RS': /^[0-9А-ЯЂЈЉЊЋЏ]+$/i,
  59. 'sv-SE': /^[0-9A-ZÅÄÖ]+$/i,
  60. 'th-TH': /^[ก-๙\s]+$/i,
  61. 'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
  62. 'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
  63. 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
  64. 'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
  65. ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
  66. he: /^[0-9א-ת]+$/,
  67. fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i,
  68. 'hi-IN': /^[\u0900-\u0963]+[\u0966-\u097F]*$/i
  69. };
  70. export var decimal = {
  71. 'en-US': '.',
  72. ar: '٫'
  73. };
  74. export var englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];
  75. for (var locale, i = 0; i < englishLocales.length; i++) {
  76. locale = "en-".concat(englishLocales[i]);
  77. alpha[locale] = alpha['en-US'];
  78. alphanumeric[locale] = alphanumeric['en-US'];
  79. decimal[locale] = decimal['en-US'];
  80. } // Source: http://www.localeplanet.com/java/
  81. export var arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE'];
  82. for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
  83. _locale = "ar-".concat(arabicLocales[_i]);
  84. alpha[_locale] = alpha.ar;
  85. alphanumeric[_locale] = alphanumeric.ar;
  86. decimal[_locale] = decimal.ar;
  87. }
  88. export var farsiLocales = ['IR', 'AF'];
  89. for (var _locale2, _i2 = 0; _i2 < farsiLocales.length; _i2++) {
  90. _locale2 = "fa-".concat(farsiLocales[_i2]);
  91. alphanumeric[_locale2] = alphanumeric.fa;
  92. decimal[_locale2] = decimal.ar;
  93. } // Source: https://en.wikipedia.org/wiki/Decimal_mark
  94. export var dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY'];
  95. export var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-CA', 'fr-FR', 'id-ID', 'it-IT', 'ku-IQ', 'hi-IN', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];
  96. for (var _i3 = 0; _i3 < dotDecimal.length; _i3++) {
  97. decimal[dotDecimal[_i3]] = decimal['en-US'];
  98. }
  99. for (var _i4 = 0; _i4 < commaDecimal.length; _i4++) {
  100. decimal[commaDecimal[_i4]] = ',';
  101. }
  102. alpha['fr-CA'] = alpha['fr-FR'];
  103. alphanumeric['fr-CA'] = alphanumeric['fr-FR'];
  104. alpha['pt-BR'] = alpha['pt-PT'];
  105. alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
  106. decimal['pt-BR'] = decimal['pt-PT']; // see #862
  107. alpha['pl-Pl'] = alpha['pl-PL'];
  108. alphanumeric['pl-Pl'] = alphanumeric['pl-PL'];
  109. decimal['pl-Pl'] = decimal['pl-PL']; // see #1455
  110. alpha['fa-AF'] = alpha.fa;