index.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _index = _interopRequireDefault(require("../../../_lib/buildLocalizeFn/index.js"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. var eraValues = {
  9. narrow: ['av. J.-C', 'ap. J.-C'],
  10. abbreviated: ['av. J.-C', 'ap. J.-C'],
  11. wide: ['avant Jésus-Christ', 'après Jésus-Christ']
  12. };
  13. var quarterValues = {
  14. narrow: ['T1', 'T2', 'T3', 'T4'],
  15. abbreviated: ['1er trim.', '2ème trim.', '3ème trim.', '4ème trim.'],
  16. wide: ['1er trimestre', '2ème trimestre', '3ème trimestre', '4ème trimestre']
  17. };
  18. var monthValues = {
  19. narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
  20. abbreviated: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
  21. wide: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre']
  22. };
  23. var dayValues = {
  24. narrow: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],
  25. short: ['di', 'lu', 'ma', 'me', 'je', 've', 'sa'],
  26. abbreviated: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
  27. wide: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi']
  28. };
  29. var dayPeriodValues = {
  30. narrow: {
  31. am: 'AM',
  32. pm: 'PM',
  33. midnight: 'minuit',
  34. noon: 'midi',
  35. morning: 'mat.',
  36. afternoon: 'ap.m.',
  37. evening: 'soir',
  38. night: 'mat.'
  39. },
  40. abbreviated: {
  41. am: 'AM',
  42. pm: 'PM',
  43. midnight: 'minuit',
  44. noon: 'midi',
  45. morning: 'matin',
  46. afternoon: 'après-midi',
  47. evening: 'soir',
  48. night: 'matin'
  49. },
  50. wide: {
  51. am: 'AM',
  52. pm: 'PM',
  53. midnight: 'minuit',
  54. noon: 'midi',
  55. morning: 'du matin',
  56. afternoon: 'de l’après-midi',
  57. evening: 'du soir',
  58. night: 'du matin'
  59. }
  60. };
  61. function ordinalNumber(dirtyNumber, dirtyOptions) {
  62. var number = Number(dirtyNumber);
  63. var options = dirtyOptions || {};
  64. var unit = String(options.unit);
  65. var suffix;
  66. if (number === 0) {
  67. return number;
  68. }
  69. if (unit === 'year' || unit === 'hour' || unit === 'week') {
  70. if (number === 1) {
  71. suffix = 'ère';
  72. } else {
  73. suffix = 'ème';
  74. }
  75. } else {
  76. if (number === 1) {
  77. suffix = 'er';
  78. } else {
  79. suffix = 'ème';
  80. }
  81. }
  82. return number + suffix;
  83. }
  84. var localize = {
  85. ordinalNumber: ordinalNumber,
  86. era: (0, _index.default)({
  87. values: eraValues,
  88. defaultWidth: 'wide'
  89. }),
  90. quarter: (0, _index.default)({
  91. values: quarterValues,
  92. defaultWidth: 'wide',
  93. argumentCallback: function (quarter) {
  94. return Number(quarter) - 1;
  95. }
  96. }),
  97. month: (0, _index.default)({
  98. values: monthValues,
  99. defaultWidth: 'wide'
  100. }),
  101. day: (0, _index.default)({
  102. values: dayValues,
  103. defaultWidth: 'wide'
  104. }),
  105. dayPeriod: (0, _index.default)({
  106. values: dayPeriodValues,
  107. defaultWidth: 'wide'
  108. })
  109. };
  110. var _default = localize;
  111. exports.default = _default;
  112. module.exports = exports.default;