WPML URL Integration for CiviCRM
Overview
When using WPML language plugin in conjunction with CiviCRM the generated translated URLs are incorrect. All the translated URLs point to the CiviCRM page rather than the proper translated CiviCRM event, contribution, or other page.
This isn't ideal and confusing for most users as they attempt to navigate to the translated CiviCRM page.
There is already integration for Polylang, but not integration presently for WPML.
WPML handles URLs in three different ways:
- Attaching a language parameter to the end of the url
lang=xyz
- Attaching a language in the path of the url
https://test.dev/fr/civicrm/event/info/?reset=1&id=1
- Allowing for different domains for each language
https://fr.test.dev/civicrm/event/info/?reset=1&id=1
Before
Viewing the page https://test.dev/civicrm/event/info/?reset=1&id=1
, and clicking on the WPML language link will take you to https://test.dev/civicrm/
After
The new code (I will attach the PR to this ticket shortly) will provide the proper integration for the defined scenarios above.
Testing
I have tested this in the following scenarios, but maybe others want to test a bit larger?
- Multiple domains while viewing (Events page)
- Language placed in the URL (Events page)
- Language within the proper path
- Multisite installation with one site using WPML and CiviCRM Events
I don't believe that the path construction is any different for Contribution and other CiviCRM public pages, but I could be wrong.