index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var formatDistanceLocale = {
  7. lessThanXSeconds: {
  8. one: 'أقل من ثانية واحدة',
  9. two: 'أقل من ثانتين',
  10. threeToTen: 'أقل من {{count}} ثواني',
  11. other: 'أقل من {{count}} ثانية'
  12. },
  13. xSeconds: {
  14. one: 'ثانية واحدة',
  15. two: 'ثانتين',
  16. threeToTen: '{{count}} ثواني',
  17. other: '{{count}} ثانية'
  18. },
  19. halfAMinute: 'نصف دقيقة',
  20. lessThanXMinutes: {
  21. one: 'أقل من دقيقة',
  22. two: 'أقل من دقيقتين',
  23. threeToTen: 'أقل من {{count}} دقائق',
  24. other: 'أقل من {{count}} دقيقة'
  25. },
  26. xMinutes: {
  27. one: 'دقيقة واحدة',
  28. two: 'دقيقتين',
  29. threeToTen: '{{count}} دقائق',
  30. other: '{{count}} دقيقة'
  31. },
  32. aboutXHours: {
  33. one: 'ساعة واحدة تقريباً',
  34. two: 'ساعتين تقريباً',
  35. threeToTen: '{{count}} ساعات تقريباً',
  36. other: '{{count}} ساعة تقريباً'
  37. },
  38. xHours: {
  39. one: 'ساعة واحدة',
  40. two: 'ساعتين',
  41. threeToTen: '{{count}} ساعات',
  42. other: '{{count}} ساعة'
  43. },
  44. xDays: {
  45. one: 'يوم واحد',
  46. two: 'يومين',
  47. threeToTen: '{{count}} أيام',
  48. other: '{{count}} يوم'
  49. },
  50. aboutXWeeks: {
  51. one: 'أسبوع واحد تقريباً',
  52. two: 'أسبوعين تقريباً',
  53. threeToTen: '{{count}} أسابيع تقريباً',
  54. other: '{{count}} أسبوع تقريباً'
  55. },
  56. xWeeks: {
  57. one: 'أسبوع واحد',
  58. two: 'أسبوعين',
  59. threeToTen: '{{count}} أسابيع',
  60. other: '{{count}} أسبوع'
  61. },
  62. aboutXMonths: {
  63. one: 'شهر واحد تقريباً',
  64. two: 'شهرين تقريباً',
  65. threeToTen: '{{count}} أشهر تقريباً',
  66. other: '{{count}} شهر تقريباً'
  67. },
  68. xMonths: {
  69. one: 'شهر واحد',
  70. two: 'شهرين',
  71. threeToTen: '{{count}} أشهر',
  72. other: '{{count}} شهر'
  73. },
  74. aboutXYears: {
  75. one: 'عام واحد تقريباً',
  76. two: 'عامين تقريباً',
  77. threeToTen: '{{count}} أعوام تقريباً',
  78. other: '{{count}} عام تقريباً'
  79. },
  80. xYears: {
  81. one: 'عام واحد',
  82. two: 'عامين',
  83. threeToTen: '{{count}} أعوام',
  84. other: '{{count}} عام'
  85. },
  86. overXYears: {
  87. one: 'أكثر من عام',
  88. two: 'أكثر من عامين',
  89. threeToTen: 'أكثر من {{count}} أعوام',
  90. other: 'أكثر من {{count}} عام'
  91. },
  92. almostXYears: {
  93. one: 'عام واحد تقريباً',
  94. two: 'عامين تقريباً',
  95. threeToTen: '{{count}} أعوام تقريباً',
  96. other: '{{count}} عام تقريباً'
  97. }
  98. };
  99. var formatDistance = function formatDistance(token, count, options) {
  100. options = options || {};
  101. var usageGroup = formatDistanceLocale[token];
  102. var result;
  103. if (typeof usageGroup === 'string') {
  104. result = usageGroup;
  105. } else if (count === 1) {
  106. result = usageGroup.one;
  107. } else if (count === 2) {
  108. result = usageGroup.two;
  109. } else if (count <= 10) {
  110. result = usageGroup.threeToTen.replace('{{count}}', String(count));
  111. } else {
  112. result = usageGroup.other.replace('{{count}}', String(count));
  113. }
  114. if (options.addSuffix) {
  115. if (options.comparison && options.comparison > 0) {
  116. return 'في خلال ' + result;
  117. } else {
  118. return 'منذ ' + result;
  119. }
  120. }
  121. return result;
  122. };
  123. var _default = formatDistance;
  124. exports.default = _default;
  125. module.exports = exports.default;