[wp-meta] [Making WordPress.org] #2035: Improve i18n in Ratings_Compat

Making WordPress.org noreply at wordpress.org
Wed Sep 14 20:01:06 UTC 2016


#2035: Improve i18n in Ratings_Compat
------------------------------+--------------------------
 Reporter:  SergeyBiryukov    |       Owner:  coffee2code
     Type:  defect            |      Status:  closed
 Priority:  normal            |   Milestone:
Component:  Support Forums    |  Resolution:  fixed
 Keywords:  has-patch commit  |
------------------------------+--------------------------

Comment (by coffee2code):

 Thanks again, @SergeyBiryukov!

 Your patch went in minus the change of:

 {{{
 $stars_text = sprintf( __( '%d stars', 'wporg-forums' ), $rating );
 }}}

 to

 {{{
 $stars_text = sprintf(
         /* translators: %s: number of stars */
         _n( '%d star', '%d stars', $rating, 'wporg-     $rating
 );
 }}}

 In order to maintain the alignment of the per-rating bars, the labels that
 precede them must be of equal width, thus the text must contain the same
 amount of characters. There are options for making the text truly
 translatable according to number, but there are enough considerations to
 warrant a separate ticket.

 Possible approaches:

 * Like amazon.com, use the singular of all the star labels (e.g. `5 star`,
 `4 star`).
 * Move the labels to the right of the bars, thus label length does not
 matter. But given the per-rating counts are already after the bars, the
 labels would then contain both pieces of information (e.g. `5 stars
 (106)`, ... `1 star (32)`)
 * Set some fixed width for the labels. This could look wonky for languages
 that have long translations that would wrap, or if we accommodate most of
 those, then translations (like English) might have excessive space between
 the label and the bar.
 * Character padding to ensure equal length of labels (inexact unless the
 font is fixed-width).

 I vote for the simplicity of the first option, but I'm sure others have
 opinions and ideas.

--
Ticket URL: <https://meta.trac.wordpress.org/ticket/2035#comment:3>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list