private function generateFromGeneric()
    {
        $ctypes = $this->app['config']->get('contenttypes');

        $translatables = array_filter(
            array_keys($this->translatables),
            function ($key) {
                return substr($key, 0, 21) === 'contenttypes.generic.' && substr($key, 21, 6) !== 'group.';
            }
        );

        foreach ($translatables as $key) {
            foreach ($ctypes as $ctname => $ctype) {
                $setkey = 'contenttypes.' . $ctname . '.text.' . substr($key, 21);
                $this->translation[$setkey] = isset($this->saved[$setkey]) ? $this->saved[$setkey] : '';
                if ($this->translation[$setkey] === '') {
                    $generic = Trans::__($key);
                    // If not translated, add hint
                    if ($generic !== $key) {
                        $replacement = [];
                        if (strpos($generic, '%contenttypes%') !== false) {
                            $replacement['%contenttypes%'] = $ctname;
                        } elseif (strpos($generic, '%contenttype%') !== false) {
                            $replacement['%contenttype%'] = $ctname;
                        }
                        $this->hints[$setkey] = Trans::__($key, $replacement);
                    }
                }
            }
        }
    }
private function generateFromGeneric()
    {
        $ctypes = $this->app['config']->get('contenttypes');

        $translatables = array_filter(
            array_keys($this->translatables),
            function ($key) {
                return substr($key, 0, 21) === 'contenttypes.generic.' && substr($key, 21, 6) !== 'group.';
            }
        );

        foreach ($translatables as $key) {
            foreach ($ctypes as $ctname => $ctype) {
                $setkey = 'contenttypes.' . $ctname . '.text.' . substr($key, 21);
                $this->translation[$setkey] = isset($this->saved[$setkey]) ? $this->saved[$setkey] : '';
                if ($this->translation[$setkey] === '') {
                    $generic = Trans::__($key);
                    // If not translated, add hint
                    if ($generic !== $key) {
                        $replacement = [];
                        if (strpos($generic, '%contenttypes%') !== false) {
                            $replacement['%contenttypes%'] = $ctname;
                        } elseif (strpos($generic, '%contenttype%') !== false) {
                            $replacement['%contenttype%'] = $ctname;
                        }
                        $this->hints[$setkey] = Trans::__($key, $replacement);
                    }
                }
            }
        }
    }
private function generateFromGeneric ( ) { $ ctypes = $ this -> app [ 'config' ] -> get ( 'contenttypes' ) ; $ translatables = array_filter ( array_keys ( $ this -> translatables ) , function ( $ key ) { return substr ( $ key , 0 , 21 ) === 'contenttypes.generic.' && substr ( $ key , 21 , 6 ) !== 'group.' ; } ) ; foreach ( $ translatables as $ key ) { foreach ( $ ctypes as $ ctname => $ ctype ) { $ setkey = 'contenttypes.' . $ ctname . '.text.' . substr ( $ key , 21 ) ; $ this -> translation [ $ setkey ] = isset ( $ this -> saved [ $ setkey ] ) ? $ this -> saved [ $ setkey ] : '' ; if ( $ this -> translation [ $ setkey ] === '' ) { $ generic = Trans :: __ ( $ key ) ; // If not translated, add hint if ( $ generic !== $ key ) { $ replacement = [ ] ; if ( strpos ( $ generic , '%contenttypes%' ) !== false ) { $ replacement [ '%contenttypes%' ] = $ ctname ; } elseif ( strpos ( $ generic , '%contenttype%' ) !== false ) { $ replacement [ '%contenttype%' ] = $ ctname ; } $ this -> hints [ $ setkey ] = Trans :: __ ( $ key , $ replacement ) ; } } } } }
Generates strings for contenttypes from generic translations.
Generates strings for contenttypes from generic translations .