Skip to content

Commit

Permalink
Add Bosnian locale (#2495)
Browse files Browse the repository at this point in the history
Added Bosnian locale (bs).
  • Loading branch information
BranislavLazic committed Jul 23, 2021
1 parent 8253a20 commit dd71970
Show file tree
Hide file tree
Showing 12 changed files with 1,023 additions and 0 deletions.
191 changes: 191 additions & 0 deletions src/locale/bs/_lib/formatDistance/index.js
@@ -0,0 +1,191 @@
var formatDistanceLocale = {
lessThanXSeconds: {
one: {
standalone: 'manje od 1 sekunde',
withPrepositionAgo: 'manje od 1 sekunde',
withPrepositionIn: 'manje od 1 sekundu',
},
dual: 'manje od {{count}} sekunde',
other: 'manje od {{count}} sekundi',
},

xSeconds: {
one: {
standalone: '1 sekunda',
withPrepositionAgo: '1 sekunde',
withPrepositionIn: '1 sekundu',
},
dual: '{{count}} sekunde',
other: '{{count}} sekundi',
},

halfAMinute: 'pola minute',

lessThanXMinutes: {
one: {
standalone: 'manje od 1 minute',
withPrepositionAgo: 'manje od 1 minute',
withPrepositionIn: 'manje od 1 minutu',
},
dual: 'manje od {{count}} minute',
other: 'manje od {{count}} minuta',
},

xMinutes: {
one: {
standalone: '1 minuta',
withPrepositionAgo: '1 minute',
withPrepositionIn: '1 minutu',
},
dual: '{{count}} minute',
other: '{{count}} minuta',
},

aboutXHours: {
one: {
standalone: 'oko 1 sat',
withPrepositionAgo: 'oko 1 sat',
withPrepositionIn: 'oko 1 sat',
},
dual: 'oko {{count}} sata',
other: 'oko {{count}} sati',
},

xHours: {
one: {
standalone: '1 sat',
withPrepositionAgo: '1 sat',
withPrepositionIn: '1 sat',
},
dual: '{{count}} sata',
other: '{{count}} sati',
},

xDays: {
one: {
standalone: '1 dan',
withPrepositionAgo: '1 dan',
withPrepositionIn: '1 dan',
},
dual: '{{count}} dana',
other: '{{count}} dana',
},

aboutXWeeks: {
one: {
standalone: 'oko 1 sedmicu',
withPrepositionAgo: 'oko 1 sedmicu',
withPrepositionIn: 'oko 1 sedmicu',
},
dual: 'oko {{count}} sedmice',
other: 'oko {{count}} sedmice',
},

xWeeks: {
one: {
standalone: '1 sedmicu',
withPrepositionAgo: '1 sedmicu',
withPrepositionIn: '1 sedmicu',
},
dual: '{{count}} sedmice',
other: '{{count}} sedmice',
},

aboutXMonths: {
one: {
standalone: 'oko 1 mjesec',
withPrepositionAgo: 'oko 1 mjesec',
withPrepositionIn: 'oko 1 mjesec',
},
dual: 'oko {{count}} mjeseca',
other: 'oko {{count}} mjeseci',
},

xMonths: {
one: {
standalone: '1 mjesec',
withPrepositionAgo: '1 mjesec',
withPrepositionIn: '1 mjesec',
},
dual: '{{count}} mjeseca',
other: '{{count}} mjeseci',
},

aboutXYears: {
one: {
standalone: 'oko 1 godinu',
withPrepositionAgo: 'oko 1 godinu',
withPrepositionIn: 'oko 1 godinu',
},
dual: 'oko {{count}} godine',
other: 'oko {{count}} godina',
},

xYears: {
one: {
standalone: '1 godina',
withPrepositionAgo: '1 godine',
withPrepositionIn: '1 godinu',
},
dual: '{{count}} godine',
other: '{{count}} godina',
},

overXYears: {
one: {
standalone: 'preko 1 godinu',
withPrepositionAgo: 'preko 1 godinu',
withPrepositionIn: 'preko 1 godinu',
},
dual: 'preko {{count}} godine',
other: 'preko {{count}} godina',
},

almostXYears: {
one: {
standalone: 'gotovo 1 godinu',
withPrepositionAgo: 'gotovo 1 godinu',
withPrepositionIn: 'gotovo 1 godinu',
},
dual: 'gotovo {{count}} godine',
other: 'gotovo {{count}} godina',
},
}

export default function formatDistance(token, count, options) {
options = options || {}

var result

if (typeof formatDistanceLocale[token] === 'string') {
result = formatDistanceLocale[token]
} else if (count === 1) {
if (options.addSuffix) {
if (options.comparison > 0) {
result = formatDistanceLocale[token].one.withPrepositionIn
} else {
result = formatDistanceLocale[token].one.withPrepositionAgo
}
} else {
result = formatDistanceLocale[token].one.standalone
}
} else if (
count % 10 > 1 &&
count % 10 < 5 && // if last digit is between 2 and 4
String(count).substr(-2, 1) !== '1' // unless the 2nd to last digit is "1"
) {
result = formatDistanceLocale[token].dual.replace('{{count}}', count)
} else {
result = formatDistanceLocale[token].other.replace('{{count}}', count)
}

if (options.addSuffix) {
if (options.comparison > 0) {
return 'za ' + result
} else {
return 'prije ' + result
}
}

return result
}
39 changes: 39 additions & 0 deletions src/locale/bs/_lib/formatLong/index.js
@@ -0,0 +1,39 @@
import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index'

var dateFormats = {
full: 'EEEE, d. MMMM yyyy.',
long: 'd. MMMM yyyy.',
medium: 'd. MMM yy.',
short: 'dd. MM. yy.',
}

var timeFormats = {
full: 'HH:mm:ss (zzzz)',
long: 'HH:mm:ss z',
medium: 'HH:mm:ss',
short: 'HH:mm',
}

var dateTimeFormats = {
full: "{{date}} 'u' {{time}}",
long: "{{date}} 'u' {{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
44 changes: 44 additions & 0 deletions src/locale/bs/_lib/formatRelative/index.js
@@ -0,0 +1,44 @@
var formatRelativeLocale = {
lastWeek: function (date) {
var day = date.getUTCDay()

switch (day) {
case 0:
return "'prošle nedjelje u' p"
case 3:
return "'prošle srijede u' p"
case 6:
return "'prošle subote u' p"
default:
return "'prošli' EEEE 'u' p"
}
},
yesterday: "'juče u' p",
today: "'danas u' p",
tomorrow: "'sutra u' p",
nextWeek: function (date) {
var day = date.getUTCDay()

switch (day) {
case 0:
return "'sljedeće nedjelje u' p"
case 3:
return "'sljedeću srijedu u' p"
case 6:
return "'sljedeću subotu u' p"
default:
return "'sljedeći' EEEE 'u' p"
}
},
other: 'P',
}

export default function formatRelative(token, date, _baseDate, _options) {
var format = formatRelativeLocale[token]

if (typeof format === 'function') {
return format(date)
}

return format
}

0 comments on commit dd71970

Please sign in to comment.