[wp-trac] [WordPress Trac] #46277: Remove trailing space from strings

WordPress Trac noreply at wordpress.org
Tue Mar 5 18:53:06 UTC 2019


#46277: Remove trailing space from strings
------------------------------+-------------------------
 Reporter:  dimadin           |       Owner:  swissspidy
     Type:  defect (bug)      |      Status:  reviewing
 Priority:  normal            |   Milestone:  5.1.1
Component:  I18N              |     Version:  5.1
 Severity:  minor             |  Resolution:
 Keywords:  has-patch commit  |     Focuses:
------------------------------+-------------------------

Comment (by dmsnell):

 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
 <?php
 if ( ! $compatible_php && ! $compatible_wp && $can_update_core &&
 $can_update_php ) {
     return __( 'This plugin doesn’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’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’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’t work with your versions of
 WordPress and PHP.' );
 }

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

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

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

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

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46277#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list