Added compact translations for date duration
This commit is contained in:
@@ -30,9 +30,7 @@ const eventDetails = ref<HTMLElement>()
|
|||||||
const emit = defineEmits(["query:close-popover"])
|
const emit = defineEmits(["query:close-popover"])
|
||||||
|
|
||||||
const dateDifference: string = getRelativeString(defaultDate, props.event.startDate)
|
const dateDifference: string = getRelativeString(defaultDate, props.event.startDate)
|
||||||
const dateDuration: string | null = props.event.endDate
|
const dateDuration = computed<string | null>(() => props.event.endDate ? getRelativeString(props.event.startDate, props.event.endDate, "compact") : null)
|
||||||
? getRelativeString(props.event.startDate, props.event.endDate, "compact")
|
|
||||||
: null
|
|
||||||
|
|
||||||
function handleJumpToDate(date: RPGDate) {
|
function handleJumpToDate(date: RPGDate) {
|
||||||
jumpToDate(date)
|
jumpToDate(date)
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ defineEmits<{
|
|||||||
const { getRelativeString, defaultDate, getFormattedDateTitle } = useCalendar()
|
const { getRelativeString, defaultDate, getFormattedDateTitle } = useCalendar()
|
||||||
|
|
||||||
const dateDifference: string = getRelativeString(defaultDate, props.event.startDate)
|
const dateDifference: string = getRelativeString(defaultDate, props.event.startDate)
|
||||||
const dateDuration: string | null = props.event.endDate
|
const dateDuration = computed<string | null>(() => props.event.endDate ? getRelativeString(props.event.startDate, props.event.endDate, "compact") : null)
|
||||||
? getRelativeString(props.event.startDate, props.event.endDate, "compact")
|
|
||||||
: null
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -70,10 +70,18 @@ export default defineI18nConfig(() => ({
|
|||||||
xMonthsNext: "In {months} month(s)",
|
xMonthsNext: "In {months} month(s)",
|
||||||
xYearsNext: "In {years} year(s)",
|
xYearsNext: "In {years} year(s)",
|
||||||
xYearsAndMonthsNext: "In {years} year(s) and {months} month(s)",
|
xYearsAndMonthsNext: "In {years} year(s) and {months} month(s)",
|
||||||
|
xDaysNextCompact: "{days} days",
|
||||||
|
xMonthsNextCompact: "{months} month(s)",
|
||||||
|
xYearsNextCompact: "{years} year(s)",
|
||||||
|
xYearsAndMonthsNextCompact: "{years} year(s) and {months} month(s)",
|
||||||
xDaysAgo: "{days} days ago",
|
xDaysAgo: "{days} days ago",
|
||||||
xMonthsAgo: "{months} month(s) ago",
|
xMonthsAgo: "{months} month(s) ago",
|
||||||
xYearsAgo: "{years} year(s) ago",
|
xYearsAgo: "{years} year(s) ago",
|
||||||
xYearsAndMonthsAgo: "{years} year(s) and {months} month(s) ago",
|
xYearsAndMonthsAgo: "{years} year(s) and {months} month(s) ago",
|
||||||
|
xDaysAgoCompact: "{days} days",
|
||||||
|
xMonthsAgoCompact: "{months} month(s)",
|
||||||
|
xYearsAgoCompact: "{years} year(s)",
|
||||||
|
xYearsAndMonthsAgoCompact: "{years} year(s) and {months} month(s)",
|
||||||
},
|
},
|
||||||
event: {
|
event: {
|
||||||
nameSingular: "Event",
|
nameSingular: "Event",
|
||||||
@@ -222,10 +230,18 @@ export default defineI18nConfig(() => ({
|
|||||||
xMonthsNext: "Dans {months} mois",
|
xMonthsNext: "Dans {months} mois",
|
||||||
xYearsNext: "Dans {years} an(s)",
|
xYearsNext: "Dans {years} an(s)",
|
||||||
xYearsAndMonthsNext: "Dans {years} an(s) et {months} mois",
|
xYearsAndMonthsNext: "Dans {years} an(s) et {months} mois",
|
||||||
|
xDaysNextCompact: "{days} jours",
|
||||||
|
xMonthsNextCompact: "{months} mois",
|
||||||
|
xYearsNextCompact: "{years} an(s)",
|
||||||
|
xYearsAndMonthsNextCompact: "{years} an(s) et {months} mois",
|
||||||
xDaysAgo: "Il y a {days} jours",
|
xDaysAgo: "Il y a {days} jours",
|
||||||
xMonthsAgo: "Il y a {months} mois",
|
xMonthsAgo: "Il y a {months} mois",
|
||||||
xYearsAgo: "Il y a {years} an(s)",
|
xYearsAgo: "Il y a {years} an(s)",
|
||||||
xYearsAndMonthsAgo: "Il y a {years} an(s) et {months} mois",
|
xYearsAndMonthsAgo: "Il y a {years} an(s) et {months} mois",
|
||||||
|
xDaysAgoCompact: "{days} jours",
|
||||||
|
xMonthsAgoCompact: "{months} mois",
|
||||||
|
xYearsAgoCompact: "{years} an(s)",
|
||||||
|
xYearsAndMonthsAgoCompact: "{years} an(s) et {months} mois",
|
||||||
},
|
},
|
||||||
event: {
|
event: {
|
||||||
nameSingular: "Évènement",
|
nameSingular: "Évènement",
|
||||||
|
|||||||
@@ -496,12 +496,24 @@ export const useCalendar = defineStore("calendar", () => {
|
|||||||
years: "xYearsNext",
|
years: "xYearsNext",
|
||||||
yearsAndMonths: "xYearsAndMonthsNext",
|
yearsAndMonths: "xYearsAndMonthsNext",
|
||||||
}
|
}
|
||||||
|
const futureKeysCompact: DateDirectionTranslationKeys = {
|
||||||
|
days: "xDaysNextCompact",
|
||||||
|
months: "xMonthsNextCompact",
|
||||||
|
years: "xYearsNextCompact",
|
||||||
|
yearsAndMonths: "xYearsAndMonthsNextCompact",
|
||||||
|
}
|
||||||
const pastKeys: DateDirectionTranslationKeys = {
|
const pastKeys: DateDirectionTranslationKeys = {
|
||||||
days: "xDaysAgo",
|
days: "xDaysAgo",
|
||||||
months: "xMonthsAgo",
|
months: "xMonthsAgo",
|
||||||
years: "xYearsAgo",
|
years: "xYearsAgo",
|
||||||
yearsAndMonths: "xYearsAndMonthsAgo",
|
yearsAndMonths: "xYearsAndMonthsAgo",
|
||||||
}
|
}
|
||||||
|
const pastKeysCompact: DateDirectionTranslationKeys = {
|
||||||
|
days: "xDaysAgoCompact",
|
||||||
|
months: "xMonthsAgoCompact",
|
||||||
|
years: "xYearsAgoCompact",
|
||||||
|
yearsAndMonths: "xYearsAndMonthsAgoCompact",
|
||||||
|
}
|
||||||
let directionKeys: DateDirectionTranslationKeys = pastKeys
|
let directionKeys: DateDirectionTranslationKeys = pastKeys
|
||||||
|
|
||||||
// Check whether it's a past or future date
|
// Check whether it's a past or future date
|
||||||
@@ -535,6 +547,13 @@ export const useCalendar = defineStore("calendar", () => {
|
|||||||
} else {
|
} else {
|
||||||
directionKeys = pastKeys
|
directionKeys = pastKeys
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Get relevant prefix for the string (without the prefix)
|
||||||
|
if (direction === "future") {
|
||||||
|
directionKeys = futureKeysCompact
|
||||||
|
} else {
|
||||||
|
directionKeys = pastKeysCompact
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isSameMonth = baseDate.month === relativeDate.month
|
const isSameMonth = baseDate.month === relativeDate.month
|
||||||
|
|||||||
Reference in New Issue
Block a user