You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
3.1 KiB

  1. # Custom Locale Data
  2. This folder is used to store custom locale data. These custom locale data are
  3. not yet provided by [Unicode Common Locale Data Repository](http://cldr.unicode.org/development/new-cldr-developers)
  4. and hence not provided in [react-intl/locale-data/*](https://github.com/yahoo/react-intl).
  5. The locale data should support [Locale Data APIs](https://github.com/yahoo/react-intl/wiki/API#locale-data-apis)
  6. of the react-intl library.
  7. It is recommended to start your custom locale data from this sample English
  8. locale data:
  9. ```javascript
  10. /*eslint eqeqeq: "off"*/
  11. /*eslint no-nested-ternary: "off"*/
  12. export default [
  13. {
  14. locale: "en",
  15. pluralRuleFunction: function(e, a) {
  16. var n = String(e).split("."),
  17. l = !n[1],
  18. o = Number(n[0]) == e,
  19. t = o && n[0].slice(-1),
  20. r = o && n[0].slice(-2);
  21. return a ? 1 == t && 11 != r ? "one" : 2 == t && 12 != r ? "two" : 3 == t && 13 != r ? "few" : "other" : 1 == e && l ? "one" : "other"
  22. },
  23. fields: {
  24. year: {
  25. displayName: "year",
  26. relative: {
  27. 0: "this year",
  28. 1: "next year",
  29. "-1": "last year"
  30. },
  31. relativeTime: {
  32. future: {
  33. one: "in {0} year",
  34. other: "in {0} years"
  35. },
  36. past: {
  37. one: "{0} year ago",
  38. other: "{0} years ago"
  39. }
  40. }
  41. },
  42. month: {
  43. displayName: "month",
  44. relative: {
  45. 0: "this month",
  46. 1: "next month",
  47. "-1": "last month"
  48. },
  49. relativeTime: {
  50. future: {
  51. one: "in {0} month",
  52. other: "in {0} months"
  53. },
  54. past: {
  55. one: "{0} month ago",
  56. other: "{0} months ago"
  57. }
  58. }
  59. },
  60. day: {
  61. displayName: "day",
  62. relative: {
  63. 0: "today",
  64. 1: "tomorrow",
  65. "-1": "yesterday"
  66. },
  67. relativeTime: {
  68. future: {
  69. one: "in {0} day",
  70. other: "in {0} days"
  71. },
  72. past: {
  73. one: "{0} day ago",
  74. other: "{0} days ago"
  75. }
  76. }
  77. },
  78. hour: {
  79. displayName: "hour",
  80. relativeTime: {
  81. future: {
  82. one: "in {0} hour",
  83. other: "in {0} hours"
  84. },
  85. past: {
  86. one: "{0} hour ago",
  87. other: "{0} hours ago"
  88. }
  89. }
  90. },
  91. minute: {
  92. displayName: "minute",
  93. relativeTime: {
  94. future: {
  95. one: "in {0} minute",
  96. other: "in {0} minutes"
  97. },
  98. past: {
  99. one: "{0} minute ago",
  100. other: "{0} minutes ago"
  101. }
  102. }
  103. },
  104. second: {
  105. displayName: "second",
  106. relative: {
  107. 0: "now"
  108. },
  109. relativeTime: {
  110. future: {
  111. one: "in {0} second",
  112. other: "in {0} seconds"
  113. },
  114. past: {
  115. one: "{0} second ago",
  116. other: "{0} seconds ago"
  117. }
  118. }
  119. }
  120. }
  121. }
  122. ]
  123. ```