code: public static function encodeLangArray($varValue, IMetaModel $objMetaModel)
      {
          // Not translated, make it a plain string.
          if (!$objMetaModel->isTranslated()) {
              return $varValue;
          }
          $arrLangValues = StringUtil::deserialize($varValue);
          $arrOutput     = array();
          foreach ($arrLangValues as $varSubValue) {
              $strLangCode = $varSubValue['langcode'];
              unset($varSubValue['langcode']);
              if (count($varSubValue) > 1) {
                  $arrOutput[$strLangCode] = $varSubValue;
              } else {
                  $arrKeys                 = array_keys($varSubValue);
                  $arrOutput[$strLangCode] = $varSubValue[$arrKeys[0]];
              }
          }
          return serialize($arrOutput);
      }
docs: Decode a language array.
  
  @param array|string $varValue     The value to decode.
  
  @param IMetaModel   $objMetaModel The MetaModel holding the languages.
  
  @return string