[wp-trac] [WordPress Trac] #11526: JavaScript l10n inconsistency

WordPress Trac noreply at wordpress.org
Sat Jan 15 20:26:37 UTC 2022


#11526: JavaScript l10n inconsistency
----------------------------+---------------------
 Reporter:  SergeyBiryukov  |       Owner:  nacin
     Type:  defect (bug)    |      Status:  closed
 Priority:  normal          |   Milestone:  3.3
Component:  I18N            |     Version:  2.9
 Severity:  normal          |  Resolution:  fixed
 Keywords:  has-patch       |     Focuses:
----------------------------+---------------------
Description changed by SergeyBiryukov:

Old description:

> After activating some plugins the standard messages displayed in the
> admin area using JavaScript (for example, the confirmation message when
> deleting categories or tags) become not localized.
>
> Among these plugins are the latest versions of Popularity Contest and
> Cimy User Extra Fields. It turns out they use {{{wp_enqueue_script()}}}
> and {{{wp_register_script()}}} functions not hooked to {{{init}}} action
> as [http://codex.wordpress.org/Function_Reference/wp_enqueue_script
> recommended by Codex], but instead right in the plugin body.
>
> The following code is currently used in Russian version to restore
> localization in this case:
> {{{
> function restore_scripts_l10n() {
>         global $wp_scripts;
>
>         if ( is_a($wp_scripts, 'WP_Scripts') ) {
>                 wp_default_scripts($wp_scripts);
>         }
> }
> add_action('init', 'restore_scripts_l10n');
> }}}
> However I think the more centralized solution is needed.

New description:

 After activating some plugins the standard messages displayed in the admin
 area using JavaScript (for example, the confirmation message when deleting
 categories or tags) become not localized.

 Among these plugins are the latest versions of Popularity Contest and Cimy
 User Extra Fields. It turns out they use {{{wp_enqueue_script()}}} and
 {{{wp_register_script()}}} functions not hooked to {{{init}}} action as
 [http://codex.wordpress.org/Function_Reference/wp_enqueue_script
 recommended by Codex], but instead right in the plugin body.

 The following code is currently used in Russian version to restore
 localization in this case:
 {{{
 function restore_scripts_l10n() {
         global $wp_scripts;

         if ( is_a($wp_scripts, 'WP_Scripts') ) {
                 wp_default_scripts($wp_scripts);
         }
 }
 add_action('init', 'restore_scripts_l10n');
 }}}
 However I think a more centralized solution is needed.

--

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


More information about the wp-trac mailing list