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

Fixes for Scottish Gaelic locale issues #1914

Merged
merged 1 commit into from
Aug 27, 2020
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
22 changes: 18 additions & 4 deletions src/locale/gd/_lib/formatDistance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var formatDistanceLocale = {

xSeconds: {
one: '1 diog',
two: '2 dhiog',
twenty: '20 diog',
other: '{{count}} diogan'
},

Expand All @@ -18,6 +20,8 @@ var formatDistanceLocale = {

xMinutes: {
one: '1 mionaid',
two: '2 mhionaid',
twenty: '20 mionaid',
other: '{{count}} mionaidean'
},

Expand All @@ -27,13 +31,15 @@ var formatDistanceLocale = {
},

xHours: {
one: '1 uair',
one: '1 uair de thìde',
two: '2 uair de thìde',
twenty: '20 uair de thìde',
other: '{{count}} uairean de thìde'
},

xDays: {
one: '1 latha',
other: '{{count}} làithean'
one: '1 ',
other: '{{count}} '
},

aboutXWeeks: {
Expand Down Expand Up @@ -85,6 +91,14 @@ export default function formatDistance(token, count, options) {
result = formatDistanceLocale[token]
} else if (count === 1) {
result = formatDistanceLocale[token].one
} else if (count === 2 && !!formatDistanceLocale[token].two) {
result = formatDistanceLocale[token].two
} else if (count === 9 && !!formatDistanceLocale[token].nine) {
result = formatDistanceLocale[token].nine
} else if (count === 20 && !!formatDistanceLocale[token].twenty) {
result = formatDistanceLocale[token].twenty
} else if (count === 30 && !!formatDistanceLocale[token].thirty) {
result = formatDistanceLocale[token].thirty
} else {
result = formatDistanceLocale[token].other.replace('{{count}}', count)
}
Expand All @@ -93,7 +107,7 @@ export default function formatDistance(token, count, options) {
if (options.comparison > 0) {
return 'ann an ' + result
} else {
return result + ' o chionn'
return ' o chionn' + result
}
}

Expand Down
9 changes: 6 additions & 3 deletions src/locale/gd/_lib/localize/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,16 @@ function ordinalNumber(dirtyNumber, _dirtyOptions) {
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
return number + 'cd'
return number + 'd'
case 2:
return number + 'na'
case 3:
return number + 'tr'
}
}

if (rem100 === 12) {
return number + 'na'
}

return number + 'mh'
}

Expand Down
2 changes: 1 addition & 1 deletion src/locale/gd/_lib/match/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import buildMatchPatternFn from '../../../_lib/buildMatchPatternFn/index.js'
import buildMatchFn from '../../../_lib/buildMatchFn/index.js'

var matchOrdinalNumberPattern = /^(\d+)(cd|na|tr|mh)?/i
var matchOrdinalNumberPattern = /^(\d+)(d|na|tr|mh)?/i
var parseOrdinalNumberPattern = /\d+/i

var matchEraPatterns = {
Expand Down