Making WordPress.org


Ignore:
Timestamp:
03/07/2024 06:39:00 AM (2 years ago)
Author:
akirk
Message:

Translate Events: add languages and contributors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event.php

    r13268 r13298  
    4747                <?php if ( ! empty( $event_stats->rows() ) ) : ?>
    4848        <div class="event-details-stats">
    49                 <h2>Stats</h2>
     49                <h2><?php esc_html_e( 'Stats', 'gp-translation-events' ); ?></h2>
    5050                <table>
    5151                        <thead>
     
    5959                        <tbody>
    6060                        <?php /** @var $row Stats_Row */ ?>
    61                         <?php foreach ( $event_stats->rows() as $locale_ => $row ) : ?>
     61                        <?php foreach ( $event_stats->rows() as $_locale => $row ) : ?>
    6262                        <tr>
    63                                 <td><?php echo esc_html( $locale_ ); ?></td>
     63                                <td title="<?php echo esc_html( $_locale ); ?> "><a href="<?php echo esc_url( gp_url_join( gp_url( '/languages' ), $row->language->slug ) ); ?>"><?php echo esc_html( $row->language->english_name ); ?></a></td>
    6464                                <td><?php echo esc_html( $row->created ); ?></td>
    6565                                <td><?php echo esc_html( $row->reviewed ); ?></td>
     
    7676                </table>
    7777        </div>
     78        <div class="event-contributors">
     79                <h2><?php esc_html_e( 'Contributors', 'gp-translation-events' ); ?></h2>
     80                <ul>
     81                        <?php foreach ( $contributors as $contributor ) : ?>
     82                        <li class="event-contributor" title="<?php echo esc_html( implode( ', ', $contributor->locales ) ); ?>"
     83                                <a href="<?php echo esc_url( get_author_posts_url( $contributor->ID ) ); ?>"><?php echo get_avatar( $contributor->ID, 48 ); ?></a>
     84                                <a href="<?php echo esc_url( get_author_posts_url( $contributor->ID ) ); ?>"><?php echo esc_html( get_the_author_meta( 'display_name', $contributor->ID ) ); ?></a>
     85                        </li>
     86                <?php endforeach; ?>
     87                </ul>
     88        </div>
    7889        <details class="event-stats-summary">
    7990                <summary>View stats summary in text </summary>
    80                 <p class="event-stats-text"><?php echo esc_html( sprintf( 'At the %s event, %d people contributed in %d languages (%s), translated %d strings and reviewed %d strings.', esc_html( $event_title ), esc_html( $event_stats->totals()->users ), count( $event_stats->rows() ), esc_html( implode( ',', array_keys( $event_stats->rows() ) ) ), esc_html( $event_stats->totals()->created ), esc_html( $event_stats->totals()->reviewed ) ) ); ?></p>
     91                <p class="event-stats-text">
     92                        <?php
     93                        echo wp_kses(
     94                                sprintf(
     95                                        // translators: %1$s: Event title, %2$d: Number of contributors, %3$d: Number of languages, %4$s: List of languages, %5$d: Number of strings translated, %6$d: Number of strings reviewed.
     96                                        __( 'At the <strong>%1$s</strong> event, %2$d people contributed in %3$d languages (%4$s), translated %5$d strings and reviewed %6$d strings.', 'gp-translation-events' ),
     97                                        esc_html( $event_title ),
     98                                        esc_html( $event_stats->totals()->users ),
     99                                        count( $event_stats->rows() ),
     100                                        esc_html(
     101                                                implode(
     102                                                        ', ',
     103                                                        array_map(
     104                                                                function ( $row ) {
     105                                                                        return $row->language->english_name;
     106                                                                },
     107                                                                $event_stats->rows()
     108                                                        )
     109                                                )
     110                                        ),
     111                                        esc_html( $event_stats->totals()->created ),
     112                                        esc_html( $event_stats->totals()->reviewed )
     113                                ),
     114                                array(
     115                                        'strong' => array(),
     116                                )
     117                        );
     118                        ?>
     119                        <?php
     120                        echo esc_html(
     121                                sprintf(
     122                                        // translators: %s the contributors.
     123                                        __( 'Contributors were %s.', 'gp-translation-events' ),
     124                                        esc_html(
     125                                                implode(
     126                                                        ', ',
     127                                                        array_map(
     128                                                                function ( $contributor ) {
     129                                                                        return '@' . $contributor->user_login;
     130                                                                },
     131                                                                $contributors
     132                                                        )
     133                                                )
     134                                        )
     135                                )
     136                        );
     137                        ?>
     138                        </p>
    81139        </details>
    82         <?php endif ?>
     140
     141        <?php endif; ?>
    83142        </div>
    84143        <div class="event-details-right">
Note: See TracChangeset for help on using the changeset viewer.