Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Armenian language support #1448

Merged
merged 2 commits into from Sep 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
78 changes: 78 additions & 0 deletions src/locale/hy/_lib/formatDistance/index.js
@@ -0,0 +1,78 @@
var formatDistanceLocale = {
lessThanXSeconds: {
one: 'ավելի քիչ քան 1 վայրկյան',
other: 'ավելի քիչ քան {{count}} վայրկյան'
},
xSeconds: {
one: '1 վայրկյան',
other: '{{count}} վայրկյան'
},
halfAMinute: 'կես րոպե',
lessThanXMinutes: {
one: 'ավելի քիչ քան 1 րոպե',
other: 'ավելի քիչ քան {{count}} րոպե'
},
xMinutes: {
one: '1 րոպե',
other: '{{count}} րոպե'
},
aboutXHours: {
one: 'մոտ 1 ժամ',
other: 'մոտ {{count}} ժամ'
},
xHours: {
one: '1 ժամ',
other: '{{count}} ժամ'
},
xDays: {
one: '1 օր',
other: '{{count}} օր'
},
aboutXMonths: {
one: 'մոտ 1 ամիս',
other: 'մոտ {{count}} ամիս'
},
xMonths: {
one: '1 ամիս',
other: '{{count}} ամիս'
},
aboutXYears: {
one: 'մոտ 1 տարի',
other: 'մոտ {{count}} տարի'
},
xYears: {
one: '1 տարի',
other: '{{count}} տարի'
},
overXYears: {
one: 'ավելի քան 1 տարի',
other: 'ավելի քան {{count}} տարի'
},
almostXYears: {
one: 'համարյա 1 տարի',
other: 'համարյա {{count}} տարի'
}
}

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 result + ' հետո'
} else {
return result + ' առաջ'
}
}

return result
}
36 changes: 36 additions & 0 deletions src/locale/hy/_lib/formatLong/index.js
@@ -0,0 +1,36 @@
import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index.js'

var dateFormats = {
full: 'd MMMM, y, EEEE',
long: 'd MMMM, y',
medium: 'd MMM, y',
short: 'dd.MM.yyyy'
}
var timeFormats = {
full: 'HH:mm:ss zzzz',
long: 'HH:mm:ss z',
medium: 'HH:mm:ss',
short: 'HH: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/hy/_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]
}
179 changes: 179 additions & 0 deletions src/locale/hy/_lib/localize/index.js
@@ -0,0 +1,179 @@
import buildLocalizeFn from '../../../_lib/buildLocalizeFn/index.js'

var eraValues = {
narrow: ['Ք', 'Մ'],
abbreviated: ['ՔԱ', 'ՄԹ'],
wide: ['Քրիստոսից առաջ', 'Մեր թվարկության']
}
var quarterValues = {
narrow: ['1', '2', '3', '4'],
abbreviated: ['Ք1', 'Ք2', 'Ք3', 'Ք4'],
wide: ['1֊ին քառորդ', '2֊րդ քառորդ', '3֊րդ քառորդ', '4֊րդ քառորդ']
}
var monthValues = {
narrow: ['Հ', 'Փ', 'Մ', 'Ա', 'Մ', 'Հ', 'Հ', 'Օ', 'Ս', 'Հ', 'Ն', 'Դ'],
abbreviated: [
'հուն',
'փետ',
'մար',
'ապր',
'մայ',
'հուն',
'հուլ',
'օգս',
'սեպ',
'հոկ',
'նոյ',
'դեկ'
],
wide: [
'հունվար',
'փետրվար',
'մարտ',
'ապրիլ',
'մայիս',
'հունիս',
'հուլիս',
'օգոստոս',
'սեպտեմբեր',
'հոկտեմբեր',
'նոյեմբեր',
'դեկտեմբեր'
]
}
var dayValues = {
narrow: ['Կ', 'Ե', 'Ե', 'Չ', 'Հ', 'Ո', 'Շ'],
short: ['կր', 'եր', 'եք', 'չք', 'հգ', 'ուր', 'շբ'],
abbreviated: ['կիր', 'երկ', 'երք', 'չոր', 'հնգ', 'ուրբ', 'շաբ'],
wide: [
'կիրակի',
'երկուշաբթի',
'երեքշաբթի',
'չորեքշաբթի',
'հինգշաբթի',
'ուրբաթ',
'շաբաթ'
]
}
var dayPeriodValues = {
narrow: {
am: 'a',
pm: 'p',
midnight: 'կեսգշ',
noon: 'կեսօր',
morning: 'առավոտ',
afternoon: 'ցերեկ',
evening: 'երեկո',
night: 'գիշեր'
},
abbreviated: {
am: 'AM',
pm: 'PM',
midnight: 'կեսգիշեր',
noon: 'կեսօր',
morning: 'առավոտ',
afternoon: 'ցերեկ',
evening: 'երեկո',
night: 'գիշեր'
},
wide: {
am: 'a.m.',
pm: 'p.m.',
midnight: 'կեսգիշեր',
noon: 'կեսօր',
morning: 'առավոտ',
afternoon: 'ցերեկ',
evening: 'երեկո',
night: 'գիշեր'
}
}
var formattingDayPeriodValues = {
narrow: {
am: 'a',
pm: 'p',
midnight: 'կեսգշ',
noon: 'կեսօր',
morning: 'առավոտը',
afternoon: 'ցերեկը',
evening: 'երեկոյան',
night: 'գիշերը'
},
abbreviated: {
am: 'AM',
pm: 'PM',
midnight: 'կեսգիշերին',
noon: 'կեսօրին',
morning: 'առավոտը',
afternoon: 'ցերեկը',
evening: 'երեկոյան',
night: 'գիշերը'
},
wide: {
am: 'a.m.',
pm: 'p.m.',
midnight: 'կեսգիշերին',
noon: 'կեսօրին',
morning: 'առավոտը',
afternoon: 'ցերեկը',
evening: 'երեկոյան',
night: 'գիշերը'
}
}

function ordinalNumber(dirtyNumber, _dirtyOptions) {
var number = Number(dirtyNumber) // If ordinal numbers depend on context, for example,
// if they are different for different grammatical genders,
// use `options.unit`:
//
// var options = dirtyOptions || {}
// var unit = String(options.unit)
//
// where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
// 'day', 'hour', 'minute', 'second'

var rem100 = number % 100

if (rem100 < 10) {
if (rem100 % 10 === 1) {
return number + '֊ին'
leshakoss marked this conversation as resolved.
Show resolved Hide resolved
}
}

return number + '֊րդ'
}

var localize = {
ordinalNumber: ordinalNumber,

era: buildLocalizeFn({
values: eraValues,
defaultWidth: 'wide'
}),

quarter: buildLocalizeFn({
values: quarterValues,
defaultWidth: 'wide',
argumentCallback: function(quarter) {
return Number(quarter) - 1
}
}),

month: buildLocalizeFn({
values: monthValues,
defaultWidth: 'wide'
}),

day: buildLocalizeFn({
values: dayValues,
defaultWidth: 'wide'
}),

dayPeriod: buildLocalizeFn({
values: dayPeriodValues,
defaultWidth: 'wide',
formattingValues: formattingDayPeriodValues,
defaultFormattingWidth: 'wide'
})
}

export default localize