diff options
Diffstat (limited to 'date-fns/src/locale/fil/_lib')
-rw-r--r-- | date-fns/src/locale/fil/_lib/formatDistance/index.js | 101 | ||||
-rw-r--r-- | date-fns/src/locale/fil/_lib/formatLong/index.js | 12 | ||||
-rw-r--r-- | date-fns/src/locale/fil/_lib/formatRelative/index.js | 12 | ||||
-rw-r--r-- | date-fns/src/locale/fil/_lib/localize/index.js | 83 | ||||
-rw-r--r-- | date-fns/src/locale/fil/_lib/match/index.js | 60 |
5 files changed, 268 insertions, 0 deletions
diff --git a/date-fns/src/locale/fil/_lib/formatDistance/index.js b/date-fns/src/locale/fil/_lib/formatDistance/index.js new file mode 100644 index 0000000..4da5dfa --- /dev/null +++ b/date-fns/src/locale/fil/_lib/formatDistance/index.js @@ -0,0 +1,101 @@ +var formatDistanceLocale = { + lessThanXSeconds: { + one: 'mas maliit sa isang segundo', + other: 'mas maliit sa {{count}} segundo' + }, + + xSeconds: { + one: '1 segundo', + other: '{{count}} segundo' + }, + + halfAMinute: 'kalahating minuto', + + lessThanXMinutes: { + one: 'mas maliit sa isang minuto', + other: 'mas maliit sa {{count}} minuto' + }, + + xMinutes: { + one: '1 minuto', + other: '{{count}} minuto' + }, + + aboutXHours: { + one: 'mga 1 oras', + other: 'mga {{count}} oras' + }, + + xHours: { + one: '1 oras', + other: '{{count}} oras' + }, + + xDays: { + one: '1 araw', + other: '{{count}} araw' + }, + + aboutXWeeks: { + one: 'mga 1 buwan', // TODO + other: 'mga {{count}} buwan' // TODO + }, + + xWeeks: { + one: '1 buwan', // TODO + other: '{{count}} buwan' // TODO + }, + + aboutXMonths: { + one: 'mga 1 buwan', + other: 'mga {{count}} buwan' + }, + + xMonths: { + one: '1 buwan', + other: '{{count}} buwan' + }, + + aboutXYears: { + one: 'mga 1 taon', + other: 'mga {{count}} taon' + }, + + xYears: { + one: '1 taon', + other: '{{count}} taon' + }, + + overXYears: { + one: 'higit sa 1 taon', + other: 'higit sa {{count}} taon' + }, + + almostXYears: { + one: 'halos 1 taon', + other: 'halos {{count}} taon' + } +} + +export default function formatDistance(token, count, options) { + options = options || {} + + var result + if (typeof formatDistanceLocale[token] === 'string') { + result = formatDistanceLocale[token] + } else if (count === 1) { + result = formatDistanceLocale[token].one + } else { + result = formatDistanceLocale[token].other.replace('{{count}}', count) + } + + if (options.addSuffix) { + if (options.comparison > 0) { + return 'sa loob ng ' + result + } else { + return result + ' ang nakalipas' + } + } + + return result +} diff --git a/date-fns/src/locale/fil/_lib/formatLong/index.js b/date-fns/src/locale/fil/_lib/formatLong/index.js new file mode 100644 index 0000000..2cf1867 --- /dev/null +++ b/date-fns/src/locale/fil/_lib/formatLong/index.js @@ -0,0 +1,12 @@ +import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index' + +var formatLong = buildFormatLongFn({ + LT: 'h:mm aa', + LTS: 'h:mm:ss aa', + L: 'MM/DD/YYYY', + LL: 'MMMM D YYYY', + LLL: 'MMMM D YYYY h:mm aa', + LLLL: 'dddd, MMMM D YYYY h:mm aa' +}) + +export default formatLong diff --git a/date-fns/src/locale/fil/_lib/formatRelative/index.js b/date-fns/src/locale/fil/_lib/formatRelative/index.js new file mode 100644 index 0000000..52ebbf1 --- /dev/null +++ b/date-fns/src/locale/fil/_lib/formatRelative/index.js @@ -0,0 +1,12 @@ +var formatRelativeLocale = { + lastWeek: '[last] dddd [at] LT', + yesterday: '[yesterday at] LT', + today: '[today at] LT', + tomorrow: '[tomorrow at] LT', + nextWeek: 'dddd [at] LT', + other: 'L' +} + +export default function formatRelative(token, _date, _baseDate, _options) { + return formatRelativeLocale[token] +} diff --git a/date-fns/src/locale/fil/_lib/localize/index.js b/date-fns/src/locale/fil/_lib/localize/index.js new file mode 100644 index 0000000..6be8e61 --- /dev/null +++ b/date-fns/src/locale/fil/_lib/localize/index.js @@ -0,0 +1,83 @@ +import buildLocalizeFn from '../../../_lib/buildLocalizeFn/index' +import buildLocalizeArrayFn from '../../../_lib/buildLocalizeArrayFn/index' + +var weekdayValues = { + narrow: ['Li', 'Lu', 'Ma', 'Mi', 'Hu', 'Bi', 'Sa'], + short: ['Lin', 'Lun', 'Mar', 'Miy', 'Huw', 'Biy', 'Sab'], + long: [ + 'Linggo', + 'Lunes', + 'Martes', + 'Miyerkules', + 'Huwebes', + 'Biyernes', + 'Sabado' + ] +} + +var monthValues = { + short: [ + 'Ene', + 'Peb', + 'Mar', + 'Abr', + 'May', + 'Hun', + 'Hul', + 'Ago', + 'Set', + 'Okt', + 'Nob', + 'Dis' + ], + long: [ + 'Enero', + 'Pebrero', + 'Marso', + 'Abril', + 'Mayo', + 'Hunyo', + 'Hulyo', + 'Agosto', + 'Setyembre', + 'Oktubre', + 'Nobyembre', + 'Disyembre' + ] +} + +var timeOfDayValues = { + uppercase: ['NU', 'NT', 'NH', 'NG'], + lowercase: ['nu', 'nt', 'nh', 'ng'], + long: ['ng umaga', 'ng tanghali', 'ng hapon', 'ng gabi'] +} + +function ordinalNumber(dirtyNumber) { + var number = Number(dirtyNumber) + return 'ika-' + number +} + +var localize = { + ordinalNumber: ordinalNumber, + weekday: buildLocalizeFn(weekdayValues, 'long'), + weekdays: buildLocalizeArrayFn(weekdayValues, 'long'), + month: buildLocalizeFn(monthValues, 'long'), + months: buildLocalizeArrayFn(monthValues, 'long'), + timeOfDay: buildLocalizeFn(timeOfDayValues, 'long', function(hours) { + if (hours > 12) { + var modulo = hours % 12 + if (modulo < 6) { + return 2 + } else { + return 3 + } + } else if (hours < 12) { + return 0 + } else { + return 1 + } + }), + timesOfDay: buildLocalizeArrayFn(timeOfDayValues, 'long') +} + +export default localize diff --git a/date-fns/src/locale/fil/_lib/match/index.js b/date-fns/src/locale/fil/_lib/match/index.js new file mode 100644 index 0000000..5a3f4c5 --- /dev/null +++ b/date-fns/src/locale/fil/_lib/match/index.js @@ -0,0 +1,60 @@ +import buildMatchFn from '../../../_lib/buildMatchFn/index' +import buildParseFn from '../../../_lib/buildParseFn/index' +import buildMatchPatternFn from '../../../_lib/buildMatchPatternFn/index' +import parseDecimal from '../../../_lib/parseDecimal/index' + +var matchOrdinalNumbersPattern = /^(\d+)(th|st|nd|rd)?/i + +var matchWeekdaysPatterns = { + narrow: /^(su|mo|tu|we|th|fr|sa)/i, + short: /^(sun|mon|tue|wed|thu|fri|sat)/i, + long: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i +} + +var parseWeekdayPatterns = { + any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] +} + +var matchMonthsPatterns = { + short: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, + long: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i +} + +var parseMonthPatterns = { + any: [ + /^ja/i, + /^f/i, + /^mar/i, + /^ap/i, + /^may/i, + /^jun/i, + /^jul/i, + /^au/i, + /^s/i, + /^o/i, + /^n/i, + /^d/i + ] +} + +var matchTimesOfDayPatterns = { + short: /^(am|pm)/i, + long: /^([ap]\.?\s?m\.?)/i +} + +var parseTimeOfDayPatterns = { + any: [/^a/i, /^p/i] +} + +var match = { + ordinalNumbers: buildMatchPatternFn(matchOrdinalNumbersPattern), + ordinalNumber: parseDecimal, + weekdays: buildMatchFn(matchWeekdaysPatterns, 'long'), + weekday: buildParseFn(parseWeekdayPatterns, 'any'), + months: buildMatchFn(matchMonthsPatterns, 'long'), + month: buildParseFn(parseMonthPatterns, 'any'), + timesOfDay: buildMatchFn(matchTimesOfDayPatterns, 'long'), + timeOfDay: buildParseFn(parseTimeOfDayPatterns, 'any') +} + +export default match |