#47108 closed enhancement (duplicate)
Plugin and theme language packs are not downloaded when changing language
Reported by: | afercia | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.6 |
Component: | I18N | Keywords: | |
Focuses: | Cc: |
Description
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 returnstrue
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
andthemes
sub-directories underbuild/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 theplugins
andthemes
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 :)
Duplicate of #30559.