From 7277f942ffd2c98c8281e2ac03609666fd58e521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20V=C3=A4nttinen?= <31741222+eebbi@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:51:09 +0300 Subject: [PATCH] TMS-1024: Add text after recurring manual event dates (#21) * TMS-1024: Add text after recurring manual event dates * TMS-1024: Fix manual-event location icon --- CHANGELOG.md | 2 + languages/tms-plugin-manual-events-fi.mo | Bin 0 -> 837 bytes languages/tms-plugin-manual-events-fi.po | 112 +++++++++++++++++++++++ languages/tms-plugin-manual-events.pot | 112 +++++++++++++++++++++++ src/PostType/ManualEvent.php | 23 ++++- 5 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 languages/tms-plugin-manual-events-fi.mo create mode 100644 languages/tms-plugin-manual-events-fi.po create mode 100644 languages/tms-plugin-manual-events.pot diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c32eb4..e49aafa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning][semver]. ## [Unreleased] +- TMS-1024: Add text after recurring manual event dates + ## [1.3.0] - 2024-03-26 - TMS-968: diff --git a/languages/tms-plugin-manual-events-fi.mo b/languages/tms-plugin-manual-events-fi.mo new file mode 100644 index 0000000000000000000000000000000000000000..f7d96edfe5b15fb009d4cf13e9aed2698934c851 GIT binary patch literal 837 zcmaJ<&2HN;4EFvmJ`UJnzz#aEk?S}qP$=tVUAh))FmKI%ZU$$uwlZ5XB)M}RWKXpB z*t3j|)3}GBgg=NPKl&pH{eAxQcR==-@QN@YJR`gz^p+A{5Izz95UHT^CE?&n5Imyu z&ieYTftJkp5-r0U)Sh`&qYF}NHkf;UA^BIdP8luOdUeHC;L$3mT$q03pYcZZDgKV4 zf+cY>=P`XpY6nc>Rcg2M)UDOePZ(X$E)$GZZ3FD@A8ASKUDT~k}`#P4TwVl4WWo+C)4 zd7G*&l#ZIR8M9ZWwK<*+{R=h>uy5l7-u^OHx=ZCqF3T1fE;22qlVp)~{gG4T&e5Hi z=aW8%F3-SwO9guuM|W4yr%GQ}JJ!}6SX+1h+e{nN44S$dF0(-=%k*v+d(OSd5Nuwi zv_u}$8vmDAc6rrGls(~fRMT!Y?m^yEFnXHO*aumOVA@E`Y9reUT^MYD)vfZtJTy@H MwgwLBr`bU84|!k&vH$=8 literal 0 HcmV?d00001 diff --git a/languages/tms-plugin-manual-events-fi.po b/languages/tms-plugin-manual-events-fi.po new file mode 100644 index 0000000..67154c1 --- /dev/null +++ b/languages/tms-plugin-manual-events-fi.po @@ -0,0 +1,112 @@ +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: TMS Materials\n" +"POT-Creation-Date: 2024-04-05 15:11+0300\n" +"PO-Revision-Date: 2024-04-05 15:43+0300\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: fi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.4.2\n" +"X-Poedit-Basepath: ..\n" +"X-Poedit-Flags-xgettext: --add-comments=translators:\n" +"X-Poedit-WPHeader: plugin.php\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" +"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;" +"_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n" +"X-Poedit-SearchPath-0: .\n" +"X-Poedit-SearchPathExcluded-0: *.min.js\n" +"X-Poedit-SearchPathExcluded-1: vendor\n" +"X-Poedit-SearchPathExcluded-2: node_modules\n" + +#: src/Models/page-combined-events-list.php:47 +#: src/Models/page-combined-events-search.php:80 +msgid "No results" +msgstr "" + +#: src/Models/page-combined-events-search.php:57 +msgid "Search term" +msgstr "" + +#: src/Models/page-combined-events-search.php:58 +msgid "Events from" +msgstr "" + +#: src/Models/page-combined-events-search.php:59 +msgid "Start date" +msgstr "" + +#: src/Models/page-combined-events-search.php:60 +msgid "End date" +msgstr "" + +#: src/Models/page-combined-events-search.php:79 +msgid "No search term given" +msgstr "" + +#: src/Plugin.php:247 +msgid "Tapahtumalistaus (yhdistetty)" +msgstr "" + +#: src/Plugin.php:248 +msgid "Tapahtumahaku (yhdistetty)" +msgstr "" + +#: src/PostType/ManualEvent.php:62 +msgctxt "theme CPT" +msgid "manual-event" +msgstr "" + +#: src/PostType/ManualEvent.php:155 +msgctxt "theme ACF" +msgid "Tiedot" +msgstr "" + +#: src/PostType/ManualEvent.php:525 +msgid "Dates" +msgstr "" + +#: src/PostType/ManualEvent.php:526 +msgid "Time" +msgstr "" + +#: src/PostType/ManualEvent.php:527 +msgid "Location" +msgstr "" + +#: src/PostType/ManualEvent.php:528 +msgid "Price" +msgstr "" + +#: src/PostType/ManualEvent.php:529 +msgid "Organizer" +msgstr "" + +#: src/PostType/ManualEvent.php:550 +msgid "Free" +msgstr "" + +#: src/PostType/ManualEvent.php:614 +msgid "and other event times" +msgstr "ja muita tapahtuma-aikoja" + +#. Plugin Name of the plugin/theme +#. Description of the plugin/theme +msgid "TMS Manual Events" +msgstr "" + +#. Plugin URI of the plugin/theme +msgid "https://github.com/devgeniem/tms-plugin-manual-events" +msgstr "" + +#. Author of the plugin/theme +msgid "Geniem Oy" +msgstr "" + +#. Author URI of the plugin/theme +msgid "https://geniem.com" +msgstr "" diff --git a/languages/tms-plugin-manual-events.pot b/languages/tms-plugin-manual-events.pot new file mode 100644 index 0000000..798f361 --- /dev/null +++ b/languages/tms-plugin-manual-events.pot @@ -0,0 +1,112 @@ +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: TMS Materials\n" +"POT-Creation-Date: 2024-04-05 15:11+0300\n" +"PO-Revision-Date: 2021-06-15 11:22+0300\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" +"X-Generator: Poedit 3.4.2\n" +"X-Poedit-Basepath: ..\n" +"X-Poedit-Flags-xgettext: --add-comments=translators:\n" +"X-Poedit-WPHeader: plugin.php\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" +"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;" +"_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n" +"X-Poedit-SearchPath-0: .\n" +"X-Poedit-SearchPathExcluded-0: *.min.js\n" +"X-Poedit-SearchPathExcluded-1: vendor\n" +"X-Poedit-SearchPathExcluded-2: node_modules\n" + +#: src/Models/page-combined-events-list.php:47 +#: src/Models/page-combined-events-search.php:80 +msgid "No results" +msgstr "" + +#: src/Models/page-combined-events-search.php:57 +msgid "Search term" +msgstr "" + +#: src/Models/page-combined-events-search.php:58 +msgid "Events from" +msgstr "" + +#: src/Models/page-combined-events-search.php:59 +msgid "Start date" +msgstr "" + +#: src/Models/page-combined-events-search.php:60 +msgid "End date" +msgstr "" + +#: src/Models/page-combined-events-search.php:79 +msgid "No search term given" +msgstr "" + +#: src/Plugin.php:247 +msgid "Tapahtumalistaus (yhdistetty)" +msgstr "" + +#: src/Plugin.php:248 +msgid "Tapahtumahaku (yhdistetty)" +msgstr "" + +#: src/PostType/ManualEvent.php:62 +msgctxt "theme CPT" +msgid "manual-event" +msgstr "" + +#: src/PostType/ManualEvent.php:155 +msgctxt "theme ACF" +msgid "Tiedot" +msgstr "" + +#: src/PostType/ManualEvent.php:525 +msgid "Dates" +msgstr "" + +#: src/PostType/ManualEvent.php:526 +msgid "Time" +msgstr "" + +#: src/PostType/ManualEvent.php:527 +msgid "Location" +msgstr "" + +#: src/PostType/ManualEvent.php:528 +msgid "Price" +msgstr "" + +#: src/PostType/ManualEvent.php:529 +msgid "Organizer" +msgstr "" + +#: src/PostType/ManualEvent.php:550 +msgid "Free" +msgstr "" + +#: src/PostType/ManualEvent.php:614 +msgid "and other event times" +msgstr "" + +#. Plugin Name of the plugin/theme +#. Description of the plugin/theme +msgid "TMS Manual Events" +msgstr "" + +#. Plugin URI of the plugin/theme +msgid "https://github.com/devgeniem/tms-plugin-manual-events" +msgstr "" + +#. Author of the plugin/theme +msgid "Geniem Oy" +msgstr "" + +#. Author URI of the plugin/theme +msgid "https://geniem.com" +msgstr "" diff --git a/src/PostType/ManualEvent.php b/src/PostType/ManualEvent.php index 9f123d6..03d0633 100644 --- a/src/PostType/ManualEvent.php +++ b/src/PostType/ManualEvent.php @@ -509,6 +509,7 @@ protected function get_event_tab( string $key ) : ?Field\Tab { * @return array */ public static function normalize_event( $event ) { // phpcs:disable Generic.Metrics.CyclomaticComplexity + $event_is_virtual = $event->is_virtual_event ?? false; $normalized_event = [ 'name' => $event->title ?? '', 'short_description' => $event->short_description ?? '', @@ -520,11 +521,12 @@ public static function normalize_event( $event ) { // phpcs:disable Generic.Metr 'end_date_raw' => static::get_as_datetime( $event->end_datetime ), 'image' => $event->image ?? '', 'url' => $event->url ?? '', - 'is_virtual_event' => $event->is_virtualevent ?? false, + 'is_virtual_event' => $event_is_virtual, 'virtual_event_link' => $event->virtual_event_link ?? '', 'date_title' => __( 'Dates', 'tms-theme-base' ), 'time_title' => __( 'Time', 'tms-theme-base' ), 'location_title' => __( 'Location', 'tms-theme-base' ), + 'location_icon' => $event_is_virtual ? 'globe' : 'location', 'price_title' => __( 'Price', 'tms-theme-base' ), 'provider_title' => __( 'Organizer', 'tms-theme-base' ), 'recurring' => ! empty( $event->dates ) ? count( $event->dates ) > 1 : null, @@ -605,6 +607,16 @@ protected static function get_event_date( $event ) { $date_format = get_option( 'date_format' ); if ( $start_time && $end_time && $start_time->diff( $end_time )->days >= 1 ) { + // Add text with dates if the event is recurring + if ( ! empty( $event->dates ) && count( $event->dates ) > 1 ) { + return sprintf( + '%s - %s %s', + $start_time->format( $date_format ), + $end_time->format( $date_format ), + __( 'and other event times', 'tms-plugin-manual-events' ) + ); + } + return sprintf( '%s - %s', $start_time->format( $date_format ), @@ -612,6 +624,15 @@ protected static function get_event_date( $event ) { ); } + // Add text with start-date if the event is recurring + if ( ! empty( $event->dates ) && count( $event->dates ) > 1 ) { + return sprintf( + '%s %s', + $start_time->format( $date_format ), + __( 'and other event times', 'tms-plugin-manual-events' ) + ); + } + return $start_time->format( $date_format ); }