Skip to content

Commit

Permalink
Add Tamil (ta) locale (#1411)
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s authored and kossnocorp committed Sep 12, 2019
1 parent 9ea4533 commit 4695163
Show file tree
Hide file tree
Showing 12 changed files with 1,030 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/locale/index.js
Expand Up @@ -43,6 +43,7 @@ export { default as ro } from './ro/index.js'
export { default as ru } from './ru/index.js'
export { default as sk } from './sk/index.js'
export { default as sv } from './sv/index.js'
export { default as ta } from './ta/index.js'
export { default as th } from './th/index.js'
export { default as tr } from './tr/index.js'
export { default as ug } from './ug/index.js'
Expand Down
1 change: 1 addition & 0 deletions src/locale/index.js.flow
Expand Up @@ -83,6 +83,7 @@ declare module.exports: {
sl: Locale,
sr: Locale,
sv: Locale,
ta: Locale,
th: Locale,
tr: Locale,
ug: Locale,
Expand Down
210 changes: 210 additions & 0 deletions src/locale/ta/_lib/formatDistance/index.js
@@ -0,0 +1,210 @@
var formatDistanceLocale = {
lessThanXSeconds: {
one: {
default: 'ஒரு வினாடிக்கு குறைவாக',
in: 'ஒரு வினாடிக்குள்',
ago: 'ஒரு வினாடிக்கு முன்பு'
},
other: {
default: '{{count}} வினாடிகளுக்கு குறைவாக',
in: '{{count}} வினாடிகளுக்குள்',
ago: '{{count}} வினாடிகளுக்கு முன்பு'
}
},

xSeconds: {
one: {
default: '1 வினாடி',
in: '1 வினாடியில்',
ago: '1 வினாடி முன்பு'
},
other: {
default: '{{count}} விநாடிகள்',
in: '{{count}} வினாடிகளில்',
ago: '{{count}} விநாடிகளுக்கு முன்பு'
}
},

halfAMinute: {
default: 'அரை நிமிடம்',
in: 'அரை நிமிடத்தில்',
ago: 'அரை நிமிடம் முன்பு'
},

lessThanXMinutes: {
one: {
default: 'ஒரு நிமிடத்திற்கும் குறைவாக',
in: 'ஒரு நிமிடத்திற்குள்',
ago: 'ஒரு நிமிடத்திற்கு முன்பு'
},
other: {
default: '{{count}} நிமிடங்களுக்கும் குறைவாக',
in: '{{count}} நிமிடங்களுக்குள்',
ago: '{{count}} நிமிடங்களுக்கு முன்பு'
}
},

xMinutes: {
one: {
default: '1 நிமிடம்',
in: '1 நிமிடத்தில்',
ago: '1 நிமிடம் முன்பு'
},
other: {
default: '{{count}} நிமிடங்கள்',
in: '{{count}} நிமிடங்களில்',
ago: '{{count}} நிமிடங்களுக்கு முன்பு'
}
},

aboutXHours: {
one: {
default: 'சுமார் 1 மணி நேரம்',
in: 'சுமார் 1 மணி நேரத்தில்',
ago: 'சுமார் 1 மணி நேரத்திற்கு முன்பு'
},
other: {
default: 'சுமார் {{count}} மணி நேரம்',
in: 'சுமார் {{count}} மணி நேரத்திற்கு முன்பு',
ago: 'சுமார் {{count}} மணி நேரத்தில்'
}
},

xHours: {
one: {
default: '1 மணி நேரம்',
in: '1 மணி நேரத்தில்',
ago: '1 மணி நேரத்திற்கு முன்பு'
},
other: {
default: '{{count}} மணி நேரம்',
in: '{{count}} மணி நேரத்தில்',
ago: '{{count}} மணி நேரத்திற்கு முன்பு'
}
},

xDays: {
one: {
default: '1 நாள்',
in: '1 நாளில்',
ago: '1 நாள் முன்பு'
},
other: {
default: '{{count}} நாட்கள்',
in: '{{count}} நாட்களில்',
ago: '{{count}} நாட்களுக்கு முன்பு'
}
},

aboutXMonths: {
one: {
default: 'சுமார் 1 மாதம்',
in: 'சுமார் 1 மாதத்தில்',
ago: 'சுமார் 1 மாதத்திற்கு முன்பு'
},
other: {
default: 'சுமார் {{count}} மாதங்கள்',
in: 'சுமார் {{count}} மாதங்களில்',
ago: 'சுமார் {{count}} மாதங்களுக்கு முன்பு'
}
},

xMonths: {
one: {
default: '1 மாதம்',
in: '1 மாதத்தில்',
ago: '1 மாதம் முன்பு'
},
other: {
default: '{{count}} மாதங்கள்',
in: '{{count}} மாதங்களில்',
ago: '{{count}} மாதங்களுக்கு முன்பு'
}
},

aboutXYears: {
one: {
default: 'சுமார் 1 வருடம்',
in: 'சுமார் 1 ஆண்டில்',
ago: 'சுமார் 1 வருடம் முன்பு'
},
other: {
default: 'சுமார் {{count}} ஆண்டுகள்',
in: 'சுமார் {{count}} ஆண்டுகளில்',
ago: 'சுமார் {{count}} ஆண்டுகளுக்கு முன்பு'
}
},

xYears: {
one: {
default: '1 வருடம்',
in: '1 ஆண்டில்',
ago: '1 வருடம் முன்பு'
},
other: {
default: '{{count}} ஆண்டுகள்',
in: '{{count}} ஆண்டுகளில்',
ago: '{{count}} ஆண்டுகளுக்கு முன்பு'
}
},

overXYears: {
one: {
default: '1 வருடத்திற்கு மேல்',
in: '1 வருடத்திற்கும் மேலாக',
ago: '1 வருடம் முன்பு'
},
other: {
default: '{{count}} ஆண்டுகளுக்கும் மேலாக',
in: '{{count}} ஆண்டுகளில்',
ago: '{{count}} ஆண்டுகளுக்கு முன்பு'
}
},

almostXYears: {
one: {
default: 'கிட்டத்தட்ட 1 வருடம்',
in: 'கிட்டத்தட்ட 1 ஆண்டில்',
ago: 'கிட்டத்தட்ட 1 வருடம் முன்பு'
},
other: {
default: 'கிட்டத்தட்ட {{count}} ஆண்டுகள்',
in: 'கிட்டத்தட்ட {{count}} ஆண்டுகளில்',
ago: 'கிட்டத்தட்ட {{count}} ஆண்டுகளுக்கு முன்பு'
}
}
}

function getFormatDistanceLocaleWithSuffix(resultObj, options) {
if (options.addSuffix) {
if (options.comparison > 0) {
return resultObj.in
} else {
return resultObj.ago
}
}

return resultObj.default
}

export default function formatDistance(token, count, options = {}) {
var result
if (formatDistanceLocale[token].default) {
result = getFormatDistanceLocaleWithSuffix(
formatDistanceLocale[token],
options
)
} else if (count === 1) {
result = getFormatDistanceLocaleWithSuffix(
formatDistanceLocale[token].one,
options
)
} else {
result = getFormatDistanceLocaleWithSuffix(
formatDistanceLocale[token].other,
options
)
}

return result.replace('{{count}}', count)
}
45 changes: 45 additions & 0 deletions src/locale/ta/_lib/formatLong/index.js
@@ -0,0 +1,45 @@
// Ref: https://www.unicode.org/cldr/charts/32/summary/ta.html

import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index.js'

// CLDR #1846 - #1849
var dateFormats = {
full: 'EEEE, d MMMM, y',
long: 'd MMMM, y',
medium: 'd MMM, y',
short: 'd/M/yy'
}

// CLDR #1850 - #1853
var timeFormats = {
full: 'a h:mm:ss zzzz',
long: 'a h:mm:ss z',
medium: 'a h:mm:ss',
short: 'a h:mm'
}

var dateTimeFormats = {
full: '{{date}} {{time}}',
long: '{{date}} {{time}}',
medium: '{{date}}, {{time}}',
short: '{{date}}, {{time}}'
}

var formatLong = {
date: buildFormatLongFn({
formats: dateFormats,
defaultWidth: 'full'
}),

time: buildFormatLongFn({
formats: timeFormats,
defaultWidth: 'full'
}),

dateTime: buildFormatLongFn({
formats: dateTimeFormats,
defaultWidth: 'full'
})
}

export default formatLong
12 changes: 12 additions & 0 deletions src/locale/ta/_lib/formatRelative/index.js
@@ -0,0 +1,12 @@
var formatRelativeLocale = {
lastWeek: "'கடந்த' eeee p 'மணிக்கு'",
yesterday: "'நேற்று ' p 'மணிக்கு'",
today: "'இன்று ' p 'மணிக்கு'",
tomorrow: "'நாளை ' p 'மணிக்கு'",
nextWeek: "eeee p 'மணிக்கு'",
other: 'P'
}

export default function formatRelative(token, _date, _baseDate, _options) {
return formatRelativeLocale[token]
}

0 comments on commit 4695163

Please sign in to comment.