Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#46277 closed defect (bug) (fixed)

Remove trailing space from strings

Reported by: dimadin's profile dimadin Owned by: swissspidy's profile swissspidy
Milestone: 5.1.1 Priority: normal
Severity: minor Version: 5.1
Component: I18N Keywords: has-patch commit
Focuses: Cc:

Description

[43436] introduced new strings to plugins install table that are displayed when plugin is requiring higher version of WordPress or PHP than one currently installed.

Problem is that three strings (sentences) end with trailing space. That's done because after those sentences there might be another sentence if logged in user has necessary capability.

This is wrong way to do. Translators might not notice trailing space, and certainly don't know that this is done on purpose without looking at source code first.

Attached patch fixes this.

Attachments (1)

46277.diff (3.0 KB) - added by dimadin 6 years ago.

Download all attachments as: .zip

Change History (12)

@dimadin
6 years ago

#1 @pento
6 years ago

  • Milestone changed from Awaiting Review to 5.1.1

This ticket was mentioned in Slack in #core-i18n by lukecarbis. View the logs.


6 years ago

#3 @swissspidy
6 years ago

  • Owner set to swissspidy
  • Status changed from new to reviewing

This ticket was mentioned in Slack in #polyglots by lukecarbis. View the logs.


6 years ago

This ticket was mentioned in Slack in #core by lukecarbis. View the logs.


6 years ago

This ticket was mentioned in Slack in #core by pbiron. View the logs.


6 years ago

#7 @pbiron
6 years ago

  • Keywords commit added

#8 @dmsnell
6 years ago

Won't this still cause problems for languages that don't separate sentences with a leading space?

Maybe while updating here we could think of some HTML structure that would help eliminate the awkward whitespace in the translation?

Or, although it feels arduous to repeat strings, in similar situations I've doubled the strings so that the translators can get atomic units of text to work with and make sentence splits as is appropriate for their language. this doesn't feel good as a programmer but it does resolve the kinds of translation bugs introduced by mixing translated strings with untranslated strings and with concatenating translated strings.

<?php
if ( ! $compatible_php && ! $compatible_wp && $can_update_core && $can_update_php ) {
    return __( 'This plugin doesn&#8217;t work with your versions of WordPress and PHP. <a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' );
}

if ( ! $compatible_php && ! $compatible_wp && $can_update_core ) {
    return __( 'This plugin doesn&#8217;t work with your versions of WordPress and PHP. <a href="%s">Please update WordPress</a>.' );
}

if ( ! $compatible_php && ! $compatible_wp && $can_update_php ) {
    return __( 'This plugin doesn&#8217;t work with your versions of WordPress and PHP. <a href="%s">Learn more about updating PHP</a>.' );
}

if ( ! $compatible_php ) {
    return __( 'This plugin doesn&#8217;t work with your versions of WordPress and PHP.' );
}

if ( ! $compatible_wp && $can_update_core ) {
    return __( 'This plugin doesn&#8217;t work with your version of WordPress. <a href="%s">Please update WordPress</a>.' );
}

if ( ! $compatible_wp ) {
    return __( 'This plugin doesn&#8217;t work with your version of WordPress.' );
}

if ( ! $compatible_php && $can_update_php ) {
    return __( 'This plugin doesn&#8217;t work with your version of PHP. <a href="%s">Learn more about updating PHP</a>.' );
}

if ( ! $compatible_phyp ) {
    return __(  'This plugin doesn&#8217;t work with your version of PHP.' );
}

#9 @SergeyBiryukov
6 years ago

46277.diff looks good to me and is consistent with many other similar instances in core. Good catch, @dimadin!

#10 @SergeyBiryukov
6 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 44797:

I18N: Remove trailing spaces from translatable strings introduced in [43436].

Props dimadin.
Fixes #46277.

#11 @SergeyBiryukov
6 years ago

In 44798:

I18N: Remove trailing spaces from translatable strings introduced in [43436].

Props dimadin.
Merges [44797] to the 5.1 branch.
Fixes #46277.

Note: See TracTickets for help on using tickets.