[wp-trac] [WordPress Trac] #45488: wp_set_script_translations does not load md5-based PO files
WordPress Trac
noreply at wordpress.org
Wed Dec 5 16:42:26 UTC 2018
#45488: wp_set_script_translations does not load md5-based PO files
-------------------------------------+---------------------
Reporter: ettoredn | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.0.1
Component: I18N | Version: 5.0
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+---------------------
Comment (by ettoredn):
I actually dug deeper into the issue and **it seems to me that it is an
interop issue between the filename generation strategy used by wp-cli and
the one used by WP**.
wp-cli i18n make-json generates
{{{
<lang>-<filename_in_PO>.json
}}}
whereas WP sets $md5_filename to
{{{
<textdomain>-<lang>-<md5>.json
}}}
As previously stated, I'm assuming executing wp-cli i18n as
{{{
wp i18n make-json <my_theme>/languages
}}}
I also realized the ''md5 hash is computed from the relative filename
found in the PO file'' (e.g. "js/myscript.js") which is relative to the
path given to wp i18n's mandatory <source> parameter.
Moreover, I wonder whether l18n.php::load_script_textdomain():916 should
actually have the equality operator i.e.
{{{#!php
<?php
( ! isset( $src_url['host'] ) || $src_url['host'] === $content_url['host']
)
}}}
instead of
{{{#!php
<?php
( ! isset( $src_url['host'] ) || $src_url['host'] !== $content_url['host']
)
}}}
since the comment above states "**If the host is the same** or it's a
relative URL.". If so, the the same comparison at :926 appears to need to
be changed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45488#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list