Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Commit

Permalink
Merge branch 'latest' into pullinicons
Browse files Browse the repository at this point in the history
  • Loading branch information
OlgaLyubin authored Sep 20, 2019
2 parents a7f6daf + f47f164 commit adbf74e
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 14 deletions.
11 changes: 6 additions & 5 deletions packages/utilities/psammead-locales/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
| ------- | ----------- |
| 2.13.0 | [PR#2193](https://github.com/bbc/psammead/pull/2193) Create `rw` (Gahuza) and `ti` (Tigrinya) locales |
| 2.12.0 | [PR#2179](https://github.com/bbc/psammead/pull/2179) Create `om` (Afaan Oromoo) and `am` (Amharic) locales |
| 2.11.0 | [PR#2196](https://github.com/bbc/psammead/pull/2196) Create `ha` (Hausa) and `so` (Somali) locales |
| 2.10.0 | [PR#2165](https://github.com/bbc/psammead/pull/2165) Add `ky` (Kyrgyz) locale and update `mr` (Marathi) and `ta` (Tamil) locales |
Expand Down Expand Up @@ -33,9 +34,9 @@
| 1.3.1 | [PR#1803](https://github.com/bbc/psammead/pull/1803/) Patches broken links on badges in documentation |
| 1.3.0 | [PR#1794](https://github.com/bbc/psammead/pull/1794) Add david dependency badges |
| 1.2.2 | [PR#1682](https://github.com/bbc/psammead/pull/1682) Move all dev dependencies to top level package.json |
| 1.2.1 | [PR#1599](https://github.com/bbc/psammead/pull/1599) Bump dependencies |
| 1.2.0 | [PR#1477](https://github.com/bbc/psammead/pull/1477) Add numerals as exports |
| 1.1.0 | [PR#1430](https://github.com/bbc/psammead/pull/1430) Adds some overrides for Yoruba |
| 1.2.1 | [PR#1599](https://github.com/bbc/psammead/pull/1599) Bump dependencies |
| 1.2.0 | [PR#1477](https://github.com/bbc/psammead/pull/1477) Add numerals as exports |
| 1.1.0 | [PR#1430](https://github.com/bbc/psammead/pull/1430) Adds some overrides for Yoruba |
| 1.0.2 | [PR#1365](https://github.com/bbc/psammead/pull/1365) Bump psammead-styles to 1.2.0|
| 1.0.1 | [PR#1181](https://github.com/BBC-News/psammead/pull/1181) use `[email protected]` and `[email protected]` |
| 1.0.0 | [PR#638](https://github.com/BBC-News/psammead/pull/638) Initial creation of package |
| 1.0.1 | [PR#1181](https://github.com/bbc/psammead/pull/1181) use `[email protected]` and `[email protected]` |
| 1.0.0 | [PR#638](https://github.com/bbc/psammead/pull/638) Initial creation of package |
6 changes: 4 additions & 2 deletions packages/utilities/psammead-locales/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ This package provides a collection of locale configs, used in BBC World Service

The following [Moment.js](https://momentjs.com/) locales have been added as they do not exist upstream:

- `/moment/am` - locale override for Amharic
- `/moment/ha` - locale for Hausa
- `/moment/ig` - locale for Igbo
- `/moment/om` - locale override for Afaan Oromoo
- `/moment/pcm` - locale for Pidgin
- `/moment/ps` - locale for Pashto
- `/moment/om` - locale override for Afaan Oromoo
- `/moment/am` - locale override for Amharic
- `/moment/rw` - locale for Gahuza
- `/moment/so` - locale for Somali
- `/moment/ti` - locale for Tigrinya

The following locales have overrides to meet BBC World Service requirements where these differ from the upstream locale. Note that importing them will also cause the upstream locale to be loaded.

Expand Down
14 changes: 9 additions & 5 deletions packages/utilities/psammead-locales/moment/index.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,30 @@ import {
} from '@bbc/gel-foundations/spacings';
import { GEL_FF_REITH_SANS } from '@bbc/gel-foundations/typography';
import notes from '../README.md';
import './am';
import './ar';
import './fa';
import './gu';
import './ha';
import './hi';
import './ig';
import './ky';
import './mr';
import './ne';
import './om';
import './pa-in';
import './pcm';
import './ps';
import './pt-br';
import './ru';
import './rw';
import './so';
import './sr';
import './sr-cyrl';
import './sr';
import './ta';
import './gu';
import './ti';
import './uk';
import './yo';
import './ky';
import './om';
import './am';

const stories = storiesOf('Utilities|Psammead Locales', module);

Expand All @@ -40,6 +42,7 @@ const locales = [
{ name: 'Amharic', locale: 'am' },
{ name: 'Arabic', locale: 'ar' },
{ name: 'Brasil', locale: 'pt-br' },
{ name: 'Gahuza', locale: 'rw' },
{ name: 'Gujarati', locale: 'gu' },
{ name: 'Hausa', locale: 'ha' },
{ name: 'Hindi', locale: 'hi' },
Expand All @@ -57,6 +60,7 @@ const locales = [
{ name: 'Somali', locale: 'so' },
{ name: 'Tamil', locale: 'ta' },
{ name: 'Ukrainian', locale: 'uk' },
{ name: 'Tigrinya', locale: 'ti' },
{ name: 'Yoruba', locale: 'yo' },
];

Expand Down
15 changes: 15 additions & 0 deletions packages/utilities/psammead-locales/moment/rw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var moment = require('moment');

moment.defineLocale('rw', {
months: "Ukwa mbere_Ukwa kabiri_Ukwa gatatu_Ukwa kane_Ukwa gatanu_Ukwa gatandatu_Ukw'indwi_Ukw'umunani_Ukw'icenda_Ukw'icumi_Ukw'icumi na rimwe_Ukw'icumi na kabiri".split(
'_'
),
longDateFormat: { LL: 'D MMMM YYYY' },
relativeTime: {
past: '%s',
m: 'Haciye umunota 1',
mm: 'Iminota %d iraheze',
h: 'Haciye isaha 1',
hh: 'Haciye amasaha %d',
},
});
75 changes: 75 additions & 0 deletions packages/utilities/psammead-locales/moment/rw.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import moment from 'moment';
import './rw';

moment.locale('rw');

// This asset overrides the gunit assertion done in the moment codebase.
// Format and styling of this file has been keep consistent with the official moment tests.
// An example of these tests can be seen at https://github.com/moment/moment/blob/develop/src/test/locale/en-gb.js
const assert = { equal: (val1, val2) => expect(val1).toEqual(val2) };

test('format', function() {
var a = [
['LL', '14 Ukwa kabiri 2010'],
['D MMMM YYYY', '14 Ukwa kabiri 2010'],
],
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
i;
for (i = 0; i < a.length; i++) {
assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
}
});

test('from', function() {
var start = moment([2007, 1, 28]);

assert.equal(
start.from(moment([2007, 1, 28]).add({ s: 45 }), true),
'Haciye umunota 1',
'45 seconds = a minute'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ s: 89 }), true),
'Haciye umunota 1',
'89 seconds = a minute'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ s: 90 }), true),
'Iminota 2 iraheze',
'90 seconds = 2 minutes'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ m: 44 }), true),
'Iminota 44 iraheze',
'44 minutes = 44 minutes'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ m: 45 }), true),
'Haciye isaha 1',
'45 minutes = an hour'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ m: 89 }), true),
'Haciye isaha 1',
'89 minutes = an hour'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ m: 90 }), true),
'Haciye amasaha 2',
'90 minutes = 2 hours'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ h: 5 }), true),
'Haciye amasaha 5',
'5 hours = 5 hours'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ h: 21 }), true),
'Haciye amasaha 21',
'21 hours = 21 hours'
);
});

test('suffix', function() {
assert.equal(moment(0).from(50000), 'Haciye umunota 1', 'suffix');
});
13 changes: 13 additions & 0 deletions packages/utilities/psammead-locales/moment/ti.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var moment = require('moment');

moment.defineLocale('ti', {
months: 'ጥሪ_ለካቲት_መጋቢት_ሚያዝያ_ጉንቦት_ሰነ_ሓምለ_ነሓሰ_መስከረም_ጥቅምቲ_ሕዳር_ታሕሳስ'.split('_'),
longDateFormat: { LL: 'D MMMM YYYY' },
relativeTime: {
past: 'ቅድሚ %s',
m: 'ደቒቕ',
mm: '%d ደቓይቕ',
h: 'ሓደ ሰዓት',
hh: '%d ሰዓታት',
},
});
72 changes: 72 additions & 0 deletions packages/utilities/psammead-locales/moment/ti.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import moment from 'moment';
import './ti';

moment.locale('ti');

// This asset overrides the gunit assertion done in the moment codebase.
// Format and styling of this file has been keep consistent with the official moment tests.
// An example of these tests can be seen at https://github.com/moment/moment/blob/develop/src/test/locale/en-gb.js
const assert = { equal: (val1, val2) => expect(val1).toEqual(val2) };

test('format', function() {
var a = [['LL', '14 ለካቲት 2010'], ['D MMMM YYYY', '14 ለካቲት 2010']],
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
i;
for (i = 0; i < a.length; i++) {
assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
}
});

test('from', function() {
var start = moment([2007, 1, 28]);

assert.equal(
start.from(moment([2007, 1, 28]).add({ s: 45 }), true),
'ደቒቕ',
'45 seconds = a minute'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ s: 89 }), true),
'ደቒቕ',
'89 seconds = a minute'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ s: 90 }), true),
'2 ደቓይቕ',
'90 seconds = 2 minutes'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ m: 44 }), true),
'44 ደቓይቕ',
'44 minutes = 44 minutes'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ m: 45 }), true),
'ሓደ ሰዓት',
'45 minutes = an hour'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ m: 89 }), true),
'ሓደ ሰዓት',
'89 minutes = an hour'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ m: 90 }), true),
'2 ሰዓታት',
'90 minutes = 2 hours'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ h: 5 }), true),
'5 ሰዓታት',
'5 hours = 5 hours'
);
assert.equal(
start.from(moment([2007, 1, 28]).add({ h: 21 }), true),
'21 ሰዓታት',
'21 hours = 21 hours'
);
});

test('suffix', function() {
assert.equal(moment(0).from(50000), 'ቅድሚ ደቒቕ', 'suffix');
});
2 changes: 1 addition & 1 deletion packages/utilities/psammead-locales/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/utilities/psammead-locales/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-locales",
"version": "2.12.0",
"version": "2.13.0",
"description": "A collection of locale configs, used in BBC World Service sites",
"repository": {
"type": "git",
Expand Down

0 comments on commit adbf74e

Please sign in to comment.