[wp-trac] [WordPress Trac] #46683: Site Health: audit the translation functions

WordPress Trac noreply at wordpress.org
Sat Mar 30 11:55:53 UTC 2019


#46683: Site Health: audit the translation functions
-------------------------------------+-------------------------------
 Reporter:  afercia                  |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  5.2
Component:  Administration           |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  needs-patch site-health  |     Focuses:  coding-standards
-------------------------------------+-------------------------------

Old description:

> Splitting this out from
> https://core.trac.wordpress.org/ticket/46573#comment:46
>
> This kind of strings:
>
> `<span class="issue-count">0</span> <?php _e( 'Critical issues' ); ?>`
>
> (note: the count gets updated via JavaScript) are not translatable in
> languages that have multiple plural forms. This needs to be changed and
> meet the best practices used in core for proper localization. There are a
> few cases like this that should be addressed.
>
> To my knowledge, the best option is to use a placeholder that gets then
> replaced via JavaScript: I see in other parts of the Site Health code
> this is implemented correctly.
>
> /Cc @SergeyBiryukov
>
> Also, I'd argue the following usages of context:
>
> `_ex( 'Site Health', 'Menu, Section and Page Title' )`
>
> is not the best way to use the context parameter: the context shouldn't
> be an "explanation". Instead, it should be a very short reference to
> _what_ the strings refers to, meant to avoid collisions with similar
> translatable text. Also, in this specific case, not sure what is the
> value added by specifying "Menu, Section and Page Title".

New description:

 Splitting this out from
 https://core.trac.wordpress.org/ticket/46573#comment:46

 This kind of strings:

 `<span class="issue-count">0</span> <?php _e( 'Critical issues' ); ?>`

 (note: the count gets updated via JavaScript) are not translatable in
 languages that have multiple plural forms. This needs to be changed and
 meet the best practices used in core for proper localization. There are a
 few cases like this that should be addressed.

 To my knowledge, the best option is to use a placeholder that gets then
 replaced via JavaScript: I see in other parts of the Site Health code this
 is implemented correctly.

 /Cc @SergeyBiryukov

 Also, I'd argue the following usages of context:

 `_ex( 'Site Health', 'Menu, Section and Page Title' )`

 is not the best way to use the context parameter: the context shouldn't be
 an "explanation". Instead, it should be a very short reference to ''what''
 the strings refer to, meant to avoid collisions with similar translatable
 text. Also, in this specific case, not sure what is the value added by
 specifying "Menu, Section and Page Title".

--

Comment (by afercia):

 +1 Thanks @ocean90

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


More information about the wp-trac mailing list