Fix WPML Compatibility Issue with Event Bubbles Revert
Summary by CodeRabbit
- New Features
- Added multilingual compatibility: calendar AJAX requests now include the current language when available (WPML), ensuring language-appropriate data.
- Bug Fixes
- Improved resilience of tooltips: failures during tooltip initialization no longer break calendar rendering; errors are safely logged.
- Documentation
- Updated shortcode reference to use [simple_calendar] for embedding calendars.
Walkthrough
Adds WPML language propagation to AJAX requests and localized script variables, updates shortcode name in documentation, and wraps qTip2 initialization in try-catch. JavaScript now uses shared ajaxData for grid/list navigation and includes lang when available. PHP appends lang to admin-ajax URL and exposes wpml_language to scripts.
Changes
| Cohort / File(s) | Summary of Changes |
|---|---|
Documentation updateCLAUDE.md |
Replace shortcode reference from "[calendar]" to "[simple_calendar]". |
AJAX data + tooltip handlingassets/js/default-calendar.js |
Switch to shared ajaxData for grid/list navigation; include lang when available; add try-catch around qTip2 initialization; keep existing behavior for positioning/show/hide/render. |
WPML var localizationincludes/functions/shared.php |
Inject wpml_language into localized JS variables when ICL_LANGUAGE_CODE is defined. |
AJAX URL language supportincludes/main.php |
Modify ajax_url() to append lang query parameter when WPML is active; otherwise return base admin-ajax.php URL. |
Sequence Diagram(s)
sequenceDiagram
autonumber
actor User as User
participant UI as Calendar UI (JS)
participant WP as WordPress admin-ajax.php
participant WPML as WPML (lang context)
Note over UI: Localized vars include wpml_language (if defined)
User->>UI: Navigate calendar (grid/list)
UI->>UI: Build ajaxData { action, ... , id, lang? }
alt WPML active
UI->>WP: AJAX request with lang query + ajaxData.lang
WP->>WPML: Resolve language context
WPML-->>WP: Language applied
else No WPML
UI->>WP: AJAX request without lang
end
WP-->>UI: JSON response (events/calendar HTML)
rect rgba(230,250,230,0.6)
Note right of UI: Initialize qTip2 tooltips
UI->>UI: try { qTip2(...) } catch { warn and continue }
end
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
- Xtendify/Simple-Calendar#626 — Implements the same WPML lang additions and ajaxData/qTip2 adjustments across JS and PHP.
- Xtendify/Simple-Calendar#625 — Touches the same documentation file, introducing CLAUDE.md which this PR updates.
- Xtendify/Simple-Calendar#630 — Reverts the WPML lang and qTip2/ajaxData changes introduced here.
Suggested reviewers
- enginnk
Poem
A hop, a skip, a multilingual spin—
Calendars whisper, “lang” tucked in.
Tooltips behave (we try, we catch),
Dates align, a perfect match.
From grid to list, I thump with cheer—
Simple hops, clearer days appear! 🐇📅
Pre-merge checks and finishing touches
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Title Check | ⚠️ Warning | The title is confusing and does not clearly convey the main change because it awkwardly combines “Fix WPML Compatibility Issue with Event Bubbles” and “Revert” without explaining what is being reverted, and the summary changes do not actually perform a revert, making the title misleading and unclear. | Rename the title to clearly reflect the actual change, for example “Restore WPML compatibility for event bubbles” or “Add WPML language support to event bubble AJAX calls,” so that it clearly and concisely summarizes the main update. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Docstring Coverage | ✅ Passed | No functions found in the changes. Docstring coverage check skipped. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
rohit/wpml-event-bubble-issue-revert
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.
Comment @coderabbitai help to get the list of available commands and usage tips.