JCI and WPML
The WPML-Plugin gives a good way to have a multilanguage WordPress-Website. It offers several ways to do this.
On the other hand APIs can provide data and content in different languages. Some need a …?lang=en in the API-URL, some other info in headers.
JCI and WPML can work together in this way:
Licencing
If you set up a multisite-Wordpress and one network-site is DOMAIN/de and another network-site is DOMAIN/de you normally need two JCI-licences. But if WPML is in use you only need one JCI-licence.
Asking the API
Depending on the language you want to ask the API. For that you need to know what language a page has. WPML “knows” that, and then JCI too.
The twig-function wp_get_page_properties gives us all info about a page.
You can use the in the twig-content-template and the http-request (URL & header).
A example code snippet:
{# get all page properties #} {% set pprop = wp_get_page_properties() %} {# in case wpml is active #} wpml: {{pprop.wpml.lang}}<br> {% if pprop.wpml.lang=="de" %} DE {% else %} EN {% endif %}