Making WordPress.org

Changeset 11051


Ignore:
Timestamp:
06/21/2021 08:02:08 PM (4 years ago)
Author:
ocean90
Message:

Translate: Simplify translations table.

The priority column is most of the time empty and as such a waste of space which is better used to enhance the display of originals and translations. The priority column is now hidden and if an original is marked as high or low priority it is displayed right next to the original similiar to the existing context bubble.
The context is now also hidden if it doesn't provide any new information to translators. This is the mostly case when the context is the same or a cut-off version of the original.

Fixes #5778.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/helper-functions.php

    r11043 r11051  
    314314    <?php
    315315}
     316
     317/**
     318 * Whether to show the context or not.
     319 *
     320 * Prevents displaying the context if it doesn't provide any new information
     321 * to the translator.
     322 * Especially for mobile projects the context is mostly a duplicate of the singular string.
     323 *
     324 * @param \Translation_Entry $translation Current translation entry.
     325 * @return bool Whether to show the context or not.
     326 */
     327function wporg_gp_should_display_original_context( $translation ) {
     328    // No context available.
     329    if ( ! $translation->context ) {
     330        return false;
     331    }
     332
     333    // Context is the same as the singular.
     334    if ( $translation->singular === $translation->context ) {
     335        return false;
     336    }
     337
     338    // Context was cut-off due to VARCHAR(255) in the database schema.
     339    if ( 255 === mb_strlen( $translation->context ) && 0 === strpos( $translation->singular, $translation->context ) ) {
     340        return false;
     341    }
     342
     343    return true;
     344}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/style.css

    r11042 r11051  
    346346}
    347347
    348 span.context {
    349     font-size: 90%;
     348span.context,
     349span.priority {
     350    color: #1e1e1e;
     351    font-size: 12px;
    350352    padding: .1em 0;
    351353    margin-left: .2em;
     
    354356    box-decoration-break: clone;
    355357    box-shadow: .3em 0 0 #a0a5aa, -.3em 0 0 #a0a5aa;
     358    border-radius: 0;
     359}
     360
     361span.context + span.priority {
     362    margin-left: 1em;
     363}
     364
     365.priority-high span.priority {
     366    color: #fff;
     367    background-color: rgba( 154, 35, 35, 0.65 );
     368    box-shadow: 0.3em 0 0 rgba( 154, 35, 35, 0.65 ), -0.3em 0 0 rgba( 154, 35, 35, 0.65 );
     369}
     370
     371.priority-low span.priority {
     372    background-color: rgba( 213, 213, 213, 0.65 );
     373    box-shadow: 0.3em 0 0 rgba( 213, 213, 213, 0.65 ), -0.3em 0 0 rgba( 213, 213, 213, 0.65 );
    356374}
    357375
     
    384402}
    385403
    386 table.translations td.original ul:not(:last-child),
    387 table.translations td.translation ul:not(:last-child) {
    388     margin-bottom: .2em;
     404.original-tags {
     405    margin-top: .2em;
    389406}
    390407
     
    448465
    449466table.translations tr:nth-child(4n+3),
     467table.locale-sub-projects tr:nth-child(even),
    450468.translation-sets tr,
    451469.locales tr {
     
    10111029    float: right;
    10121030    width: 250px;
    1013     border: 1px solid #ccc;
     1031    border: 1px solid #72777c;
    10141032    box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
    10151033    background: #fff;
     
    10251043    margin: 0 0 2.083% 2.083%;
    10261044    width: 47.917%;
    1027     border: 1px solid #ccc;
     1045    border: 1px solid #72777c;
    10281046    box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
    10291047    background: #fff;
     
    10531071.projects .project-name h4 {
    10541072    border: 0;
    1055     margin: 0 0 12px;
     1073    margin: 0 0 8px;
    10561074    font-size: 18px;
    10571075    font-weight: 600;
     
    10611079.projects .project-description {
    10621080    font-size: 13px;
     1081    border-left: 0;
     1082    margin-top: 0;
     1083    padding: 0;
    10631084}
    10641085
     
    11701191    margin-left: 0;
    11711192    max-width: 100%;
     1193    padding: 0;
     1194    border: 0;
    11721195}
    11731196
     
    11761199    width: 350px;
    11771200    margin-left: 20px;
    1178     border: 1px solid #ccc;
     1201    border: 1px solid #72777c;
    11791202    box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
    11801203    background: #fff;
     
    12661289
    12671290ul.projects-dropdown {
    1268     border-top: 1px solid #ccc;
     1291    border-top: 1px solid #72777c;
    12691292}
    12701293
     
    12981321    width: 100%;
    12991322    background: #f9f9f9;
    1300     border: 1px solid #ccc;
     1323    border: 1px solid #72777c;
    13011324    border-top: 0;
    13021325    box-shadow: 1px 1px 1px 0 rgba(0,0,0,0.04);
     
    16421665    float: right;
    16431666    margin: -30px 0 5px 5px;
    1644     background-color: #72777c;
     1667    background-color: #e2e4e7;
    16451668    padding: 5px;
    16461669    border: 1px solid #dfdfdf;
     
    18871910.locale-project-contributors-group hr {
    18881911    margin: 30px 0;
     1912    border-color: #72777c;
    18891913}
    18901914
     
    23112335}
    23122336
    2313 table.translations th.priority {
    2314     width: 2em;
    2315     text-align: center;
     2337table.translations th.priority,
     2338table.translations td.priority {
     2339    display: none;
    23162340}
    23172341
     
    25882612}
    25892613
    2590 .source-details details + details{
     2614.source-details details + details {
    25912615    margin-top: 5px;
    25922616}
     
    25952619    word-wrap: break-word;
    25962620    overflow-wrap: break-word;
     2621}
     2622
     2623.source-details__context .context {
     2624    font-size: 100%;
     2625    background: transparent;
     2626    box-shadow: none;
     2627    margin: 0;
     2628    padding: 0;
    25972629}
    25982630
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/translation-row-preview.php

    r11042 r11051  
    4141            <?php
    4242        endif;
     43        ?>
    4344
    44         if ( $translation->context ) :
     45        <div class="original-tags">
     46            <?php
     47            if ( wporg_gp_should_display_original_context( $translation ) ) :
     48                ?>
     49                <span class="context bubble"><?php echo esc_html( $translation->context ); ?></span>
     50                <?php
     51            endif;
     52
     53            if ( '1' === $translation->priority || '-1' === $translation->priority ) :
     54                ?>
     55                <span class="priority bubble"><?php echo esc_html( sprintf( 'Priority: %s', gp_array_get( GP::$original->get_static( 'priorities' ), $translation->priority ) ) ); ?></span>
     56                <?php
     57            endif;
    4558            ?>
    46             <span class="context bubble"><?php echo esc_html( $translation->context ); ?></span>
    47             <?php
    48         endif;
    49         ?>
     59        </div>
    5060    </td>
    5161    <td class="translation foreign-text">
Note: See TracChangeset for help on using the changeset viewer.