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

Enable Georgian locale support #1261

Merged
merged 5 commits into from Jul 23, 2019
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
1 change: 0 additions & 1 deletion outdatedLocales.json
Expand Up @@ -5,7 +5,6 @@
"fil",
"fr-CH",
"hr",
"ka",
"mk",
"ms",
"nl-BE",
Expand Down
1 change: 1 addition & 0 deletions src/locale/index.js
Expand Up @@ -26,6 +26,7 @@ export { default as id } from './id/index.js'
export { default as is } from './is/index.js'
export { default as it } from './it/index.js'
export { default as ja } from './ja/index.js'
export { default as ka } from './ka/index.js'
export { default as ko } from './ko/index.js'
export { default as lt } from './lt/index.js'
export { default as lv } from './lv/index.js'
Expand Down
45 changes: 37 additions & 8 deletions src/locale/ka/_lib/formatLong/index.js
@@ -1,12 +1,41 @@
import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index.js'

var formatLong = buildFormatLongFn({
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd, D MMMM YYYY HH:mm'
})
var dateFormats = {
full: 'EEEE, do MMMM, y',
long: 'do, MMMM, y',
medium: 'd, MMM, y',
short: 'dd/MM/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
10 changes: 5 additions & 5 deletions src/locale/ka/_lib/formatRelative/index.js
@@ -1,9 +1,9 @@
var formatRelativeLocale = {
lastWeek: '[წინა] dddd LT[-ზე]',
yesterday: '[გუშინ] LT[-ზე]',
today: '[დღეს] LT[-ზე]',
tomorrow: '[ხვალ] LT[-ზე]',
nextWeek: '[შემდეგი] dddd LT[-ზე]',
lastWeek: "'წინა' eeee LT'-ზე'",
yesterday: "'გუშინ' LT'-ზე'",
today: "'დღეს' LT'-ზე'",
tomorrow: "'ხვალ' LT'-ზე'",
nextWeek: "'შემდეგი' eeee LT'-ზე'",
other: 'L'
}

Expand Down
192 changes: 137 additions & 55 deletions src/locale/ka/_lib/localize/index.js
@@ -1,26 +1,37 @@
import buildLocalizeArrayFn from '../../../_lib/buildLocalizeArrayFn/index.js'
import buildLocalizeFn from '../../../_lib/buildLocalizeFn/index.js'

var eraValues = {
narrow: ['ჩ.წ-მდე', 'ჩ.წ'],
abbreviated: ['ჩვ.წ-მდე', 'ჩვ.წ'],
wide: ['ჩვენს წელთაღრიცხვამდე', 'ჩვენი წელთაღრიცხვით']
}

var quarterValues = {
narrow: ['1', '2', '3', '4'],
abbreviated: ['1-ლი კვ', '2-ე კვ', '3-ე კვ', '4-ე კვ'],
wide: ['1-ლი კვარტალი', '2-ე კვარტალი', '3-ე კვარტალი', '4-ე კვარტალი']
}

// Note: in English, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
var weekdayValues = {
narrow: ['კვ', 'ორ', 'სა', 'ოთ', 'ხუ', 'პა', 'შა'],
short: ['კვი', 'ორშ', 'სამ', 'ოთხ', 'ხუთ', 'პარ', 'შაბ'],
long: [
'კვირა',
'ორშაბათი',
'სამშაბათი',
'ოთხშაბათი',
'ხუთშაბათი',
'პარასკევი',
'შაბათი'
]
}

var monthValues = {
short: [
narrow: [
'ია',
'თე',
'მა',
'აპ',
'მს',
'ვნ',
'ვლ',
'აგ',
'სე',
'ოქ',
'ნო',
'დე'
],
abbreviated: [
'იან',
'თებ',
'მარ',
Expand All @@ -34,7 +45,7 @@ var monthValues = {
'ნოე',
'დეკ'
],
long: [
wide: [
'იანვარი',
'თებერვალი',
'მარტი',
Expand All @@ -50,35 +61,84 @@ var monthValues = {
]
}

// `timeOfDay` is used to designate which part of the day it is, when used with 12-hour clock.
// Use the system which is used the most commonly in the locale.
// For example, if the country doesn't use a.m./p.m., you can use `night`/`morning`/`afternoon`/`evening`:
//
// var timeOfDayValues = {
// any: ['in the night', 'in the morning', 'in the afternoon', 'in the evening']
// }
//
// And later:
//
// var localize = {
// // The callback takes the hours as the argument and returns the array index
// timeOfDay: buildLocalizeFn(timeOfDayValues, 'any', function (hours) {
// if (hours >= 17) {
// return 3
// } else if (hours >= 12) {
// return 2
// } else if (hours >= 4) {
// return 1
// } else {
// return 0
// }
// }),
// timesOfDay: buildLocalizeArrayFn(timeOfDayValues, 'any')
// }
var timeOfDayValues = {
uppercase: ['AM', 'PM'],
lowercase: ['am', 'pm'],
long: ['a.m.', 'p.m.']
var dayValues = {
narrow: ['კვ', 'ორ', 'სა', 'ოთ', 'ხუ', 'პა', 'შა'],
short: ['კვი', 'ორშ', 'სამ', 'ოთხ', 'ხუთ', 'პარ', 'შაბ'],
abbreviated: ['კვი', 'ორშ', 'სამ', 'ოთხ', 'ხუთ', 'პარ', 'შაბ'],
wide: [
'კვირა',
'ორშაბათი',
'სამშაბათი',
'ოთხშაბათი',
'ხუთშაბათი',
'პარასკევი',
'შაბათი'
]
}

var dayPeriodValues = {
narrow: {
am: 'a',
pm: 'p',
midnight: 'შუაღამე',
noon: 'შუადღე',
morning: 'დილა',
afternoon: 'საღამო',
evening: 'საღამო',
night: 'ღამე'
},
abbreviated: {
am: 'AM',
pm: 'PM',
midnight: 'შუაღამე',
noon: 'შუადღე',
morning: 'დილა',
afternoon: 'საღამო',
evening: 'საღამო',
night: 'ღამე'
},
wide: {
am: 'a.m.',
pm: 'p.m.',
midnight: 'შუაღამე',
noon: 'შუადღე',
morning: 'დილა',
afternoon: 'საღამო',
evening: 'საღამო',
night: 'ღამე'
}
}
var formattingDayPeriodValues = {
narrow: {
am: 'a',
pm: 'p',
midnight: 'შუაღამით',
noon: 'შუადღისას',
morning: 'დილით',
afternoon: 'ნაშუადღევს',
evening: 'საღამოს',
night: 'ღამით'
},
abbreviated: {
am: 'AM',
pm: 'PM',
midnight: 'შუაღამით',
noon: 'შუადღისას',
morning: 'დილით',
afternoon: 'ნაშუადღევს',
evening: 'საღამოს',
night: 'ღამით'
},
wide: {
am: 'a.m.',
pm: 'p.m.',
midnight: 'შუაღამით',
noon: 'შუადღისას',
morning: 'დილით',
afternoon: 'ნაშუადღევს',
evening: 'საღამოს',
night: 'ღამით'
}
}

function ordinalNumber(dirtyNumber, _dirtyOptions) {
Expand All @@ -91,8 +151,8 @@ function ordinalNumber(dirtyNumber, _dirtyOptions) {
// var options = dirtyOptions || {}
// var unit = String(options.unit)
//
// where `unit` can be 'month', 'quarter', 'week', 'isoWeek', 'dayOfYear',
// 'dayOfMonth' or 'dayOfWeek'
// where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
// 'day', 'hour', 'minute', 'second'

if (number === 1) {
return number + '-ლი'
Expand All @@ -103,14 +163,36 @@ function ordinalNumber(dirtyNumber, _dirtyOptions) {

var localize = {
ordinalNumber: ordinalNumber,
weekday: buildLocalizeFn(weekdayValues, 'long'),
weekdays: buildLocalizeArrayFn(weekdayValues, 'long'),
month: buildLocalizeFn(monthValues, 'long'),
months: buildLocalizeArrayFn(monthValues, 'long'),
timeOfDay: buildLocalizeFn(timeOfDayValues, 'long', function(hours) {
return hours / 12 >= 1 ? 1 : 0

era: buildLocalizeFn({
values: eraValues,
defaultWidth: 'wide'
}),

quarter: buildLocalizeFn({
values: quarterValues,
defaultWidth: 'wide',
argumentCallback: function(quarter) {
return Number(quarter) - 1
}
}),
timesOfDay: buildLocalizeArrayFn(timeOfDayValues, 'long')

month: buildLocalizeFn({
values: monthValues,
defaultWidth: 'wide'
}),

day: buildLocalizeFn({
values: dayValues,
defaultWidth: 'wide'
}),

dayPeriod: buildLocalizeFn({
values: dayPeriodValues,
defaultWidth: 'wide',
formattingValues: formattingDayPeriodValues,
defaultFormattingWidth: 'wide'
})
}

export default localize