tr.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // numeral.js locale configuration
  2. // locale : turkish (tr)
  3. // author : Ecmel Ercan : https://github.com/ecmel, Erhan Gundogan : https://github.com/erhangundogan, Burak Yiğit Kaya: https://github.com/BYK
  4. (function (global, factory) {
  5. if (typeof define === 'function' && define.amd) {
  6. define(['../numeral'], factory);
  7. } else if (typeof module === 'object' && module.exports) {
  8. factory(require('../numeral'));
  9. } else {
  10. factory(global.numeral);
  11. }
  12. }(this, function (numeral) {
  13. var suffixes = {
  14. 1: '\'inci',
  15. 5: '\'inci',
  16. 8: '\'inci',
  17. 70: '\'inci',
  18. 80: '\'inci',
  19. 2: '\'nci',
  20. 7: '\'nci',
  21. 20: '\'nci',
  22. 50: '\'nci',
  23. 3: '\'üncü',
  24. 4: '\'üncü',
  25. 100: '\'üncü',
  26. 6: '\'ncı',
  27. 9: '\'uncu',
  28. 10: '\'uncu',
  29. 30: '\'uncu',
  30. 60: '\'ıncı',
  31. 90: '\'ıncı'
  32. };
  33. numeral.register('locale', 'tr', {
  34. delimiters: {
  35. thousands: '.',
  36. decimal: ','
  37. },
  38. abbreviations: {
  39. thousand: 'bin',
  40. million: 'milyon',
  41. billion: 'milyar',
  42. trillion: 'trilyon'
  43. },
  44. ordinal: function (number) {
  45. if (number === 0) { // special case for zero
  46. return '\'ıncı';
  47. }
  48. var a = number % 10,
  49. b = number % 100 - a,
  50. c = number >= 100 ? 100 : null;
  51. return suffixes[a] || suffixes[b] || suffixes[c];
  52. },
  53. currency: {
  54. symbol: '\u20BA'
  55. }
  56. });
  57. }));