-
Notifications
You must be signed in to change notification settings - Fork 215
Added translation support for dashboard analytics report scripts #2791
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
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThe changes update text domains for internationalization from 'dokan' to 'dokan-lite' in several frontend components, add localization support for the vendor analytics script using Changes
Sequence Diagram(s)sequenceDiagram
participant WP as WordPress
participant Assets as includes/Analytics/Assets.php
participant Frontend as Vendor Analytics Script
WP->>Assets: Enqueue vendor_analytics_script
Assets->>WP: Call wp_set_script_translations('vendor_analytics_script', 'dokan-lite')
WP->>Frontend: Serve localized analytics script with translations
Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/vendor-dashboard/reports/layout/controller.js (1)
8-8
: Clean up: Unused lodash import.The
find
import from lodash appears to be unused after the changes.Consider removing the unused import:
-import { isEqual, last, omit } from "lodash"; +import { isEqual, last, omit } from "lodash";Wait, I need to verify this. Let me check if
find
is actually used in the code...Looking at the code, I don't see
find
being used anywhere. The import should be removed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
includes/Analytics/Assets.php
(1 hunks)src/dashboard/withdraw/RequestWithdrawBtn.tsx
(2 hunks)src/vendor-dashboard/reports/dashboard/default-sections.js
(1 hunks)src/vendor-dashboard/reports/dashboard/index.js
(1 hunks)src/vendor-dashboard/reports/layout/controller.js
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/vendor-dashboard/reports/dashboard/index.js (2)
src/vendor-dashboard/reports/dashboard/components/vendor-earning.js (1)
VendorEarning
(5-21)src/vendor-dashboard/reports/dashboard/customizable.js (1)
CustomizableDashboard
(83-367)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: e2e tests (3, 3)
- GitHub Check: e2e tests (1, 3)
- GitHub Check: e2e tests (2, 3)
- GitHub Check: api tests (1, 1)
🔇 Additional comments (5)
includes/Analytics/Assets.php (1)
124-124
: LGTM! Correct implementation of script translations.The addition of
wp_set_script_translations
for the vendor analytics script is properly implemented following WordPress standards. This enables the translation of JavaScript strings in the vendor analytics dashboard.src/dashboard/withdraw/RequestWithdrawBtn.tsx (1)
180-180
: LGTM! Text domain updates are consistent.The updates to use
'dokan-lite'
text domain for the DokanPriceInput component align with the PR's standardization of the translation domain across the codebase.Also applies to: 194-194
src/vendor-dashboard/reports/dashboard/index.js (1)
4-4
: LGTM! Clean removal of lazy loading.The changes consistently remove lazy loading by:
- Switching to direct imports for
VendorEarning
andCustomizableDashboard
components- Removing the
Suspense
wrapper from the render method- Simplifying the component imports
This approach is more straightforward and eliminates the complexity of asynchronous component loading.
Also applies to: 9-10, 13-22
src/vendor-dashboard/reports/dashboard/default-sections.js (2)
12-13
: LGTM! Consistent removal of lazy loading.The changes to direct imports for
DashboardCharts
andStorePerformance
components are consistent with the broader refactoring to remove lazy loading across the dashboard.
76-83
: Verify the intentional removal of Leaderboards section.The Leaderboards section has been commented out, which removes this functionality from the dashboard. Please confirm this is intentional and not a temporary change.
If this is a permanent removal, consider removing the commented code entirely rather than leaving it commented out. If it's temporary, please add a TODO comment explaining when it should be re-enabled.
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.
We need to find the root cause for not loading the translation for lazy loading.
Currently, the WooCommerce Analytics reports are not fully translatable using Loco Translate. Because the translations are not loaded automatically when components are lazy-loaded. To ensure all strings are translatable, we need to avoid lazy loading at the component level. If the scripts are lazy-loaded, their corresponding translation files are not loaded in time, which causes the translations to fail. |
All Submissions:
Changes proposed in this Pull Request:
Related Pull Request(s)
Closes
How to test the changes in this Pull Request:
Changelog entry
Before Changes
Describe the issue before changes with screenshots(s).
After Changes
Describe the issue after changes with screenshot(s).
Feature Video (optional)
Link of detailed video if this PR is for a feature.
PR Self Review Checklist:
FOR PR REVIEWER ONLY:
Summary by CodeRabbit
New Features
Bug Fixes
Refactor