From 6d3e4c4ccf374cdd03ceb3baa93b114fa2265656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arttu=20Erkkil=C3=A4?= Date: Mon, 4 Sep 2023 08:02:42 +0300 Subject: [PATCH] TMS-964-2: Update translation and format pricing. --- CHANGELOG.MD | 2 ++ lang/fi.mo | Bin 12743 -> 12827 bytes lang/fi.po | 30 ++++++++++++----------- lang/tms-theme-base.pot | 22 +++++++++++------ lib/Eventz.php | 53 +++++++++++++++++++++++++--------------- 5 files changed, 66 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index cf5cf697..4e26560a 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- TMS-964-2: Update translation and format pricing. + ## [1.46.0] - 2023-08-30 - TMS-964: Add new Eventz api and remove old one. diff --git a/lang/fi.mo b/lang/fi.mo index ea444a558c548f21ac1120dc81c3952e9c23a7d4..3e2464a3243ceb9b46251e9b34f9152b12367122 100644 GIT binary patch delta 4206 zcmYk;4Rn`P9l-I+24iDmW5AN!gfTYe5M)3ynKUpA3PCWLsl3RGix&mvhGOdc4^8HP z@&%{Zq?(MN)HH{PA?%zeO%9fN$S69)bF7T)V1*|+R@V3X|6j~|_WOVCz0Y%BpZh%U z%Chzw5LvSZ% z<3a3?hhzB|_NDv>+x-kP7(cukFT9R6Jb`xfUMzorHV6Y#1NT9%XQL|_j1^df?!a_( z^X8)M7GghKigXoL<6ul+CgX>P$=Gl^dgHEGeh%Hbm(Ud-M*hO<{Mhk3XuCh7_x%IC z&*ie2Ap_lkbI^s2L~ExmiMC_zlMwzdSd^;FxF?y1+}(3CtSI{@d_cD$;NfddQYw0p5!qwsvHU@Fdn^H}V$>xaqSv z3eUmI&4d~fui|)grl#inw zeS{9wpHVHBpdDX?$?pX^a6Nk8Msy+V$aslxfDCt=sL(d!ej(D#2H89S;+SJoPD*o`)L8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y$(1soP zZ4JaSbfLBA0%oHNPNNevqV0E~?T(`3o<`OZ&c|{At8l^T6d4-~ixtp*+u&DJ_~JN$uJm2xl)@+IM8%w&1C*jCQ-Mw}7JYHmq3vg(JA4S8U_IJ@ zGx`GBiMD?geGwflPbUqI#s+U=2fjFs9q|KnfOF{1E}-v$yozMNk?0$40{RA=gid@b zy0Llaqg@v3*J2LkMzsCbG#M|)Zgk?KXvgE|0#2g?o<(81R#j5p z30-(Gx}e_Zf>NdshR5x-x9_S=L`yerlpL~sAG>iGMAmkL+(er(W+-ic4qg>)I5EUY^gP%ep9qL*qU zx}ZArXF416a2b~3!|0>kjxJj~ z(?Ix~ys3{6 zyNR~s&+ZOlE-{g~mDoYtN9-rM5hgceT1PA(#u6KeO2U*PW)K637i|6*8B+oA(@ZY; zU(P1-lZdUvyjWj>eTi3ynX&Fh96+pyWw|rvug1;92%?2By-xJWZfmlsUBc3F>5VsI75!Vx@+^_Rd zMtr{^x7(8Db=|tOYu-_`t!v(>>Yb%bY(rIt} diff --git a/lang/fi.po b/lang/fi.po index d45c3070..1137ae5b 100644 --- a/lang/fi.po +++ b/lang/fi.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: TMS Theme Base\n" -"POT-Creation-Date: 2023-08-30 12:27+0300\n" -"PO-Revision-Date: 2023-08-30 12:28+0300\n" +"POT-Creation-Date: 2023-09-03 19:27+0300\n" +"PO-Revision-Date: 2023-09-03 19:27+0300\n" "Last-Translator: \n" "Language-Team: \n" "Language: fi\n" @@ -282,27 +282,35 @@ msgid "Price" msgstr "Hinta" #: lib/Eventz.php:116 +msgid "Organizer" +msgstr "Järjestäjä" + +#: lib/Eventz.php:118 msgid "Area" msgstr "" -#: lib/Eventz.php:118 +#: lib/Eventz.php:120 msgid "Target" msgstr "" -#: lib/Eventz.php:120 +#: lib/Eventz.php:122 msgid "Tags" msgstr "" -#: lib/Eventz.php:124 +#: lib/Eventz.php:126 msgid "Links" msgstr "Linkit" -#: lib/Eventz.php:263 +#: lib/Eventz.php:269 +msgid "Additional information" +msgstr "Lisätiedot" + +#: lib/Eventz.php:286 msgid "Free" msgstr "Maksuton" -#: lib/Eventz.php:285 -msgid "Additional information" +#: lib/Eventz.php:318 +msgid "Additional info" msgstr "Lisätiedot" #: lib/Formatters/CountdownFormatter.php:80 models/strings.php:224 @@ -1166,12 +1174,6 @@ msgstr "" msgid "https://geniem.fi" msgstr "" -#~ msgid "Organizer" -#~ msgstr "Järjestäjä" - -#~ msgid "Additional info" -#~ msgstr "Lisätiedot" - #~ msgid "Virtual event" #~ msgstr "Verkkotapahtuma" diff --git a/lang/tms-theme-base.pot b/lang/tms-theme-base.pot index b5f80e48..19732de2 100644 --- a/lang/tms-theme-base.pot +++ b/lang/tms-theme-base.pot @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: TMS Theme Base\n" -"POT-Creation-Date: 2023-08-30 12:27+0300\n" +"POT-Creation-Date: 2023-09-03 19:27+0300\n" "PO-Revision-Date: 2022-01-12 10:08+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -282,27 +282,35 @@ msgid "Price" msgstr "" #: lib/Eventz.php:116 -msgid "Area" +msgid "Organizer" msgstr "" #: lib/Eventz.php:118 -msgid "Target" +msgid "Area" msgstr "" #: lib/Eventz.php:120 +msgid "Target" +msgstr "" + +#: lib/Eventz.php:122 msgid "Tags" msgstr "" -#: lib/Eventz.php:124 +#: lib/Eventz.php:126 msgid "Links" msgstr "" -#: lib/Eventz.php:263 +#: lib/Eventz.php:269 +msgid "Additional information" +msgstr "" + +#: lib/Eventz.php:286 msgid "Free" msgstr "" -#: lib/Eventz.php:285 -msgid "Additional information" +#: lib/Eventz.php:318 +msgid "Additional info" msgstr "" #: lib/Formatters/CountdownFormatter.php:80 models/strings.php:224 diff --git a/lib/Eventz.php b/lib/Eventz.php index 15fa17f1..a5bcf3f7 100644 --- a/lib/Eventz.php +++ b/lib/Eventz.php @@ -113,6 +113,7 @@ public static function normalize_event( $event ) : array { 'location' => static::get_event_location( $event ), 'price_title' => __( 'Price', 'tms-theme-base' ), 'price' => static::get_event_price_info( $event, $lang_key ), + 'provider_title' => __( 'Organizer', 'tms-theme-base' ), 'area_title' => __( 'Area', 'tms-theme-base' ), 'areas' => static::get_area_info( $event ), 'target_title' => __( 'Target', 'tms-theme-base' ), @@ -253,29 +254,11 @@ public static function get_as_datetime( $value ) { * @return array|null */ public static function get_event_price_info( $event ) : ?array { - if ( empty( $event ) ) { + if ( empty( $event ) || empty( $event->price ) ) { return null; } - $price = $event->price ?? null; - - if ( empty( $price ) || $event->price->isFree ) { - $price = __( 'Free', 'tms-theme-base' ); - } - else { - $min = $event->price->min; - $max = $event->price->max; - - if ( $min === 0 && $max > 0 ) { - $price = $max . '€'; - } - elseif ( $max === 0 && $min > 0 ) { - $price = $min . '€'; - } - else { - $price = $min . '-' . $max . '€'; - } - } + $price = self::format_price( $event->price ); return [ [ @@ -290,6 +273,36 @@ public static function get_event_price_info( $event ) : ?array { ]; } + /** + * Format price. + * + * @param object $price Event price. + * + * @return string|null + */ + public static function format_price( $price ) : ?string { + if ( $price->isFree ) { + return __( 'Free', 'tms-theme-base' ); + } + + $formatted_price = ''; + + // Price data might differ. + if ( $price->min === 0 && $price->max > 0 ) { + $formatted_price = $price->max; + } + + if ( $price->max === 0 && $price->min > 0 ) { + $formatted_price = $price->min; + } + + if( empty ( $formatted_price ) ) { + $formatted_price = $price->min . '-' . $price->max; + } + + return $formatted_price . '€'; + } + /** * Get area info *