| @@ -6,9 +6,12 @@ | ||
| 6 | 6 | // Reviews Section |
| 7 | 7 | // Expected variables: $trip |
| 8 | 8 | ?> |
| 9 | 9 | <!-- Reviews: full width within unified trip container (same max-width + padding as .yatra-trip-container) --> |
| 10 | -<section class="yatra-reviews-section" id="reviews" itemscope itemtype="https://schema.org/Review"> | |
| 10 | +<?php // Structured data for reviews is emitted as JSON-LD (Product.review[]) in | |
| 11 | + // SEOService. The old itemtype="Review" here made the whole list a single | |
| 12 | + // Review with no author/itemReviewed, which Google flagged. ?> | |
| 13 | +<section class="yatra-reviews-section" id="reviews"> | |
| 11 | 14 | <div class="yatra-reviews-section-container"> |
| 12 | 15 | <div class="yatra-reviews-header"> |
| 13 | 16 | <h2 class="yatra-reviews-section-title"> |
| 14 | 17 | <?php echo yatra_svg_icon('star', 'yatra-reviews-section-icon'); ?> |
| @@ -13,9 +16,8 @@ | ||
| 13 | 16 | <h2 class="yatra-reviews-section-title"> |
| 14 | 17 | <?php echo yatra_svg_icon('star', 'yatra-reviews-section-icon'); ?> |
| 15 | 18 | <?php echo esc_html__('Reviews', 'yatra'); ?> |
| 16 | 19 | </h2> |
| 17 | - <meta itemprop="about" content="<?php echo esc_attr($trip->getTitle()); ?>"> | |
| 18 | 20 | </div> |
| 19 | 21 | |
| 20 | 22 | <?php |
| 21 | 23 | // Use dynamic reviews from database (via SingleTripController) |
| @@ -65,10 +67,13 @@ | ||
| 65 | 67 | <span class="yatra-rating-max">/5</span> |
| 66 | 68 | </div> |
| 67 | 69 | <div class="yatra-overall-stars"> |
| 68 | 70 | <?php |
| 69 | - $full_stars = floor($avg_rating); | |
| 70 | - $has_half = ($avg_rating - $full_stars) >= 0.3; | |
| 71 | + // Same helper as the confirmation page and listing cards, so a | |
| 72 | + // rating never renders differently on two screens. | |
| 73 | + $star_parts = yatra_rating_star_parts($avg_rating); | |
| 74 | + $full_stars = $star_parts['full']; | |
| 75 | + $has_half = $star_parts['half']; | |
| 71 | 76 | for ($i = 1; $i <= 5; $i++): |
| 72 | 77 | if ($i <= $full_stars): |
| 73 | 78 | ?> |
| 74 | 79 | <span class="yatra-star-icon filled">★</span> |
| @@ -78,9 +83,12 @@ | ||
| 78 | 83 | <span class="yatra-star-icon">★</span> |
| 79 | 84 | <?php endif; endfor; ?> |
| 80 | 85 | </div> |
| 81 | 86 | <p class="yatra-reviews-based-on"> |
| 82 | - <?php echo esc_html(sprintf(_n('based on %s review', 'based on %s reviews', $total_reviews, 'yatra'), number_format($total_reviews))); ?> | |
| 87 | + <?php | |
| 88 | + /* translators: %s: formatted total number of reviews. */ | |
| 89 | + echo esc_html(sprintf(_n('based on %s review', 'based on %s reviews', $total_reviews, 'yatra'), number_format($total_reviews))); | |
| 90 | + ?> | |
| 83 | 91 | </p> |
| 84 | 92 | </div> |
| 85 | 93 | |
| 86 | 94 | <div class="yatra-rating-distribution"> |
| @@ -123,9 +131,9 @@ | ||
| 123 | 131 | <?php foreach ($display_reviews as $review): |
| 124 | 132 | $review_rating = is_object($review) ? ($review->rating ?? 5) : ($review['rating'] ?? 5); |
| 125 | 133 | $review_title = is_object($review) ? ($review->title ?? '') : ($review['title'] ?? ''); |
| 126 | 134 | $review_content = is_object($review) ? ($review->content ?? '') : ($review['content'] ?? ''); |
| 127 | - $review_author = is_object($review) ? ($review->author_name ?? 'Anonymous') : ($review['author_name'] ?? 'Anonymous'); | |
| 135 | + $review_author = is_object($review) ? ($review->author_name ?? __('Anonymous', 'yatra')) : ($review['author_name'] ?? __('Anonymous', 'yatra')); | |
| 128 | 136 | $review_location = is_object($review) ? ($review->author_location ?? '') : ($review['author_location'] ?? ''); |
| 129 | 137 | $review_date = is_object($review) ? ($review->created_at ?? '') : ($review['created_at'] ?? ''); |
| 130 | 138 | $review_user_id = is_object($review) ? ($review->user_id ?? 0) : ($review['user_id'] ?? 0); |
| 131 | 139 | $is_verified = $review_user_id > 0; |
| @@ -223,9 +231,12 @@ | ||
| 223 | 231 | <div class="yatra-review-edit-notice"> |
| 224 | 232 | <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 225 | 233 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/> |
| 226 | 234 | </svg> |
| 227 | - <p><?php echo esc_html(sprintf(__('You can edit your review for %s more.', 'yatra'), $edit_time_remaining)); ?></p> | |
| 235 | + <p><?php | |
| 236 | + /* translators: %s: remaining edit time (e.g. "12 minutes"). */ | |
| 237 | + echo esc_html(sprintf(__('You can edit your review for %s more.', 'yatra'), $edit_time_remaining)); | |
| 238 | + ?></p> | |
| 228 | 239 | </div> |
| 229 | 240 | <?php else: ?> |
| 230 | 241 | <h3 class="yatra-review-form-title"><?php echo esc_html__('Write a Review', 'yatra'); ?></h3> |
| 231 | 242 | <?php endif; ?> |
| @@ -267,9 +278,12 @@ | ||
| 267 | 278 | <label for="rating-<?php echo $i; ?>" class="yatra-star-label" title="<?php echo esc_attr(sprintf(__('%d star', 'yatra'), $i)); ?>">★</label> |
| 268 | 279 | <?php endfor; ?> |
| 269 | 280 | </div> |
| 270 | 281 | <?php if ($minimum_rating > 1): ?> |
| 271 | - <p class="yatra-field-hint"><?php echo esc_html(sprintf(__('Minimum rating: %d star(s)', 'yatra'), $minimum_rating)); ?></p> | |
| 282 | + <p class="yatra-field-hint"><?php | |
| 283 | + /* translators: %d: minimum allowed star rating. */ | |
| 284 | + echo esc_html(sprintf(__('Minimum rating: %d star(s)', 'yatra'), $minimum_rating)); | |
| 285 | + ?></p> | |
| 272 | 286 | <?php endif; ?> |
| 273 | 287 | </div> |
| 274 | 288 | |
| 275 | 289 | <!-- Title --> |