WordPress API v2 with Polylang and ACF

Using WordPress with Custom Post Types enriched with Advanced Custom Fields offers a simple solution to provide an intuitive Database management solution. With WP REST API v2 it’s even possible to use WordPress as a simple mobile backend. ACF to WP-API allows accessing the ACF attributes.
But using WP REST API v2 with ACF (through ACF to WP-API) does not work by default if you add Multilanguage support through Polylang. Even though you can filter post types through the filter parameter (e.g. filter[lang]=de) the ACF attributes are not resolved properly (AFAICT this only affects relationship fields).

Fortunately there are some smart folks out there that already figured out how to set the language for REST requests:

<?php
function polylang_json_api_init() {
  global $polylang;

  $default = pll_default_language();
  $langs = pll_languages_list();

  $cur_lang = $_GET['lang'];

  if (!in_array($cur_lang, $langs)) {
    $cur_lang = $default;
  }

  $polylang->curlang = $polylang->model->get_language($cur_lang);
  $GLOBALS['text_direction'] = $polylang->curlang->is_rtl ? 'rtl' : 'ltr';
}

add_action('rest_api_init', 'polylang_json_api_init');
?>