Best practice of using field language in alters

Public

get language from form

Get raw version
php
  1. $lang = $form['FIELDNAME']['#language'];
  2. $form['FIELDNAME'][$lang][0]['value']['#value'] = $value;

get language from node and using for setter

Get raw version
php
  1. $field_language = field_language('node', $node, 'field_name');
  2. $node->field_name[field_language][0]['value'] = 'field_value';