Skip to content

Commit

Permalink
Various fixes for ar-SA locale (#948)
Browse files Browse the repository at this point in the history
- Fix test descriptions
- Remove unused code
- Remove redundant code comments
- Fix typings
  • Loading branch information
kossnocorp committed Oct 23, 2018
1 parent 3a169bf commit 71169da
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 49 deletions.
51 changes: 26 additions & 25 deletions src/esm/locale/index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
// This file is generated automatically by `scripts/build/indices.js`. Please, don't change it.

export {default as af} from './af/index.js'
export {default as bn} from './bn/index.js'
export {default as de} from './de/index.js'
export {default as el} from './el/index.js'
export {default as enCA} from './en-CA/index.js'
export {default as enGB} from './en-GB/index.js'
export {default as enUS} from './en-US/index.js'
export {default as eo} from './eo/index.js'
export {default as es} from './es/index.js'
export {default as et} from './et/index.js'
export {default as fr} from './fr/index.js'
export {default as gl} from './gl/index.js'
export {default as he} from './he/index.js'
export {default as hu} from './hu/index.js'
export {default as it} from './it/index.js'
export {default as ja} from './ja/index.js'
export {default as lt} from './lt/index.js'
export {default as nb} from './nb/index.js'
export {default as nl} from './nl/index.js'
export {default as ptBR} from './pt-BR/index.js'
export {default as ru} from './ru/index.js'
export {default as sv} from './sv/index.js'
export {default as uk} from './uk/index.js'
export {default as vi} from './vi/index.js'
export {default as zhCN} from './zh-CN/index.js'
export { default as af } from './af/index.js'
export { default as arSA } from './ar-SA/index.js'
export { default as bn } from './bn/index.js'
export { default as de } from './de/index.js'
export { default as el } from './el/index.js'
export { default as enCA } from './en-CA/index.js'
export { default as enGB } from './en-GB/index.js'
export { default as enUS } from './en-US/index.js'
export { default as eo } from './eo/index.js'
export { default as es } from './es/index.js'
export { default as et } from './et/index.js'
export { default as fr } from './fr/index.js'
export { default as gl } from './gl/index.js'
export { default as he } from './he/index.js'
export { default as hu } from './hu/index.js'
export { default as it } from './it/index.js'
export { default as ja } from './ja/index.js'
export { default as lt } from './lt/index.js'
export { default as nb } from './nb/index.js'
export { default as nl } from './nl/index.js'
export { default as ptBR } from './pt-BR/index.js'
export { default as ru } from './ru/index.js'
export { default as sv } from './sv/index.js'
export { default as uk } from './uk/index.js'
export { default as vi } from './vi/index.js'
export { default as zhCN } from './zh-CN/index.js'
2 changes: 1 addition & 1 deletion src/locale/ar-SA/_lib/formatDistance/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import assert from 'power-assert'
import formatDistance from '.'

describe('sa-AR locale > formatDistance', function() {
describe('ar-SA locale > formatDistance', function() {
describe('lessThanXSeconds', function() {
context('when the count equals 1', function() {
it('returns a proper string', function() {
Expand Down
58 changes: 39 additions & 19 deletions src/locale/ar-SA/_lib/localize/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,51 @@ var quarterValues = {
wide: ['الربع الأول', 'الربع الثاني', 'الربع الثالث', 'الربع الرابع']
}

// prettier-ignore
var monthValues = {
narrow: ['ي', 'ف', 'م', 'أ', 'م', 'ي', 'ي', 'أ', 'س', 'أ', 'ن', 'د'],
abbreviated: ['ينا', 'فبر', 'مارس', 'أبريل', 'مايو', 'يونـ', 'يولـ', 'أغسـ', 'سبتـ', 'أكتـ', 'نوفـ', 'ديسـ'],
wide: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'],
abbreviated: [
'ينا',
'فبر',
'مارس',
'أبريل',
'مايو',
'يونـ',
'يولـ',
'أغسـ',
'سبتـ',
'أكتـ',
'نوفـ',
'ديسـ'
],
wide: [
'يناير',
'فبراير',
'مارس',
'أبريل',
'مايو',
'يونيو',
'يوليو',
'أغسطس',
'سبتمبر',
'أكتوبر',
'نوفمبر',
'ديسمبر'
]
}

// prettier-ignore
var dayValues = {
narrow: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
short: ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'],
abbreviated: ['أحد', 'اثنـ', 'ثلا', 'أربـ', 'خميـ', 'جمعة', 'سبت'],
wide: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت']
abbreviated: ['أحد', 'اثنـ', 'ثلا', 'أربـ', 'خميـ', 'جمعة', 'سبت'],
wide: [
'الأحد',
'الاثنين',
'الثلاثاء',
'الأربعاء',
'الخميس',
'الجمعة',
'السبت'
]
}

var dayPeriodValues = {
Expand Down Expand Up @@ -90,19 +122,7 @@ var formattingDayPeriodValues = {
}
}

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'

function ordinalNumber(dirtyNumber) {
return String(dirtyNumber)
}

Expand Down
1 change: 0 additions & 1 deletion src/locale/ar-SA/_lib/match/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var matchMonthPatterns = {
narrow: /^[يفمأمسند]/i,
abbreviated: /^(ين|ف|مار|أب|ماي|يون|يول|أغ|س|أك|ن|د)/i,
wide: /^(ين|ف|مار|أب|ماي|يون|يول|أغ|س|أك|ن|د)/i
//wide: /^(ين|ف|مار|أب|ماي|يون|يول|أغ|س|أك|ن|د)/i
}
var parseMonthPatterns = {
narrow: [
Expand Down
4 changes: 2 additions & 2 deletions src/locale/ar-SA/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.

import {enUS} from 'date-fns/locale'
export = enUS
import {arSA} from 'date-fns/locale'
export = arSA
2 changes: 1 addition & 1 deletion src/locale/ar-SA/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import formatDistanceStrict from '../../formatDistanceStrict'
import formatRelative from '../../formatRelative'
import parse from '../../parse'

describe('en-US locale', function() {
describe('ar-SA locale', function() {
context('with `format`', function() {
var date = new Date(1986, 3 /* Apr */, 5, 10, 32, 0, 900)

Expand Down
1 change: 1 addition & 0 deletions src/locale/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module.exports = {
af: require('./af/index.js'),
arSA: require('./ar-SA/index.js'),
bn: require('./bn/index.js'),
de: require('./de/index.js'),
el: require('./el/index.js'),
Expand Down
1 change: 1 addition & 0 deletions src/locale/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ declare module.exports: {
af: Locale,
ar: Locale,
arDZ: Locale,
arSA: Locale,
bg: Locale,
bn: Locale,
ca: Locale,
Expand Down
36 changes: 36 additions & 0 deletions typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17257,6 +17257,9 @@ declare module 'date-fns/locale' {
const arDZ: Locale
namespace arDZ {}

const arSA: Locale
namespace arSA {}

const bg: Locale
namespace bg {}

Expand Down Expand Up @@ -17414,6 +17417,11 @@ declare module 'date-fns/locale/ar-DZ' {
export = arDZ
}

declare module 'date-fns/locale/ar-SA' {
import {arSA} from 'date-fns/locale'
export = arSA
}

declare module 'date-fns/locale/bg' {
import {bg} from 'date-fns/locale'
export = bg
Expand Down Expand Up @@ -17664,6 +17672,11 @@ declare module 'date-fns/locale/ar-DZ/index' {
export = arDZ
}

declare module 'date-fns/locale/ar-SA/index' {
import {arSA} from 'date-fns/locale'
export = arSA
}

declare module 'date-fns/locale/bg/index' {
import {bg} from 'date-fns/locale'
export = bg
Expand Down Expand Up @@ -17914,6 +17927,11 @@ declare module 'date-fns/locale/ar-DZ/index.js' {
export = arDZ
}

declare module 'date-fns/locale/ar-SA/index.js' {
import {arSA} from 'date-fns/locale'
export = arSA
}

declare module 'date-fns/locale/bg/index.js' {
import {bg} from 'date-fns/locale'
export = bg
Expand Down Expand Up @@ -18161,6 +18179,9 @@ declare module 'date-fns/esm/locale' {
const arDZ: Locale
namespace arDZ {}

const arSA: Locale
namespace arSA {}

const bg: Locale
namespace bg {}

Expand Down Expand Up @@ -18318,6 +18339,11 @@ declare module 'date-fns/esm/locale/ar-DZ' {
export default arDZ
}

declare module 'date-fns/esm/locale/ar-SA' {
import {arSA} from 'date-fns/esm/locale'
export default arSA
}

declare module 'date-fns/esm/locale/bg' {
import {bg} from 'date-fns/esm/locale'
export default bg
Expand Down Expand Up @@ -18568,6 +18594,11 @@ declare module 'date-fns/esm/locale/ar-DZ/index' {
export default arDZ
}

declare module 'date-fns/esm/locale/ar-SA/index' {
import {arSA} from 'date-fns/esm/locale'
export default arSA
}

declare module 'date-fns/esm/locale/bg/index' {
import {bg} from 'date-fns/esm/locale'
export default bg
Expand Down Expand Up @@ -18818,6 +18849,11 @@ declare module 'date-fns/esm/locale/ar-DZ/index.js' {
export default arDZ
}

declare module 'date-fns/esm/locale/ar-SA/index.js' {
import {arSA} from 'date-fns/esm/locale'
export default arSA
}

declare module 'date-fns/esm/locale/bg/index.js' {
import {bg} from 'date-fns/esm/locale'
export default bg
Expand Down

0 comments on commit 71169da

Please sign in to comment.