Skip to content

Commit

Permalink
TMS-1024: Add text after recurring manual event dates (#21)
Browse files Browse the repository at this point in the history
* TMS-1024: Add text after recurring manual event dates

* TMS-1024: Fix manual-event location icon
  • Loading branch information
eebbi authored Apr 17, 2024
1 parent 9888f3a commit 7277f94
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Binary file added languages/tms-plugin-manual-events-fi.mo
Binary file not shown.
112 changes: 112 additions & 0 deletions languages/tms-plugin-manual-events-fi.po
Original file line number Diff line number Diff line change
@@ -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 ""
112 changes: 112 additions & 0 deletions languages/tms-plugin-manual-events.pot
Original file line number Diff line number Diff line change
@@ -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 ""
23 changes: 22 additions & 1 deletion src/PostType/ManualEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? '',
Expand All @@ -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,
Expand Down Expand Up @@ -605,13 +607,32 @@ 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 ),
$end_time->format( $date_format )
);
}

// 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 );
}

Expand Down

0 comments on commit 7277f94

Please sign in to comment.