This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This thread is resolved. Here is a description of the problem and solution.
Problem: The translation works perfect, I just have one, for me bug, in the REST API. Assuming I have two languages, german and english, and each language has one page. There is the `?lang=en` parameter which is working fine when I am listing all posts, but when I am now requesting a post directly over the `post_id`, I actually want to get the post in the correct language.
Solution: By default, there's no info about the translation to the REST response. Also, the change that you're looking for (use the ID and the language parameter to get the translation) is not gonna work without some custom coding.
You can check these articles https://wpml.org/wpml-hook/ and https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/ in order to create your own routes and get the needed elements.