Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
8c1c938
commit 1bb52f4
Showing
15 changed files
with
6,569 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import localize from '../localize/index.js' | ||
|
||
var formatDistanceLocale = { | ||
lessThanXSeconds: { | ||
one: 'প্রায় ১ সেকেন্ড', | ||
other: 'প্রায় {{count}} সেকেন্ড' | ||
}, | ||
|
||
xSeconds: { | ||
one: '১ সেকেন্ড', | ||
other: '{{count}} সেকেন্ড' | ||
}, | ||
|
||
halfAMinute: 'আধ মিনিট', | ||
|
||
lessThanXMinutes: { | ||
one: 'প্রায় ১ মিনিট', | ||
other: 'প্রায় {{count}} মিনিট' | ||
}, | ||
|
||
xMinutes: { | ||
one: '১ মিনিট', | ||
other: '{{count}} মিনিট' | ||
}, | ||
|
||
aboutXHours: { | ||
one: 'প্রায় ১ ঘন্টা', | ||
other: 'প্রায় {{count}} ঘন্টা' | ||
}, | ||
|
||
xHours: { | ||
one: '১ ঘন্টা', | ||
other: '{{count}} ঘন্টা' | ||
}, | ||
|
||
xDays: { | ||
one: '১ দিন', | ||
other: '{{count}} দিন' | ||
}, | ||
|
||
aboutXMonths: { | ||
one: 'প্রায় ১ মাস', | ||
other: 'প্রায় {{count}} মাস' | ||
}, | ||
|
||
xMonths: { | ||
one: '১ মাস', | ||
other: '{{count}} মাস' | ||
}, | ||
|
||
aboutXYears: { | ||
one: 'প্রায় ১ বছর', | ||
other: 'প্রায় {{count}} বছর' | ||
}, | ||
|
||
xYears: { | ||
one: '১ বছর', | ||
other: '{{count}} বছর' | ||
}, | ||
|
||
overXYears: { | ||
one: '১ বছরের বেশি', | ||
other: '{{count}} বছরের বেশি' | ||
}, | ||
|
||
almostXYears: { | ||
one: 'প্রায় ১ বছর', | ||
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}}', localize.numberToLocale(count)) | ||
} | ||
|
||
if (options.addSuffix) { | ||
if (options.comparison > 0) { | ||
return result + ' এর মধ্যে' | ||
} else { | ||
return result + ' আগে' | ||
} | ||
} | ||
|
||
return result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
// @flow | ||
/* eslint-env mocha */ | ||
|
||
import assert from 'power-assert' | ||
import formatDistance from '.' | ||
|
||
describe('bn 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) === 'প্রায় ২ সেকেন্ড') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('xSeconds', function () { | ||
context('when the count equals 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xSeconds', 1) === '১ সেকেন্ড') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xSeconds', 2) === '২ সেকেন্ড') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('halfAMinute', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('halfAMinute') === 'আধ মিনিট') | ||
}) | ||
|
||
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) === 'প্রায় ১ মিনিট') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('lessThanXMinutes', 2) === 'প্রায় ২ মিনিট') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('xMinutes', function () { | ||
context('when the count equals 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xMinutes', 1) === '১ মিনিট') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xMinutes', 2) === '২ মিনিট') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('aboutXHours', function () { | ||
context('when the count equals 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('aboutXHours', 1) === 'প্রায় ১ ঘন্টা') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('aboutXHours', 2) === 'প্রায় ২ ঘন্টা') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('xHours', function () { | ||
context('when the count equals 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xHours', 1) === '১ ঘন্টা') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xHours', 2) === '২ ঘন্টা') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('xDays', function () { | ||
context('when the count equals 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xDays', 1) === '১ দিন') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xDays', 2) === '২ দিন') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('aboutXMonths', function () { | ||
context('when the count equals 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('aboutXMonths', 1) === 'প্রায় ১ মাস') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('aboutXMonths', 2) === 'প্রায় ২ মাস') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('xMonths', function () { | ||
context('when the count equals 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xMonths', 1) === '১ মাস') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xMonths', 2) === '২ মাস') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('aboutXYears', function () { | ||
context('when the count equals 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('aboutXYears', 1) === 'প্রায় ১ বছর') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('aboutXYears', 2) === 'প্রায় ২ বছর') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('xYears', function () { | ||
context('when the count equals 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xYears', 1) === '১ বছর') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('xYears', 2) === '২ বছর') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('overXYears', function () { | ||
context('when the count equals 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('overXYears', 1) === '১ বছরের বেশি') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('overXYears', 2) === '২ বছরের বেশি') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('almostXYears', function () { | ||
context('when the count equals 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('almostXYears', 1) === 'প্রায় ১ বছর') | ||
}) | ||
}) | ||
|
||
context('when the count is more than 1', function () { | ||
it('returns a proper string', function () { | ||
assert(formatDistance('almostXYears', 2) === 'প্রায় ২ বছর') | ||
}) | ||
}) | ||
}) | ||
|
||
context('with a past suffix', function () { | ||
it('adds `ago` to a string', function () { | ||
var result = formatDistance('aboutXYears', 1, { | ||
addSuffix: true, | ||
comparison: -1 | ||
}) | ||
assert(result === 'প্রায় ১ বছর আগে') | ||
}) | ||
}) | ||
|
||
context('with a future suffix', function () { | ||
it('adds `in` to a string', function () { | ||
var result = formatDistance('halfAMinute', null, { | ||
addSuffix: true, | ||
comparison: 1 | ||
}) | ||
assert(result === 'আধ মিনিট এর মধ্যে') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index.js' | ||
|
||
var dateFormats = { | ||
full: 'EEEE, MMMM do, y', | ||
long: 'MMMM do, y', | ||
medium: 'MMM d, y', | ||
short: 'MM/dd/yyyy' | ||
} | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] | ||
} |
Oops, something went wrong.