[wp-trac] [WordPress Trac] #47108: Plugin and theme language packs are not downloaded when changing language

WordPress Trac noreply at wordpress.org
Fri May 3 13:51:48 UTC 2019


#47108: Plugin and theme language packs are not downloaded when changing language
-------------------------+-----------------------------
 Reporter:  afercia      |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  I18N         |    Version:  4.6
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 When changing the WordPress language in Settings -> General, the ''core''
 language packs are immediately downloaded and available. However, the
 plugin and theme language packs aren't handled: at this point there are no
 .mo and .po files downloaded for the new language.

 Actually, the plugin and theme language packs are downloaded only after
 users go to the Updates page and click on "Update Translations".

 Code-wise this seems to be the intended behavior, but there are some
 undesirable side-effects:
 - User experience is not ideal: there's nothing to inform users they have
 to update to actually get plugins and themes translations.
 - Plugins (and themes) code relying on `is_textdomain_loaded()` will fail
 because the new language `.mo` file doesn't exist yet. While this is
 technically correct, it's a bit misleading as developers might expect it
 returns `true` once a new language has been set.

 To reproduce on trunk:
 - activate a plugin that is translated
 - delete the `build/wp-content/languages/` directory
 - go to Settings > General Settings and set a new language
 - observe the `build/wp-content/languages/` directory and see the ''core''
 language files are donwloaded immediately
 - see there are no `plugins` and `themes` sub-directories under `build/wp-
 content/languages/` directory
 - at this point, the WordPress core admin pages will be translated, the
 plugin / themes pages won't
 - go to the Updates page
 - click "Update Translations" (in whatever language it's displayed :) )
 - observe the `build/wp-content/languages/` directory and see that only
 now the `plugins` and `themes` sub-directories get created and actually
 contain the plugin / theme language packs

 I'd tend to think software should have smart default behaviors and not
 require users to do manual tasks that can be avoided. Seems to me a better
 behavior would be automatically downloading also the plugin and theme
 language packs.

 /Cc @swissspidy for his expertise and help in debugging this :)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47108>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list