diff --git a/l10n/de.json b/l10n/de.json new file mode 100644 index 0000000..76f506e --- /dev/null +++ b/l10n/de.json @@ -0,0 +1,35 @@ +{ + "translations": { + "The following meeting will be added to your Nextcloud Calendar.": "Das folgende Meeting wird zu deinem Nextcloud-Kalender hinzugefügt.", + "This request came from an external link. Only continue if you trust its source.": "Diese Anfrage stammt von einem externen Link. Fahre nur fort, wenn du der Quelle vertraust.", + "Title": "Titel", + "Description": "Beschreibung", + "Start": "Beginn", + "End": "Ende", + "Organizer": "Organisator", + "Location": "Ort", + "Link": "Link", + "Calendar": "Kalender", + "Add to Nextcloud Calendar": "Zum Nextcloud-Kalender hinzufügen", + "Cancel": "Abbrechen", + "Meeting title is required.": "Ein Meeting-Titel ist erforderlich.", + "Meeting title is too long.": "Der Meeting-Titel ist zu lang.", + "Meeting title contains invalid characters.": "Der Meeting-Titel enthält ungültige Zeichen.", + "Meeting description is too long.": "Die Meeting-Beschreibung ist zu lang.", + "Meeting description contains invalid characters.": "Die Meeting-Beschreibung enthält ungültige Zeichen.", + "Invalid date/time.": "Ungültiges Datum / ungültige Uhrzeit.", + "End time must be after start time.": "Die Endzeit muss nach der Startzeit liegen.", + "Location is too long.": "Der Ort ist zu lang.", + "Location contains invalid characters.": "Der Ort enthält ungültige Zeichen.", + "Location must be an HTTPS URL.": "Der Ort muss eine HTTPS-URL sein.", + "Meeting URL is too long.": "Die Meeting-URL ist zu lang.", + "Meeting URL contains invalid characters.": "Die Meeting-URL enthält ungültige Zeichen.", + "Meeting URL must be an HTTPS URL.": "Die Meeting-URL muss eine HTTPS-URL sein.", + "Organizer email address is too long.": "Die E-Mail-Adresse des Organisators ist zu lang.", + "Organizer contains invalid characters.": "Der Organisator enthält ungültige Zeichen.", + "Invalid organizer email address.": "Ungültige E-Mail-Adresse des Organisators.", + "No writable calendar was found in your account. Create one in the Nextcloud Calendar app, then try again.": "In deinem Konto wurde kein beschreibbarer Kalender gefunden. Erstelle einen in der Nextcloud-Kalender-App und versuche es erneut.", + "The selected calendar is no longer writable. Pick another one and try again.": "Der ausgewählte Kalender ist nicht mehr beschreibbar. Wähle einen anderen aus und versuche es erneut." + }, + "pluralForms": "nplurals=2; plural=(n != 1);" +} diff --git a/l10n/de_DE.json b/l10n/de_DE.json new file mode 100644 index 0000000..3003f32 --- /dev/null +++ b/l10n/de_DE.json @@ -0,0 +1,35 @@ +{ + "translations": { + "The following meeting will be added to your Nextcloud Calendar.": "Das folgende Meeting wird zu Ihrem Nextcloud-Kalender hinzugefügt.", + "This request came from an external link. Only continue if you trust its source.": "Diese Anfrage stammt von einem externen Link. Fahren Sie nur fort, wenn Sie der Quelle vertrauen.", + "Title": "Titel", + "Description": "Beschreibung", + "Start": "Beginn", + "End": "Ende", + "Organizer": "Organisator", + "Location": "Ort", + "Link": "Link", + "Calendar": "Kalender", + "Add to Nextcloud Calendar": "Zum Nextcloud-Kalender hinzufügen", + "Cancel": "Abbrechen", + "Meeting title is required.": "Ein Meeting-Titel ist erforderlich.", + "Meeting title is too long.": "Der Meeting-Titel ist zu lang.", + "Meeting title contains invalid characters.": "Der Meeting-Titel enthält ungültige Zeichen.", + "Meeting description is too long.": "Die Meeting-Beschreibung ist zu lang.", + "Meeting description contains invalid characters.": "Die Meeting-Beschreibung enthält ungültige Zeichen.", + "Invalid date/time.": "Ungültiges Datum / ungültige Uhrzeit.", + "End time must be after start time.": "Die Endzeit muss nach der Startzeit liegen.", + "Location is too long.": "Der Ort ist zu lang.", + "Location contains invalid characters.": "Der Ort enthält ungültige Zeichen.", + "Location must be an HTTPS URL.": "Der Ort muss eine HTTPS-URL sein.", + "Meeting URL is too long.": "Die Meeting-URL ist zu lang.", + "Meeting URL contains invalid characters.": "Die Meeting-URL enthält ungültige Zeichen.", + "Meeting URL must be an HTTPS URL.": "Die Meeting-URL muss eine HTTPS-URL sein.", + "Organizer email address is too long.": "Die E-Mail-Adresse des Organisators ist zu lang.", + "Organizer contains invalid characters.": "Der Organisator enthält ungültige Zeichen.", + "Invalid organizer email address.": "Ungültige E-Mail-Adresse des Organisators.", + "No writable calendar was found in your account. Create one in the Nextcloud Calendar app, then try again.": "In Ihrem Konto wurde kein beschreibbarer Kalender gefunden. Erstellen Sie einen in der Nextcloud-Kalender-App und versuchen Sie es erneut.", + "The selected calendar is no longer writable. Pick another one and try again.": "Der ausgewählte Kalender ist nicht mehr beschreibbar. Wählen Sie einen anderen aus und versuchen Sie es erneut." + }, + "pluralForms": "nplurals=2; plural=(n != 1);" +} diff --git a/l10n/en.json b/l10n/en.json new file mode 100644 index 0000000..1defbc3 --- /dev/null +++ b/l10n/en.json @@ -0,0 +1,35 @@ +{ + "translations": { + "The following meeting will be added to your Nextcloud Calendar.": "The following meeting will be added to your Nextcloud Calendar.", + "This request came from an external link. Only continue if you trust its source.": "This request came from an external link. Only continue if you trust its source.", + "Title": "Title", + "Description": "Description", + "Start": "Start", + "End": "End", + "Organizer": "Organizer", + "Location": "Location", + "Link": "Link", + "Calendar": "Calendar", + "Add to Nextcloud Calendar": "Add to Nextcloud Calendar", + "Cancel": "Cancel", + "Meeting title is required.": "Meeting title is required.", + "Meeting title is too long.": "Meeting title is too long.", + "Meeting title contains invalid characters.": "Meeting title contains invalid characters.", + "Meeting description is too long.": "Meeting description is too long.", + "Meeting description contains invalid characters.": "Meeting description contains invalid characters.", + "Invalid date/time.": "Invalid date/time.", + "End time must be after start time.": "End time must be after start time.", + "Location is too long.": "Location is too long.", + "Location contains invalid characters.": "Location contains invalid characters.", + "Location must be an HTTPS URL.": "Location must be an HTTPS URL.", + "Meeting URL is too long.": "Meeting URL is too long.", + "Meeting URL contains invalid characters.": "Meeting URL contains invalid characters.", + "Meeting URL must be an HTTPS URL.": "Meeting URL must be an HTTPS URL.", + "Organizer email address is too long.": "Organizer email address is too long.", + "Organizer contains invalid characters.": "Organizer contains invalid characters.", + "Invalid organizer email address.": "Invalid organizer email address.", + "No writable calendar was found in your account. Create one in the Nextcloud Calendar app, then try again.": "No writable calendar was found in your account. Create one in the Nextcloud Calendar app, then try again.", + "The selected calendar is no longer writable. Pick another one and try again.": "The selected calendar is no longer writable. Pick another one and try again." + }, + "pluralForms": "nplurals=2; plural=(n != 1);" +} diff --git a/lib/Controller/CalendarController.php b/lib/Controller/CalendarController.php index 528d560..ad03152 100644 --- a/lib/Controller/CalendarController.php +++ b/lib/Controller/CalendarController.php @@ -19,6 +19,7 @@ use OCP\IRequest; use OCP\IURLGenerator; use OCP\IUserSession; use OCP\IDateTimeZone; +use OCP\IL10N; use Sabre\VObject\Reader; class CalendarController extends Controller @@ -60,6 +61,7 @@ class CalendarController extends Controller private IUserSession $userSession; private IURLGenerator $urlGenerator; private IDateTimeZone $dateTimeZone; + private IL10N $l10n; public function __construct( string $appName, @@ -68,7 +70,8 @@ class CalendarController extends Controller IAppManager $appManager, IUserSession $userSession, IURLGenerator $urlGenerator, - IDateTimeZone $dateTimeZone + IDateTimeZone $dateTimeZone, + IL10N $l10n ) { parent::__construct($appName, $request); @@ -77,6 +80,7 @@ class CalendarController extends Controller $this->userSession = $userSession; $this->urlGenerator = $urlGenerator; $this->dateTimeZone = $dateTimeZone; + $this->l10n = $l10n; } /** @@ -181,11 +185,15 @@ class CalendarController extends Controller $calendars, $calendarId, $calendars === [] - ? 'No writable calendar was found in your account. ' - . 'Create one in the Nextcloud Calendar app, ' - . 'then try again.' - : 'The selected calendar is no longer writable. ' - . 'Pick another one and try again.' + ? $this->l10n->t( + 'No writable calendar was found in your account. ' + . 'Create one in the Nextcloud Calendar app, ' + . 'then try again.' + ) + : $this->l10n->t( + 'The selected calendar is no longer writable. ' + . 'Pick another one and try again.' + ) ); } @@ -303,6 +311,7 @@ class CalendarController extends Controller 'location' => $data['location'], 'url' => $data['url'], 'error' => $error, + 'l10n' => $this->l10n, 'calendars' => array_map( static function (ICreateFromString $calendar): array { return [ @@ -404,31 +413,31 @@ class CalendarController extends Controller if ($summary === '') { throw new \InvalidArgumentException( - 'Meeting title is required.' + $this->l10n->t('Meeting title is required.') ); } if (mb_strlen($summary) > 255) { throw new \InvalidArgumentException( - 'Meeting title is too long.' + $this->l10n->t('Meeting title is too long.') ); } $this->assertClean( $summary, - 'Meeting title contains invalid characters.' + $this->l10n->t('Meeting title contains invalid characters.') ); if ($description !== '' && mb_strlen($description) > 10000) { throw new \InvalidArgumentException( - 'Meeting description is too long.' + $this->l10n->t('Meeting description is too long.') ); } if ($description !== '') { $this->assertClean( $description, - 'Meeting description contains invalid characters.', + $this->l10n->t('Meeting description contains invalid characters.'), true ); } @@ -438,7 +447,7 @@ class CalendarController extends Controller if ($endDate <= $startDate) { throw new \InvalidArgumentException( - 'End time must be after start time.' + $this->l10n->t('End time must be after start time.') ); } @@ -446,37 +455,37 @@ class CalendarController extends Controller $this->assertBoundedLength( $location, self::MAX_URL_LENGTH, - 'Location is too long.' + $this->l10n->t('Location is too long.') ); $this->assertClean( $location, - 'Location contains invalid characters.' + $this->l10n->t('Location contains invalid characters.') ); - $this->assertHttpsUrl($location, 'Location must be an HTTPS URL.'); + $this->assertHttpsUrl($location, $this->l10n->t('Location must be an HTTPS URL.')); } if ($url !== '') { $this->assertBoundedLength( $url, self::MAX_URL_LENGTH, - 'Meeting URL is too long.' + $this->l10n->t('Meeting URL is too long.') ); $this->assertClean( $url, - 'Meeting URL contains invalid characters.' + $this->l10n->t('Meeting URL contains invalid characters.') ); - $this->assertHttpsUrl($url, 'Meeting URL must be an HTTPS URL.'); + $this->assertHttpsUrl($url, $this->l10n->t('Meeting URL must be an HTTPS URL.')); } if ($organizer !== '') { $this->assertBoundedLength( $organizer, self::MAX_EMAIL_LENGTH, - 'Organizer email address is too long.' + $this->l10n->t('Organizer email address is too long.') ); $this->assertClean( $organizer, - 'Organizer contains invalid characters.' + $this->l10n->t('Organizer contains invalid characters.') ); if (!filter_var( @@ -484,7 +493,7 @@ class CalendarController extends Controller FILTER_VALIDATE_EMAIL )) { throw new \InvalidArgumentException( - 'Invalid organizer email address.' + $this->l10n->t('Invalid organizer email address.') ); } } @@ -552,7 +561,7 @@ class CalendarController extends Controller if ($date === false) { throw new \InvalidArgumentException( - 'Invalid date/time.' + $this->l10n->t('Invalid date/time.') ); } diff --git a/templates/confirm.php b/templates/confirm.php index 90150f4..c630f46 100644 --- a/templates/confirm.php +++ b/templates/confirm.php @@ -9,6 +9,8 @@ $h = static function (string $value): string { 'UTF-8' ); }; + +$l = $_['l10n']; ?>
- The following meeting will be added to your - Nextcloud Calendar. + = $h($l->t( + 'The following meeting will be added to your ' + . 'Nextcloud Calendar.' + )) ?>
- This request came from an external link. - Only continue if you trust its source. + = $h($l->t( + 'This request came from an external link. ' + . 'Only continue if you trust its source.' + )) ?>
@@ -39,13 +45,13 @@ $h = static function (string $value): string {