-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix missing translations for Customizer #4184
Fix missing translations for Customizer #4184
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this might work, I have some concerns about the code.
- Is that using
glob()
might cause issues depending on the server. - Each script chunk is enqueued.
Can't this be fixed by modifying the webpack
config? I'm asking this just based on your findings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, that this will introduce a performance penalty due to the IO reads for unnecessary work since we don't need to read the folder at each load and it can be saved on build when the release is made since those filenames are never changed and are static. The only time when they are changed is on a new release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another solution is to tweak webpack to make a single file, but this will change the .pot
file, and I am not sure what the impact is in wp org. Does WP regenerate the .po
file along with .json
files based on the new references in .pot
file?
Can the ranking in store might be affected by this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Soare-Robert-Daniel wordpress.org generates the translation list based on the files, by extracting the texts from the files, not on the po/pot/json files, those are redundant, and they are not used on translation.wordpress.org.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one idea is similar how wp-scripts generates the assets.php file with the deps, generate a PHP file with the chunks list by webpack and require it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Soare-Robert-Daniel Tested and the issue is fixed now 👍 Here are the other strings in customizer which aren't translated (I don't know if it's related to this PR):
|
@irinelenache, yes, they are not related. Some are from Neve Pro, and others are from other plugins. Like Orbit Fox:
|
@Soare-Robert-Daniel Thank you for addressing the issues with the Customizer. But to completely close my report #4093 , I would like to point out that there are also problems with the missing translations of pages "About us" (themeisle-sdk) and "Otter Blocks". Thanks again. |
@DAnn2012, we are not providing any translation for the About Us page. That is a small module that is shared across all our products with the role of discovering our offerings, and its text domain is not tied to the products (some plugins might not detect if they scan only the theme/plugin level) If you have the Neve Pro Agency plan, you can remove that page via the White Label feature: https://docs.themeisle.com/article/1061-white-label-module-documentation |
@Soare-Robert-Daniel I understand. However, if in the future you want to add the possibility of translating this page, I would like to point out these links which concern the topic and that is the inclusion of the Not possible to include Vendor folder ignored wp-cli/i18n-command#172 Fix include logic where include path is subdirectory of excluded path. wp-cli/i18n-command#302 Line 9 in b4d6b67
Thanks. |
🎉 This PR is included in version 3.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
After some long debugging, the missing translations were caused by how we generated the JS build.
Alongside the main script
control.js
, some chunk files were generated by Webpack. Creating the.pot
file associated the labels with those chunks scripts.Thus, in the
wp-content/languages/theme
folder of WP, you will find JSON files like:Notice the
reference
that shows what is the associated file.The code here that loads the translation is incomplete because is loading the translations only for
control.js
file.The solution was to scan the folder for the chunks and apply the same process as we do for
control.js.
With this, the translation will be included in page like this:
Will affect visual aspect of the product
YES
Screenshots
Before
After
Test instructions
Check before Pull Request is ready:
Closes #4093