Gets current language code from the form state or item.
Since the paragraph field is not set as translatable, the item language code is set to the source language. The intended translation language is only accessibly through the form state.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
\Drupal\Core\Field\FieldItemListInterface $items: The field item list.
string The language code.
protected function getCurrentLangcode(FormStateInterface $form_state, FieldItemListInterface $items) {
return $form_state
->has('langcode') ? $form_state
->get('langcode') : $items
->getEntity()
->language()
->getId();
}