123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- exports.localeToNumber = localeToNumber;
- exports.numberToLocale = numberToLocale;
- var _index = _interopRequireDefault(require("../../../_lib/buildLocalizeFn/index.js"));
- var numberValues = {
- locale: {
- '1': '१',
- '2': '२',
- '3': '३',
- '4': '४',
- '5': '५',
- '6': '६',
- '7': '७',
- '8': '८',
- '9': '९',
- '0': '०'
- },
- number: {
- '१': '1',
- '२': '2',
- '३': '3',
- '४': '4',
- '५': '5',
- '६': '6',
- '७': '7',
- '८': '8',
- '९': '9',
- '०': '0'
- }
- };
- // CLDR #1585 - #1592
- var eraValues = {
- narrow: ['ईसा-पूर्व', 'ईस्वी'],
- abbreviated: ['ईसा-पूर्व', 'ईस्वी'],
- wide: ['ईसा-पूर्व', 'ईसवी सन']
- };
- // CLDR #1593 - #1616
- var quarterValues = {
- narrow: ['1', '2', '3', '4'],
- abbreviated: ['ति1', 'ति2', 'ति3', 'ति4'],
- wide: ['पहली तिमाही', 'दूसरी तिमाही', 'तीसरी तिमाही', 'चौथी तिमाही']
- };
- // Note: in English, the names of days of the week and months are capitalized.
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
- // Generally, formatted dates should look like they are in the middle of a sentence,
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
- // https://www.unicode.org/cldr/charts/32/summary/hi.html
- // CLDR #1617 - #1688
- var monthValues = {
- narrow: ['ज', 'फ़', 'मा', 'अ', 'मई', 'जू', 'जु', 'अग', 'सि', 'अक्टू', 'न', 'दि'],
- abbreviated: ['जन', 'फ़र', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुल', 'अग', 'सित', 'अक्टू', 'नव', 'दिस'],
- wide: ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितंबर', 'अक्टूबर', 'नवंबर', 'दिसंबर']
- };
- // CLDR #1689 - #1744
- var dayValues = {
- narrow: ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'],
- short: ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'],
- abbreviated: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'],
- wide: ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरुवार', 'शुक्रवार', 'शनिवार']
- };
- var dayPeriodValues = {
- narrow: {
- am: 'पूर्वाह्न',
- pm: 'अपराह्न',
- midnight: 'मध्यरात्रि',
- noon: 'दोपहर',
- morning: 'सुबह',
- afternoon: 'दोपहर',
- evening: 'शाम',
- night: 'रात'
- },
- abbreviated: {
- am: 'पूर्वाह्न',
- pm: 'अपराह्न',
- midnight: 'मध्यरात्रि',
- noon: 'दोपहर',
- morning: 'सुबह',
- afternoon: 'दोपहर',
- evening: 'शाम',
- night: 'रात'
- },
- wide: {
- am: 'पूर्वाह्न',
- pm: 'अपराह्न',
- midnight: 'मध्यरात्रि',
- noon: 'दोपहर',
- morning: 'सुबह',
- afternoon: 'दोपहर',
- evening: 'शाम',
- night: 'रात'
- }
- };
- var formattingDayPeriodValues = {
- narrow: {
- am: 'पूर्वाह्न',
- pm: 'अपराह्न',
- midnight: 'मध्यरात्रि',
- noon: 'दोपहर',
- morning: 'सुबह',
- afternoon: 'दोपहर',
- evening: 'शाम',
- night: 'रात'
- },
- abbreviated: {
- am: 'पूर्वाह्न',
- pm: 'अपराह्न',
- midnight: 'मध्यरात्रि',
- noon: 'दोपहर',
- morning: 'सुबह',
- afternoon: 'दोपहर',
- evening: 'शाम',
- night: 'रात'
- },
- wide: {
- am: 'पूर्वाह्न',
- pm: 'अपराह्न',
- midnight: 'मध्यरात्रि',
- noon: 'दोपहर',
- morning: 'सुबह',
- afternoon: 'दोपहर',
- evening: 'शाम',
- night: 'रात'
- }
- };
- var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
- var number = Number(dirtyNumber);
- return numberToLocale(number);
- };
- function localeToNumber(locale) {
- var enNumber = locale.toString().replace(/[१२३४५६७८९०]/g, function (match) {
- return numberValues.number[match];
- });
- return Number(enNumber);
- }
- function numberToLocale(enNumber) {
- return enNumber.toString().replace(/\d/g, function (match) {
- return numberValues.locale[match];
- });
- }
- var localize = {
- ordinalNumber: ordinalNumber,
- era: (0, _index.default)({
- values: eraValues,
- defaultWidth: 'wide'
- }),
- quarter: (0, _index.default)({
- values: quarterValues,
- defaultWidth: 'wide',
- argumentCallback: function argumentCallback(quarter) {
- return quarter - 1;
- }
- }),
- month: (0, _index.default)({
- values: monthValues,
- defaultWidth: 'wide'
- }),
- day: (0, _index.default)({
- values: dayValues,
- defaultWidth: 'wide'
- }),
- dayPeriod: (0, _index.default)({
- values: dayPeriodValues,
- defaultWidth: 'wide',
- formattingValues: formattingDayPeriodValues,
- defaultFormattingWidth: 'wide'
- })
- };
- var _default = localize;
- exports.default = _default;
|