Making WordPress.org

Changeset 13066


Ignore:
Timestamp:
12/18/2023 11:41:17 AM (7 months ago)
Author:
amieiro
Message:

Translate: Sync gp-translation-helpers from GitHub

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/css/discussion.css

    r12656 r13066  
    339339    font-size: 1em;
    340340}
     341
     342@keyframes loading-indicator {
     343    0%, 80%, 100% {
     344        opacity: 0;
     345    }
     346    40% {
     347        opacity: 1;
     348    }
     349}
     350
     351.suggestions__loading-indicator__icon {
     352    font-size: 4px;
     353    margin-left: .5rem;
     354    line-height: 1;
     355    display: inline-block;
     356    vertical-align: middle;
     357}
     358
     359.suggestions__loading-indicator__icon span {
     360    animation-duration: 1s;
     361    animation-delay: 0ms;
     362    animation-iteration-count: infinite;
     363    animation-name: loading-indicator;
     364    animation-timing-function: ease-in-out;
     365    background-color: #666;
     366    border-radius: 50%;
     367    display: inline-block;
     368    width: 1em;
     369    vertical-align: top;
     370    height: 1em;
     371}
     372
     373.suggestions__loading-indicator__icon span:nth-child(2) {
     374    animation-delay: 160ms;
     375    margin-left: 1em;
     376}
     377
     378.suggestions__loading-indicator__icon span:nth-child(3) {
     379    animation-delay: 320ms;
     380    margin-left: 1em;
     381}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/css/editor.css

    r12405 r13066  
    66}
    77
    8 .meta.discussion, .meta.history, .meta.other-locales {
     8.meta.discussion, .meta.others {
    99    padding: 1rem;
    1010}
     11
    1112.meta.discussion h6 {
    1213    margin-block: auto;
    1314}
    1415
    15 .meta.history .translations {
     16.meta.others .details-history,
     17.meta.others .details-other-locales {
     18    margin: 1rem 0 -0.5rem 0;
     19}
     20
     21.meta.others .summary-history,
     22.meta.others .summary-other-locales {
     23    font-weight: bold;
     24    margin-bottom: 0.5rem;
     25}
     26
     27.meta.others .sidebar-div-others-history-content {
     28    margin-left: 0.5rem;
     29}
     30
     31.meta.others .translations {
    1632    width: 100%;
    1733}
    18 .meta.history #translation-history-table thead tr th {
     34
     35.meta.others #translation-history-table thead tr th {
    1936    font-size: 0.9rem;
    2037    font-weight: 500 !important;
    2138}
    2239
    23 .meta.history #legend > div {
     40.meta.others #legend > div {
    2441    margin-top: 0.5rem;
    2542}
    2643
    27 .meta.other-locales ul {
     44.meta.others ul {
    2845    list-style: none;
    2946}
    3047
    31 .meta.other-locales span.locale.unique {
    32     margin-right: 26px;
     48.meta.others span.locale.unique {
     49    margin-right: 0.5rem;
    3350}
    3451
    35 .meta.other-locales .other-locales .locale {
     52.meta.others .other-locales .locale {
    3653    display: inline-block;
    3754    padding: 1px 6px 0 0;
     
    4461}
    4562
    46 .meta.other-locales .sidebar-other-locales {
     63.sidebar-div-others-other-locales-content > ul {
     64    padding-left: 1rem;
     65}
     66
     67.meta.others .sidebar-other-locales {
    4768    margin: 0.1rem .5rem;
    4869}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/js/editor.js

    r12713 r13066  
    1 /* global document, $gp, $gp_translation_helpers_editor, wpApiSettings, $gp_comment_feedback_settings, $gp_editor_options, fetch, TextDecoderStream, URL, URLSearchParams, window */
     1/* global document, $gp, $gp_translation_helpers_editor, wpApiSettings, $gp_comment_feedback_settings, $gp_editor_options, fetch, TextDecoderStream, URL, URLSearchParams, window, translationHelpersCache, add_amount_to_others_tab */
    22/* eslint camelcase: "off" */
    33jQuery( function( $ ) {
     
    55     * Stores (caches) the content of the translation helpers, to avoid making the query another time.
    66     *
    7      * @type {Array}
     7     * @type {Object}
    88     */
    99    // eslint-disable-next-line prefer-const
    10     let translationHelpersCache = [];
     10    window.translationHelpersCache = {};
     11
    1112    let focusedRowId = '';
    1213    // When a user clicks on a sidebar tab, the visible tab and div changes.
     
    233234        $( '#sidebar-div-meta-' + originalId ).hide();
    234235        $( '#sidebar-div-discussion-' + originalId ).hide();
    235         $( '#sidebar-div-history-' + originalId ).hide();
    236         $( '#sidebar-div-other-locales-' + originalId ).hide();
     236        $( '#sidebar-div-others-' + originalId ).hide();
    237237        $( '#' + tabId ).show();
    238238    }
     
    250250            $( this ).html( html );
    251251        } );
     252    }
     253
     254    /**
     255     * Adds the amount of elements to the "Others" tab.
     256     *
     257     * @param {string} sidebarTab The tab where we add the amount of elements.
     258     * @param {Object} data       The object where we have the data to add.
     259     * @param {number} originalId The id of the original string to translate.
     260     */
     261    if ( typeof window.add_amount_to_others_tab === 'undefined' ) {
     262        add_amount_to_others_tab = function( sidebarTab, data, originalId ) {
     263            let elements = 0;
     264            if ( data[ 'helper-history-' + originalId ] !== undefined ) {
     265                elements += data[ 'helper-history-' + originalId ].count;
     266            }
     267            if ( data[ 'helper-other-locales-' + originalId ] !== undefined ) {
     268                elements += data[ 'helper-other-locales-' + originalId ].count;
     269            }
     270            $( '[data-tab="' + sidebarTab + '"]' ).html( 'Others (' + elements + ')' );
     271        };
    252272    }
    253273
     
    284304        }
    285305        if ( data[ 'helper-history-' + originalId ] !== undefined ) {
    286             $( '[data-tab="sidebar-tab-history-' + originalId + '"]' ).html( 'History (' + data[ 'helper-history-' + originalId ].count + ')' );
    287             $( '#sidebar-div-history-' + originalId ).html( data[ 'helper-history-' + originalId ].content );
     306            $( '#summary-history-' + originalId ).html( 'History (' + data[ 'helper-history-' + originalId ].count + ')' );
     307            $( '#sidebar-div-others-history-content-' + originalId ).html( data[ 'helper-history-' + originalId ].content );
     308            add_amount_to_others_tab( 'sidebar-tab-others-' + originalId, data, originalId );
     309        } else {
     310            $( '#sidebar-div-others-history-content-' + originalId ).html( '' );
    288311        }
    289312        if ( data[ 'helper-other-locales-' + originalId ] !== undefined ) {
    290             $( '[data-tab="sidebar-tab-other-locales-' + originalId + '"]' ).html( 'Other locales (' + data[ 'helper-other-locales-' + originalId ].count + ')' );
    291             $( '#sidebar-div-other-locales-' + originalId ).html( data[ 'helper-other-locales-' + originalId ].content );
    292             add_copy_button( '#sidebar-div-other-locales-' + originalId );
     313            $( '#summary-other-locales-' + originalId ).html( 'Other locales (' + data[ 'helper-other-locales-' + originalId ].count + ')' );
     314            $( '#sidebar-div-others-other-locales-content-' + originalId ).html( data[ 'helper-other-locales-' + originalId ].content );
     315            add_copy_button( '#sidebar-div-others-other-locales-content-' + originalId );
     316            add_amount_to_others_tab( 'sidebar-tab-others-' + originalId, data, originalId );
     317        } else {
     318            $( '#sidebar-div-others-other-locales-content-' + originalId ).html( '' );
    293319        }
    294320    }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/templates/gp-templates-overrides/translation-row-editor-meta.php

    r12405 r13066  
    172172$sidebar_tabs .= '  <li class="current tab-meta" data-tab="sidebar-tab-meta-' . $translation->row_id . '" data-row-id="' . $translation->row_id . '">Meta</li>';
    173173$sidebar_tabs .= '  <li class="tab-discussion" data-tab="sidebar-tab-discussion-' . $translation->row_id . '" data-row-id="' . $translation->row_id . '">Discussion&nbsp;<span class="count"></span></li>';
    174 $sidebar_tabs .= '  <li class="tab-history" data-tab="sidebar-tab-history-' . $translation->row_id . '" data-row-id="' . $translation->row_id . '">History&nbsp;<span class="count"></span></li>';
    175 $sidebar_tabs .= '  <li class="tab-other-locales" data-tab="sidebar-tab-other-locales-' . $translation->row_id . '" data-row-id="' . $translation->row_id . '">Other&nbsp;locales&nbsp;<span class="count"></span></li>';
     174$sidebar_tabs .= '  <li class="tab-others" data-tab="sidebar-tab-others-' . $translation->row_id . '" data-row-id="' . $translation->row_id . '">Others&nbsp;<span class="count"></span></li>';
    176175$sidebar_tabs .= '</ul>';
    177176$sidebar_tabs .= $meta_sidebar;
    178177$sidebar_tabs .= '<div class="meta discussion" id="sidebar-div-discussion-' . $translation->row_id . '"  data-row-id="' . $translation->row_id . '" style="display: none;"></div>';
    179 $sidebar_tabs .= '<div class="meta history" id="sidebar-div-history-' . $translation->row_id . '"  data-row-id="' . $translation->row_id . '" style="display: none;"></div>';
    180 $sidebar_tabs .= '<div class="meta other-locales" id="sidebar-div-other-locales-' . $translation->row_id . '"  data-row-id="' . $translation->row_id . '" style="display: none;"></div>';
     178$sidebar_tabs .= '<div class="meta others" id="sidebar-div-others-' . $translation->row_id . '"  data-row-id="' . $translation->row_id . '" style="display: none;">';
     179$sidebar_tabs .= '  <details class="details-other-locales" open="">';
     180$sidebar_tabs .= '      <summary class="summary-other-locales" id="summary-other-locales-' . $translation->row_id . '">Other locales';
     181$sidebar_tabs .= '          <span aria-hidden="true" class="suggestions__loading-indicator__icon"><span></span><span></span><span></span></span>';
     182$sidebar_tabs .= '      </summary>';
     183$sidebar_tabs .= '      <div class="sidebar-div-others-other-locales-content" id="sidebar-div-others-other-locales-content-' . $translation->row_id . '"></div>';
     184$sidebar_tabs .= '  </details>';
     185$sidebar_tabs .= '  <details class="details-history" open="">';
     186$sidebar_tabs .= '      <summary class="summary-history" id="summary-history-' . $translation->row_id . '">History';
     187$sidebar_tabs .= '          <span aria-hidden="true" class="suggestions__loading-indicator__icon"><span></span><span></span><span></span></span>';
     188$sidebar_tabs .= '      </summary>';
     189$sidebar_tabs .= '      <div class="sidebar-div-others-history-content" id="sidebar-div-others-history-content-' . $translation->row_id . '"></div>';
     190$sidebar_tabs .= '  </details>';
     191$sidebar_tabs .= '</div>'; /* meta others */
    181192$sidebar_tabs .= '</nav>';
    182193
Note: See TracChangeset for help on using the changeset viewer.