Util/DataGrid/DataGridFormatter.php
protected function formatOne($transUnit)
    {
        if (is_object($transUnit)) {
            $transUnit = $this->toArray($transUnit);
        } elseif (StorageInterface::STORAGE_MONGODB == $this->storage) {
            $transUnit['id'] = $transUnit['_id']->{'$id'};
        }

        $formatted = array(
            '_id'     => $transUnit['id'],
            '_domain' => $transUnit['domain'],
            '_key'    => $transUnit['key'],
        );

        // add locales in the same order as in managed_locales param
        foreach ($this->localeManager->getLocales() as $locale) {
            $formatted[$locale] = '';
        }

        // then fill locales value
        foreach ($transUnit['translations'] as $translation) {
            if (in_array($translation['locale'], $this->localeManager->getLocales())) {
                $formatted[$translation['locale']] = $translation['content'];
            }
        }

        return $formatted;
    }
protected function formatOne($transUnit)
    {
        if (is_object($transUnit)) {
            $transUnit = $this->toArray($transUnit);
        } elseif (StorageInterface::STORAGE_MONGODB == $this->storage) {
            $transUnit['id'] = $transUnit['_id']->{'$id'};
        }

        $formatted = array(
            '_id'     => $transUnit['id'],
            '_domain' => $transUnit['domain'],
            '_key'    => $transUnit['key'],
        );

        // add locales in the same order as in managed_locales param
        foreach ($this->localeManager->getLocales() as $locale) {
            $formatted[$locale] = '';
        }

        // then fill locales value
        foreach ($transUnit['translations'] as $translation) {
            if (in_array($translation['locale'], $this->localeManager->getLocales())) {
                $formatted[$translation['locale']] = $translation['content'];
            }
        }

        return $formatted;
    }
protected function formatOne ( $ transUnit ) { if ( is_object ( $ transUnit ) ) { $ transUnit = $ this -> toArray ( $ transUnit ) ; } elseif ( StorageInterface :: STORAGE_MONGODB == $ this -> storage ) { $ transUnit [ 'id' ] = $ transUnit [ '_id' ] -> { '$id' } ; } $ formatted = array ( '_id' => $ transUnit [ 'id' ] , '_domain' => $ transUnit [ 'domain' ] , '_key' => $ transUnit [ 'key' ] , ) ; // add locales in the same order as in managed_locales param foreach ( $ this -> localeManager -> getLocales ( ) as $ locale ) { $ formatted [ $ locale ] = '' ; } // then fill locales value foreach ( $ transUnit [ 'translations' ] as $ translation ) { if ( in_array ( $ translation [ 'locale' ] , $ this -> localeManager -> getLocales ( ) ) ) { $ formatted [ $ translation [ 'locale' ] ] = $ translation [ 'content' ] ; } } return $ formatted ; }
Format a single TransUnit.

@param array $transUnit
@return array
Format a single TransUnit .