use nextcloud-l10n whereever possible

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
Georg Ehrke 2019-10-09 08:58:53 +02:00
parent aec15a5f71
commit 7298ae58fe
No known key found for this signature in database
GPG Key ID: 9D98FD9380A1CB43
26 changed files with 116 additions and 113 deletions

View File

@ -7,8 +7,6 @@ module.exports = {
jest: true
},
globals: {
t: true,
n: true,
OC: true,
OCA: true,
OCP: true,

View File

@ -103,7 +103,7 @@ export default {
})
.catch((error) => {
console.error(error)
OC.Notification.showTemporary(t('calendar', 'An error occurred, unable to create the calendar.'))
OC.Notification.showTemporary(this.$t('calendar', 'An error occurred, unable to create the calendar.'))
this.isCreating = false
})
},

View File

@ -116,7 +116,7 @@ export default {
})
.catch((error) => {
console.error(error)
OC.Notification.showTemporary(t('calendar', 'An error occurred, unable to create the calendar.'))
OC.Notification.showTemporary(this.$t('calendar', 'An error occurred, unable to create the calendar.'))
this.isCreating = false
})
},

View File

@ -50,10 +50,10 @@ export default {
computed: {
options() {
return [{
'label': t('calendar', 'before'),
'label': this.$t('calendar', 'before'),
'type': 'before',
}, {
'label': t('calendar', 'after'),
'label': this.$t('calendar', 'after'),
'type': 'after'
}]
},

View File

@ -59,7 +59,7 @@ export default {
: defaultAlarms.timedEvents
options.push({
label: t('calendar', 'Custom'),
label: this.$t('calendar', 'Custom'),
trigger: 'custom'
})

View File

@ -50,10 +50,10 @@ export default {
computed: {
options() {
return [{
'label': t('calendar', 'before'),
'label': this.$t('calendar', 'before'),
'related': 'start',
}, {
'label': t('calendar', 'after'),
'label': this.$t('calendar', 'after'),
'related': 'end'
}]
},

View File

@ -61,28 +61,28 @@ export default {
if (this.unit === 'seconds') {
options.push({
'label': n('calendar', 'second', 'seconds', this.count),
'label': this.$n('calendar', 'second', 'seconds', this.count),
'unit': 'seconds'
})
}
if (!this.isAllDay || ['minutes', 'hours'].indexOf(this.unit) !== -1) {
options.push({
'label': n('calendar', 'minute', 'minutes', this.count),
'label': this.$n('calendar', 'minute', 'minutes', this.count),
'unit': 'minutes'
})
options.push({
'label': n('calendar', 'hour', 'hours', this.count),
'label': this.$n('calendar', 'hour', 'hours', this.count),
'unit': 'hours'
})
}
options.push({
'label': n('calendar', 'day', 'days', this.count),
'label': this.$n('calendar', 'day', 'days', this.count),
'unit': 'days'
})
options.push({
'label': n('calendar', 'week', 'weeks', this.count),
'label': this.$n('calendar', 'week', 'weeks', this.count),
'unit': 'weeks'
})

View File

@ -50,16 +50,16 @@ export default {
computed: {
options() {
const options = [{
'label': t('calendar', 'Notification'),
'label': this.$t('calendar', 'Notification'),
'type': 'DISPLAY'
}, {
'label': t('calendar', 'E-Mail'),
'label': this.$t('calendar', 'E-Mail'),
'type': 'EMAIL'
}]
if (this.alarmType === 'AUDIO') {
options.push({
label: t('calendar', 'Audio notification'),
label: this.$t('calendar', 'Audio notification'),
type: 'AUDIO'
})
}

View File

@ -73,46 +73,46 @@ export default {
}
if (this.participationStatus === 'ACCEPTED' && this.isViewedByOrganizer) {
return t('calendar', '{name} accepted your invitation.', {
return this.$t('calendar', '{name} accepted your invitation.', {
name: this.commonName
})
}
if (this.participationStatus === 'ACCEPTED' && !this.isViewedByOrganizer) {
return t('calendar', '{name} accepted {organizerName}\'s invitation.', {
return this.$t('calendar', '{name} accepted {organizerName}\'s invitation.', {
name: this.commonName,
organizerName: this.organizerDisplayName
})
}
if (this.participationStatus === 'DECLINED' && this.isViewedByOrganizer) {
return t('calendar', '{name} declined your invitation.', {
return this.$t('calendar', '{name} declined your invitation.', {
name: this.commonName
})
}
if (this.participationStatus === 'DECLINED' && !this.isViewedByOrganizer) {
return t('calendar', '{name} declined {organizerName}\'s invitation.', {
return this.$t('calendar', '{name} declined {organizerName}\'s invitation.', {
name: this.commonName,
organizerName: this.organizerDisplayName
})
}
if (this.participationStatus === 'DELEGATED') {
return t('calendar', '{name} has delegated their invitation.', {
return this.$t('calendar', '{name} has delegated their invitation.', {
name: this.commonName
})
}
if (this.participationStatus === 'TENTATIVE') {
return t('calendar', '{name} marked their participation as tentative.', {
return this.$t('calendar', '{name} marked their participation as tentative.', {
name: this.commonName
})
}
if (this.isViewedByOrganizer) {
return t('calendar', '{name} did not respond to your invitation yet.', {
return this.$t('calendar', '{name} did not respond to your invitation yet.', {
name: this.commonName
})
} else {
return t('calendar', '{name} did not respond to {organizerName}\'s invitation yet.', {
return this.$t('calendar', '{name} did not respond to {organizerName}\'s invitation yet.', {
name: this.commonName,
organizerName: this.organizerDisplayName
})

View File

@ -73,10 +73,10 @@ export default {
},
computed: {
placeholder() {
return t('calendar', 'Search for e-mails, users, contacts, resources or rooms')
return this.$t('calendar', 'Search for e-mails, users, contacts, resources or rooms')
},
noResult() {
return t('calendar', 'No match found')
return this.$t('calendar', 'No match found')
}
},
methods: {

View File

@ -147,7 +147,7 @@ export default {
},
computed: {
allDayLabel() {
return t('calendar', 'All day')
return this.$t('calendar', 'All day')
},
allDayTooltip() {
if (this.canModifyAllDay) {
@ -157,15 +157,15 @@ export default {
return null
}
return t('calendar', 'Can not modify all-day setting for events that are part of a recurrence-set.')
return this.$t('calendar', 'Can not modify all-day setting for events that are part of a recurrence-set.')
},
showTimezonesLabel() {
return this.showTimezones
? t('calendar', 'Hide timezones')
: t('canledar', 'Show timezones')
? this.$t('calendar', 'Hide timezones')
: this.$t('canledar', 'Show timezones')
},
toLabel() {
return t('calendar', 'to')
return this.$t('calendar', 'to')
},
timeFormat() {
if (this.isAllDay) {

View File

@ -80,28 +80,28 @@ export default {
},
computed: {
endRepeatLabel() {
return t('calendar', 'End repeat ...')
return this.$t('calendar', 'End repeat ...')
},
isNeverSelected() {
return this.count === null && this.until === null
},
neverLabel() {
return t('calendar', 'Never')
return this.$t('calendar', 'Never')
},
isOnSelected() {
return this.until !== null
},
onLabel() {
return t('calendar', 'On')
return this.$t('calendar', 'On')
},
isAfterSelected() {
return this.count !== null
},
afterLabel() {
return t('calendar', 'After')
return this.$t('calendar', 'After')
},
occurrencesLabel() {
return n('calendar', 'count', 'counts', this.count)
return this.$n('calendar', 'count', 'counts', this.count)
},
maxCount() {
// This is also the limit that we currently enforce in the server,

View File

@ -45,25 +45,25 @@ export default {
computed: {
options() {
return [{
label: t('calendar', 'first'),
label: this.$t('calendar', 'first'),
value: 1
}, {
label: t('calendar', 'second'),
label: this.$t('calendar', 'second'),
value: 2
}, {
label: t('calendar', 'third'),
label: this.$t('calendar', 'third'),
value: 3
}, {
label: t('calendar', 'fourth'),
label: this.$t('calendar', 'fourth'),
value: 4
}, {
label: t('calendar', 'fifth'),
label: this.$t('calendar', 'fifth'),
value: 5
}, {
label: t('calendar', 'second to last'),
label: this.$t('calendar', 'second to last'),
value: -2
}, {
label: t('calendar', 'last'),
label: this.$t('calendar', 'last'),
value: -1
}]
},

View File

@ -29,7 +29,7 @@ export default {
name: 'RepeatForkWarning',
computed: {
forkWarningLabel() {
return t('calendar', 'Your change will only apply to all future occurrences of the event.')
return this.$t('calendar', 'Your change will only apply to all future occurrences of the event.')
}
}
}

View File

@ -63,10 +63,10 @@ export default {
computed: {
repeatEveryLabel() {
if (this.frequency === 'NONE') {
return t('calendar', 'Repeat')
return this.$t('calendar', 'Repeat')
}
return t('calendar', 'Repeat every')
return this.$t('calendar', 'Repeat every')
},
isIntervalDisabled() {
return this.frequency === 'NONE'

View File

@ -54,19 +54,19 @@ export default {
computed: {
options() {
return [{
'label': t('calendar', 'never'),
'label': this.$t('calendar', 'never'),
'freq': 'NONE'
}, {
'label': n('calendar', 'day', 'days', this.count),
'label': this.$n('calendar', 'day', 'days', this.count),
'freq': 'DAILY'
}, {
'label': n('calendar', 'week', 'weeks', this.count),
'label': this.$n('calendar', 'week', 'weeks', this.count),
'freq': 'WEEKLY'
}, {
'label': n('calendar', 'month', 'months', this.count),
'label': this.$n('calendar', 'month', 'months', this.count),
'freq': 'MONTHLY'
}, {
'label': n('calendar', 'year', 'years', this.count),
'label': this.$n('calendar', 'year', 'years', this.count),
'freq': 'YEARLY'
}]
},

View File

@ -73,15 +73,15 @@ export default {
value: 'SU',
isBySetPos: false
}, {
label: t('calendar', 'day'),
label: this.$t('calendar', 'day'),
value: 'SU,MO,TU,WE,TH,FR,SA',
isBySetPos: true
}, {
label: t('calendar', 'weekday'),
label: this.$t('calendar', 'weekday'),
value: 'MO,TU,WE,TH,FR',
isBySetPos: true
}, {
label: t('calendar', 'weekend day'),
label: this.$t('calendar', 'weekend day'),
value: 'SU,SA',
isBySetPos: true
}]

View File

@ -32,7 +32,7 @@ export default {
name: 'RepeatSummary',
computed: {
summaryLabel() {
return t('calendar', 'Summary')
return this.$t('calendar', 'Summary')
},
summary() {
return ''

View File

@ -40,7 +40,7 @@ export default {
},
computed: {
placeholder() {
return t('calendar', 'Type to search timezone')
return this.$t('calendar', 'Type to search timezone')
},
selectedTimezone: {
get() {

View File

@ -19,61 +19,62 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
import { translate } from 'nextcloud-l10n'
export default {
allDayEvents: [
{
label: t('calendar', 'On the day of the event at 9am'),
label: translate('calendar', 'On the day of the event at 9am'),
trigger: 'P9H'
},
{
label: t('calendar', '1 day before at 9am'),
label: translate('calendar', '1 day before at 9am'),
trigger: '-P15H'
},
{
label: t('calendar', '2 days before at 9am'),
label: translate('calendar', '2 days before at 9am'),
trigger: '-P39H'
},
{
label: t('calendar', '1 week before at 9am'),
label: translate('calendar', '1 week before at 9am'),
trigger: '-P153H'
}
],
timedEvents: [
{
label: t('calendar', 'At the time of the event'),
label: translate('calendar', 'At the time of the event'),
trigger: 'P0D'
},
{
label: t('calendar', '5 minutes before'),
label: translate('calendar', '5 minutes before'),
trigger: '-P5M'
},
{
label: t('calendar', '10 minutes before'),
label: translate('calendar', '10 minutes before'),
trigger: '-P10M'
},
{
label: t('calendar', '15 minutes before'),
label: translate('calendar', '15 minutes before'),
trigger: '-P15M'
},
{
label: t('calendar', '30 minutes before'),
label: translate('calendar', '30 minutes before'),
trigger: '-P30M'
},
{
label: t('calendar', '1 hour before'),
label: translate('calendar', '1 hour before'),
trigger: '-P1H'
},
{
label: t('calendar', '2 hours before'),
label: translate('calendar', '2 hours before'),
trigger: '-P2H'
},
{
label: t('calendar', '1 day before'),
label: translate('calendar', '1 day before'),
trigger: '-P1D'
},
{
label: t('calendar', '2 days before'),
label: translate('calendar', '2 days before'),
trigger: '-P2D'
}
]

View File

@ -20,6 +20,7 @@
*
*/
import moment from 'nextcloud-moment'
import { translate } from 'nextcloud-l10n'
export default (value, view) => {
switch (view) {
@ -27,7 +28,7 @@ export default (value, view) => {
return moment(value).format('ll')
case 'timeGridWeek':
return t('calendar', 'Week {number} of {year}', {
return translate('calendar', 'Week {number} of {year}', {
number: moment(value).week(),
year: moment(value).year()
})

View File

@ -22,6 +22,7 @@
import {
generateTextColorForRGBString
} from '../utils/color.js'
import { translate } from 'nextcloud-l10n'
/**
* convert an array of calendar-objects to events
@ -47,7 +48,7 @@ export function eventSourceFunction(calendarObjects, start, end, timezone) {
const fcEvent = {
id: [calendarObject.id, object.id].join('###'),
title: object.title || t('calendar', 'Untitled event'),
title: object.title || translate('calendar', 'Untitled event'),
allDay: object.isAllDay(),
start: object.startDate.getInTimezone(timezone).jsDate,
end: object.endDate.getInTimezone(timezone).jsDate,

View File

@ -137,10 +137,10 @@ export default {
}
if (!this.calendarObject.dav) {
return t('calendar', 'Save')
return this.$t('calendar', 'Save')
}
return t('calendar', 'Update')
return this.$t('calendar', 'Update')
},
location() {
if (!this.calendarObjectInstance) {

View File

@ -19,127 +19,128 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import { translate } from 'nextcloud-l10n'
export default {
// RFC 5545
class: {
name: 'accessClass',
readableName: t('calendar', 'When shared show'),
readableName: translate('calendar', 'When shared show'),
icon: 'icon-eye',
options: [
{ value: 'PUBLIC', label: t('calendar', 'When shared show full event') },
{ value: 'CONFIDENTIAL', label: t('calendar', 'When shared show only busy') },
{ value: 'PRIVATE', label: t('calendar', 'When shared hide this event') },
{ value: 'PUBLIC', label: translate('calendar', 'When shared show full event') },
{ value: 'CONFIDENTIAL', label: translate('calendar', 'When shared show only busy') },
{ value: 'PRIVATE', label: translate('calendar', 'When shared hide this event') },
],
multiple: false,
info: t('calendar', 'The visibility of this event in shared calendars.'),
info: translate('calendar', 'The visibility of this event in shared calendars.'),
defaultValue: 'PUBLIC'
},
summary: {
name: 'title',
readableName: t('calendar', 'Title'),
placeholder: t('calendar', 'Enter a title for this event')
readableName: translate('calendar', 'Title'),
placeholder: translate('calendar', 'Enter a title for this event')
},
location: {
name: 'location',
readableName: t('calendar', 'Location'),
placeholder: t('calendar', 'Add a location'),
readableName: translate('calendar', 'Location'),
placeholder: translate('calendar', 'Add a location'),
icon: 'icon-address'
},
description: {
name: 'description',
readableName: t('calendar', 'Description'),
placeholder: t('calendar', 'Add a description'),
readableName: translate('calendar', 'Description'),
placeholder: translate('calendar', 'Add a description'),
icon: 'icon-menu',
},
geo: {
name: 'geo',
readableName: t('calendar', 'Geographic Position'),
readableName: translate('calendar', 'Geographic Position'),
icon: 'icon-timezone',
multiple: false,
default: false,
info: t('calendar', 'The geographical position this events take place at.')
info: translate('calendar', 'The geographical position this events take place at.')
},
priority: {
readableName: t('calendar', 'Priority'),
readableName: translate('calendar', 'Priority'),
icon: '',
multiple: false,
default: false,
info: t('calendar', 'Priority of this event.'),
info: translate('calendar', 'Priority of this event.'),
options: [
{ value: 7, label: t('calendar', 'Low') },
{ value: 5, label: t('calendar', 'Medium') },
{ value: 3, label: t('calendar', 'High') },
{ value: 7, label: translate('calendar', 'Low') },
{ value: 5, label: translate('calendar', 'Medium') },
{ value: 3, label: translate('calendar', 'High') },
]
},
status: {
name: 'status',
readableName: t('calendar', 'Status'),
readableName: translate('calendar', 'Status'),
icon: 'icon-checkmark',
options: [
{ value: 'CONFIRMED', label: t('calendar', 'Confirmed') },
{ value: 'TENTATIVE', label: t('calendar', 'Tentative') },
{ value: 'CANCELLED', label: t('calendar', 'Cancelled') },
{ value: 'CONFIRMED', label: translate('calendar', 'Confirmed') },
{ value: 'TENTATIVE', label: translate('calendar', 'Tentative') },
{ value: 'CANCELLED', label: translate('calendar', 'Cancelled') },
],
multiple: false,
default: true,
info: t('calendar', 'Confirmation about the overall status of the event.'),
info: translate('calendar', 'Confirmation about the overall status of the event.'),
defaultValue: 'CONFIRMED'
},
timeTransparency: {
name: 'timeTransparency',
readableName: t('calendar', 'Show as'),
readableName: translate('calendar', 'Show as'),
icon: 'icon-briefcase',
multiple: false,
default: true,
info: t('calendar', 'Take this event into account when calculating free-busy information'),
info: translate('calendar', 'Take this event into account when calculating free-busy information'),
options: [
{ value: 'TRANSPARENT', label: t('calendar', 'Free') },
{ value: 'OPAQUE', label: t('calendar', 'Busy') },
{ value: 'TRANSPARENT', label: translate('calendar', 'Free') },
{ value: 'OPAQUE', label: translate('calendar', 'Busy') },
],
defaultValue: 'TRANSPARENT'
},
// url: {
// readableName: t('calendar', 'URL'),
// readableName: translate('calendar', 'URL'),
// icon: '',
// multiple: false,
// default: false,
// info: t('calendar', '')
// info: translate('calendar', '')
// },
// To be implemented later:
// attach: {
// readableName: t('calendar', 'Attachments'),
// readableName: translate('calendar', 'Attachments'),
// multiple: true,
//
// },
categories: {
readableName: t('calendar', 'Categories'),
readableName: translate('calendar', 'Categories'),
icon: '',
multiple: true,
default: true,
info: t('calendar', '')
info: translate('calendar', '')
},
resources: {
readableName: t('calendar', 'Additional resources'),
readableName: translate('calendar', 'Additional resources'),
icon: '',
multiple: true,
default: false,
info: t('calendar', '')
info: translate('calendar', '')
},
// RFC 7986
color: {
readableName: t('calendar', 'Custom color'),
readableName: translate('calendar', 'Custom color'),
icon: '',
multiple: false,
default: false,
info: t('calendar', 'Special color of this event. Overrides the calendar-color.')
info: translate('calendar', 'Special color of this event. Overrides the calendar-color.')
},
// To be implemented later:
// conference: {
// readableName: t('calendar', 'Conference system'),
// readableName: translate('calendar', 'Conference system'),
// icon: '',
// multiple: false,
// },

View File

@ -30,6 +30,7 @@ import { dateFactory, getUnixTimestampFromDate } from '../utils/date.js'
import { getDefaultCalendarObject, mapDavCollectionToCalendar } from '../models/calendar'
import pLimit from 'p-limit'
import { getRandomColor } from '../utils/color.js'
import { translate } from 'nextcloud-l10n'
const state = {
calendars: [],
@ -746,7 +747,7 @@ const actions = {
const calendarId = context.rootState.importFiles.importCalendarRelation[file.id]
if (calendarId === 'new') {
const displayName = file.parser.getName() || t('calendar', 'Imported {filename}', {
const displayName = file.parser.getName() || translate('calendar', 'Imported {filename}', {
filename: file.name
})
const color = file.parser.getColor() || getRandomColor()

View File

@ -263,7 +263,7 @@ export default {
if (calendars.length === 0) {
this.loadingCalendars = true
this.$store.dispatch('appendCalendar', {
displayName: t('calendars', 'Personal'),
displayName: this.$t('calendars', 'Personal'),
color: getRandomColor(),
order: 0
}).then(() => {