src/Zicht/Bundle/MessagesBundle/Manager/MessageManager.php
public function check(TranslatorInterface $translator, $kernelRoot, $fix = false)
    {
        $issues = array();
        /** @var Message[] $messages */
        $messages = $this->getRepository()->findAll();
        foreach ($messages as $message) {
            foreach ($message->getTranslations() as $translation) {
                $translator->setLocale($translation->locale);
                $translated = $translator->trans($message->message, array(), $message->domain);

                $translationFile = 'Resources/translations/' . $message->domain . '.' . $translation->locale . '.db';
                if (!is_file($kernelRoot . '/' . $translationFile)) {
                    if ($fix === true) {
                        touch($kernelRoot . '/' . $translationFile);
                        $msg = 'Translation file app/' . $translationFile . ' created';
                    } else {
                        $msg = 'Translation file app/' . $translationFile . ' is missing. This probably causes some messages not to load';
                    }
                    if (!in_array($msg, $issues)) {
                        $issues[]= $msg;
                    }
                }
                if ($translated != $translation->translation) {
                    $issues[]= sprintf(
                        "Message '%s' from domain '%s' in locale '%s' translates as '%s', but '%s' expected",
                        $message->message,
                        $message->domain,
                        $translation->locale,
                        $translated,
                        $translation->translation
                    );
                }
            }
        }

        return $issues;
    }
public function check(TranslatorInterface $translator, $kernelRoot, $fix = false)
    {
        $issues = array();
        /** @var Message[] $messages */
        $messages = $this->getRepository()->findAll();
        foreach ($messages as $message) {
            foreach ($message->getTranslations() as $translation) {
                $translator->setLocale($translation->locale);
                $translated = $translator->trans($message->message, array(), $message->domain);

                $translationFile = 'Resources/translations/' . $message->domain . '.' . $translation->locale . '.db';
                if (!is_file($kernelRoot . '/' . $translationFile)) {
                    if ($fix === true) {
                        touch($kernelRoot . '/' . $translationFile);
                        $msg = 'Translation file app/' . $translationFile . ' created';
                    } else {
                        $msg = 'Translation file app/' . $translationFile . ' is missing. This probably causes some messages not to load';
                    }
                    if (!in_array($msg, $issues)) {
                        $issues[]= $msg;
                    }
                }
                if ($translated != $translation->translation) {
                    $issues[]= sprintf(
                        "Message '%s' from domain '%s' in locale '%s' translates as '%s', but '%s' expected",
                        $message->message,
                        $message->domain,
                        $translation->locale,
                        $translated,
                        $translation->translation
                    );
                }
            }
        }

        return $issues;
    }
public function check ( TranslatorInterface $ translator , $ kernelRoot , $ fix = false ) { $ issues = array ( ) ; /** @var Message[] $messages */ $ messages = $ this -> getRepository ( ) -> findAll ( ) ; foreach ( $ messages as $ message ) { foreach ( $ message -> getTranslations ( ) as $ translation ) { $ translator -> setLocale ( $ translation -> locale ) ; $ translated = $ translator -> trans ( $ message -> message , array ( ) , $ message -> domain ) ; $ translationFile = 'Resources/translations/' . $ message -> domain . '.' . $ translation -> locale . '.db' ; if ( ! is_file ( $ kernelRoot . '/' . $ translationFile ) ) { if ( $ fix === true ) { touch ( $ kernelRoot . '/' . $ translationFile ) ; $ msg = 'Translation file app/' . $ translationFile . ' created' ; } else { $ msg = 'Translation file app/' . $ translationFile . ' is missing. This probably causes some messages not to load' ; } if ( ! in_array ( $ msg , $ issues ) ) { $ issues [ ] = $ msg ; } } if ( $ translated != $ translation -> translation ) { $ issues [ ] = sprintf ( "Message '%s' from domain '%s' in locale '%s' translates as '%s', but '%s' expected" , $ message -> message , $ message -> domain , $ translation -> locale , $ translated , $ translation -> translation ) ; } } } return $ issues ; }
Does some sanity checks

@param TranslatorInterface $translator
@param string $kernelRoot
@param bool $fix
@return array
Does some sanity checks