protected function _write()
    {
        $paths = $this->_paths;
        $paths[] = realpath(APP) . DIRECTORY_SEPARATOR;

        usort($paths, function ($a, $b) {
            return strlen($a) - strlen($b);
        });

        $domains = null;
        if (!empty($this->params['domains'])) {
            $domains = explode(',', $this->params['domains']);
        }

        foreach ($this->_translations as $domain => $translations) {
            if (!empty($domains) && !in_array($domain, $domains)) {
                continue;
            }
            if ($this->_merge) {
                $domain = 'default';
            }
            foreach ($translations as $msgid => $contexts) {
                foreach ($contexts as $context => $details) {
                    $references = null;
                    if (!$this->param('no-location')) {
                        $files = $details['references'];
                        $occurrences = [];
                        foreach ($files as $file => $lines) {
                            $lines = array_unique($lines);
                            $occurrences[] = $file . ':' . implode(';', $lines);
                        }
                        $occurrences = implode("\n", $occurrences);
                        $occurrences = str_replace($paths, '', $occurrences);
                        $references = str_replace(DIRECTORY_SEPARATOR, '/', $occurrences);
                    }

                    $this->_save(
                        $domain,
                        $msgid,
                        $details['msgid_plural'] === false ? null : $details['msgid_plural'],
                        $context ?: null,
                        $references
                    );
                }
            }
        }
    }
protected function _write()
    {
        $paths = $this->_paths;
        $paths[] = realpath(APP) . DIRECTORY_SEPARATOR;

        usort($paths, function ($a, $b) {
            return strlen($a) - strlen($b);
        });

        $domains = null;
        if (!empty($this->params['domains'])) {
            $domains = explode(',', $this->params['domains']);
        }

        foreach ($this->_translations as $domain => $translations) {
            if (!empty($domains) && !in_array($domain, $domains)) {
                continue;
            }
            if ($this->_merge) {
                $domain = 'default';
            }
            foreach ($translations as $msgid => $contexts) {
                foreach ($contexts as $context => $details) {
                    $references = null;
                    if (!$this->param('no-location')) {
                        $files = $details['references'];
                        $occurrences = [];
                        foreach ($files as $file => $lines) {
                            $lines = array_unique($lines);
                            $occurrences[] = $file . ':' . implode(';', $lines);
                        }
                        $occurrences = implode("\n", $occurrences);
                        $occurrences = str_replace($paths, '', $occurrences);
                        $references = str_replace(DIRECTORY_SEPARATOR, '/', $occurrences);
                    }

                    $this->_save(
                        $domain,
                        $msgid,
                        $details['msgid_plural'] === false ? null : $details['msgid_plural'],
                        $context ?: null,
                        $references
                    );
                }
            }
        }
    }
protected function _write ( ) { $ paths = $ this -> _paths ; $ paths [ ] = realpath ( APP ) . DIRECTORY_SEPARATOR ; usort ( $ paths , function ( $ a , $ b ) { return strlen ( $ a ) - strlen ( $ b ) ; } ) ; $ domains = null ; if ( ! empty ( $ this -> params [ 'domains' ] ) ) { $ domains = explode ( ',' , $ this -> params [ 'domains' ] ) ; } foreach ( $ this -> _translations as $ domain => $ translations ) { if ( ! empty ( $ domains ) && ! in_array ( $ domain , $ domains ) ) { continue ; } if ( $ this -> _merge ) { $ domain = 'default' ; } foreach ( $ translations as $ msgid => $ contexts ) { foreach ( $ contexts as $ context => $ details ) { $ references = null ; if ( ! $ this -> param ( 'no-location' ) ) { $ files = $ details [ 'references' ] ; $ occurrences = [ ] ; foreach ( $ files as $ file => $ lines ) { $ lines = array_unique ( $ lines ) ; $ occurrences [ ] = $ file . ':' . implode ( ';' , $ lines ) ; } $ occurrences = implode ( "\n" , $ occurrences ) ; $ occurrences = str_replace ( $ paths , '' , $ occurrences ) ; $ references = str_replace ( DIRECTORY_SEPARATOR , '/' , $ occurrences ) ; } $ this -> _save ( $ domain , $ msgid , $ details [ 'msgid_plural' ] === false ? null : $ details [ 'msgid_plural' ] , $ context ? : null , $ references ) ; } } } }
Write translations to database.

@return void
Write translations to database .