[wp-trac] [WordPress Trac] #62154: Latest beta Warnings Function load_plugin_textdomain was called incorrectly.
WordPress Trac
noreply at wordpress.org
Mon Oct 7 13:14:11 UTC 2024
#62154: Latest beta Warnings Function load_plugin_textdomain was called
incorrectly.
--------------------------+------------------------
Reporter: neo2k23 | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: I18N | Version: trunk
Severity: normal | Resolution: duplicate
Keywords: | Focuses:
--------------------------+------------------------
Comment (by sarapalmerdev):
Replying to [comment:15 room34]:
> Here's another unexpected twist. I'm just trying to add translation
support to another of my plugins. I use Poedit for this, as is recommended
in the documentation:
https://developer.wordpress.org/plugins/internationalization/localization/#poedit
>
> Poedit would not generate the `.pot` file, saying the plugin was not
translation-ready. An error in the Poedit log file indicated that
`load_plugin_textdomain()` was missing, among a couple of other things. I
temporarily added the function call to the plugin, and Poedit was then
able to create the file.
>
> I did confirm that Poedit seems to be able to work with the plugin fine
after creating the `.pot` file even with `load_plugin_textdomain()`
removed; it just needs to be in the plugin during the initial file
creation. Still, this is likely why a lot of plugins call that function
even if they technically don't need to, and I'm sure many of plugin
developers also use Poedit.
>
> From what I've seen here, this likely won't be an issue if plugins don't
call the function too early, but it does complicate the suggestion that
plugins don't need to call the function at all.
>
> UPDATE: Well, I feel a bit silly about this. I realized shortly after I
posted this that there's another option… if the comments at the top of the
main plugin file include `Domain Path:` then `load_plugin_textdomain()` is
not needed for Poedit to generate the file. Still… since a lot of plugins
(not just mine) are generating the error, it's worth mentioning.
Thanks for the update
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62154#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list