Opened 6 years ago
Closed 6 years ago
#45769 closed defect (bug) (fixed)
Expose JSON translation file paths
Reported by: | swissspidy | Owned by: | ocean90 |
---|---|---|---|
Milestone: | 5.0.3 | Priority: | normal |
Severity: | normal | Version: | 5.0.2 |
Component: | I18N | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
As noted by @johnbillion in 45425#comment:5, the potential translation file paths aren't exposed in load_script_textdomain()
/ load_script_translations()
.
The determined paths are only passed to load_script_translations()
when the files exist. If they don't, load_script_translations()
only receives false
.
This way it's impossible to hook into this for proper debugging like in Query Monitor, or adding language fallbacks like in the Preferred Languages feature plugin.
Attachments (2)
Change History (14)
#1
@
6 years ago
- Milestone changed from Awaiting Review to 5.0.3
- Type changed from enhancement to defect (bug)
#4
@
6 years ago
- Keywords commit removed
I can't test this right now but it looks like this causes all the processing in load_script_textdomain()
to run three times if there are no translation files present. At the moment, the file_exists()
checks guard against this.
#5
@
6 years ago
I don't see how this would run all of that three times. 🤔It just goes through the whole function and calls load_script_translations()
for all cases instead of returning early.
#6
@
6 years ago
@johnbillion have you had a chance to test this? It would be great to get this into 5.0.3.
#8
@
6 years ago
I think we shouldn't call load_script_translations()
if $path
wasn't set like before, see 45769.2.diff.
#9
@
6 years ago
@swissspidy Can you confirm that 45769.2.diff would still work with whatever you had in mind for making it compatible with Preferred Languages?
cc @herregroen for review