Skip to content

Commit

Permalink
Update Greek locale (date-fns#926)
Browse files Browse the repository at this point in the history
fanixk authored and kossnocorp committed Oct 18, 2018
1 parent 062c07a commit 56adab6
Showing 10 changed files with 918 additions and 194 deletions.
1 change: 0 additions & 1 deletion outdatedLocales.json
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
"ca",
"cs",
"da",
"el",
"fi",
"fil",
"fr-CH",
4 changes: 2 additions & 2 deletions src/locale/el/_lib/formatDistance/index.js
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ var formatDistanceLocale = {
}
}

export default function formatDistance (token, count, options) {
export default function formatDistance(token, count, options) {
options = options || {}

var result
@@ -83,7 +83,7 @@ export default function formatDistance (token, count, options) {
if (options.comparison > 0) {
return 'σε ' + result
} else {
return result + ' πρίν'
return result + ' πριν'
}
}

162 changes: 85 additions & 77 deletions src/locale/el/_lib/formatDistance/test.js
Original file line number Diff line number Diff line change
@@ -4,211 +4,219 @@
import assert from 'power-assert'
import formatDistance from '.'

describe('el locale > formatDistance', function () {
describe('lessThanXSeconds', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
assert(formatDistance('lessThanXSeconds', 1) === 'λιγότερο από ένα δευτερόλεπτο')
describe('el locale > formatDistance', function() {
describe('lessThanXSeconds', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(
formatDistance('lessThanXSeconds', 1) ===
'λιγότερο από ένα δευτερόλεπτο'
)
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
assert(formatDistance('lessThanXSeconds', 2) === 'λιγότερο από 2 δευτερόλεπτα')
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(
formatDistance('lessThanXSeconds', 2) ===
'λιγότερο από 2 δευτερόλεπτα'
)
})
})
})

describe('xSeconds', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
describe('xSeconds', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xSeconds', 1) === '1 δευτερόλεπτο')
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xSeconds', 2) === '2 δευτερόλεπτα')
})
})
})

describe('halfAMinute', function () {
it('returns a proper string', function () {
describe('halfAMinute', function() {
it('returns a proper string', function() {
assert(formatDistance('halfAMinute') === 'μισό λεπτό')
})

it('ignores the second argument', function () {
it('ignores the second argument', function() {
assert(formatDistance('halfAMinute', 123) === 'μισό λεπτό')
})
})

describe('lessThanXMinutes', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
assert(formatDistance('lessThanXMinutes', 1) === 'λιγότερο από ένα λεπτό')
describe('lessThanXMinutes', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(
formatDistance('lessThanXMinutes', 1) === 'λιγότερο από ένα λεπτό'
)
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('lessThanXMinutes', 2) === 'λιγότερο από 2 λεπτά')
})
})
})

describe('xMinutes', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
describe('xMinutes', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xMinutes', 1) === '1 λεπτό')
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xMinutes', 2) === '2 λεπτά')
})
})
})

describe('aboutXHours', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
describe('aboutXHours', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(formatDistance('aboutXHours', 1) === 'περίπου 1 ώρα')
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('aboutXHours', 2) === 'περίπου 2 ώρες')
})
})
})

describe('xHours', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
describe('xHours', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xHours', 1) === '1 ώρα')
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xHours', 2) === '2 ώρες')
})
})
})

describe('xDays', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
describe('xDays', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xDays', 1) === '1 ημέρα')
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xDays', 2) === '2 ημέρες')
})
})
})

describe('aboutXMonths', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
describe('aboutXMonths', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(formatDistance('aboutXMonths', 1) === 'περίπου 1 μήνας')
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('aboutXMonths', 2) === 'περίπου 2 μήνες')
})
})
})

describe('xMonths', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
describe('xMonths', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xMonths', 1) === '1 μήνας')
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xMonths', 2) === '2 μήνες')
})
})
})

describe('aboutXYears', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
describe('aboutXYears', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(formatDistance('aboutXYears', 1) === 'περίπου 1 χρόνο')
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('aboutXYears', 2) === 'περίπου 2 χρόνια')
})
})
})

describe('xYears', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
describe('xYears', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xYears', 1) === '1 χρόνο')
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('xYears', 2) === '2 χρόνια')
})
})
})

describe('overXYears', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
describe('overXYears', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(formatDistance('overXYears', 1) === 'πάνω από 1 χρόνο')
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('overXYears', 2) === 'πάνω από 2 χρόνια')
})
})
})

describe('almostXYears', function () {
context('when the count equals 1', function () {
it('returns a proper string', function () {
describe('almostXYears', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
assert(formatDistance('almostXYears', 1) === 'περίπου 1 χρόνο')
})
})

context('when the count is more than 1', function () {
it('returns a proper string', function () {
context('when the count is more than 1', function() {
it('returns a proper string', function() {
assert(formatDistance('almostXYears', 2) === 'περίπου 2 χρόνια')
})
})
})

context('with a past suffix', function () {
it('adds `ago` to a string', function () {
context('with a past suffix', function() {
it('adds `ago` to a string', function() {
var result = formatDistance('aboutXYears', 1, {
addSuffix: true,
comparison: -1
})
assert(result === 'περίπου 1 χρόνο πρίν')
assert(result === 'περίπου 1 χρόνο πριν')
})
})

context('with a future suffix', function () {
it('adds `in` to a string', function () {
context('with a future suffix', function() {
it('adds `in` to a string', function() {
var result = formatDistance('halfAMinute', null, {
addSuffix: true,
comparison: 1
43 changes: 35 additions & 8 deletions src/locale/el/_lib/formatLong/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@
import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index.js'

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'
})
var dateFormats = {
full: 'EEEE, d MMMM y',
long: 'd MMMM y',
medium: 'd MMM y',
short: 'd/M/yy'
}

var timeFormats = {
full: 'h:mm:ss a zzzz',
long: 'h:mm:ss a z',
medium: 'h:mm:ss a',
short: 'h:mm a'
}

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
14 changes: 7 additions & 7 deletions src/locale/el/_lib/formatRelative/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +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'
lastWeek: "'την προηγούμενη' eeee 'στις' p",
yesterday: "'χθες στις' p",
today: "'σήμερα στις' p",
tomorrow: "'αύριο στις' p",
nextWeek: "eeee 'στις' p",
other: 'P'
}

export default function formatRelative (token, date, baseDate, options) {
export default function formatRelative(token, date, baseDate, options) {
return formatRelativeLocale[token]
}
Loading
Oops, something went wrong.

0 comments on commit 56adab6

Please sign in to comment.