public function generateTranslation($packageKey, $sourceLanguageKey, array $targetLanguageKeys = [])
    {
        $translationPath = 'resource://' . $packageKey . '/Private/Translations';
        $contextVariables = [];
        $contextVariables['packageKey'] = $packageKey;
        $contextVariables['sourceLanguageKey'] = $sourceLanguageKey;

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/SourceLanguageTemplate.xlf.tmpl';
        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
        $sourceLanguageFile = Files::concatenatePaths([$translationPath, $sourceLanguageKey, 'Main.xlf']);
        $this->generateFile($sourceLanguageFile, $fileContent);

        if ($targetLanguageKeys) {
            $xliffParser = new XliffParser();
            $parsedXliffArray = $xliffParser->getParsedData($sourceLanguageFile);
            foreach ($targetLanguageKeys as $targetLanguageKey) {
                $contextVariables['targetLanguageKey'] = $targetLanguageKey;
                $contextVariables['translationUnits'] = $parsedXliffArray['translationUnits'];

                $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/TargetLanguageTemplate.xlf.tmpl';
                $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
                $targetPathAndFilename = Files::concatenatePaths([$translationPath, $targetLanguageKey, 'Main.xlf']);
                $this->generateFile($targetPathAndFilename, $fileContent);
            }
        }

        return $this->generatedFiles;
    }
public function generateTranslation($packageKey, $sourceLanguageKey, array $targetLanguageKeys = [])
    {
        $translationPath = 'resource://' . $packageKey . '/Private/Translations';
        $contextVariables = [];
        $contextVariables['packageKey'] = $packageKey;
        $contextVariables['sourceLanguageKey'] = $sourceLanguageKey;

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/SourceLanguageTemplate.xlf.tmpl';
        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
        $sourceLanguageFile = Files::concatenatePaths([$translationPath, $sourceLanguageKey, 'Main.xlf']);
        $this->generateFile($sourceLanguageFile, $fileContent);

        if ($targetLanguageKeys) {
            $xliffParser = new XliffParser();
            $parsedXliffArray = $xliffParser->getParsedData($sourceLanguageFile);
            foreach ($targetLanguageKeys as $targetLanguageKey) {
                $contextVariables['targetLanguageKey'] = $targetLanguageKey;
                $contextVariables['translationUnits'] = $parsedXliffArray['translationUnits'];

                $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/TargetLanguageTemplate.xlf.tmpl';
                $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
                $targetPathAndFilename = Files::concatenatePaths([$translationPath, $targetLanguageKey, 'Main.xlf']);
                $this->generateFile($targetPathAndFilename, $fileContent);
            }
        }

        return $this->generatedFiles;
    }
public function generateTranslation ( $ packageKey , $ sourceLanguageKey , array $ targetLanguageKeys = [ ] ) { $ translationPath = 'resource://' . $ packageKey . '/Private/Translations' ; $ contextVariables = [ ] ; $ contextVariables [ 'packageKey' ] = $ packageKey ; $ contextVariables [ 'sourceLanguageKey' ] = $ sourceLanguageKey ; $ templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/SourceLanguageTemplate.xlf.tmpl' ; $ fileContent = $ this -> renderTemplate ( $ templatePathAndFilename , $ contextVariables ) ; $ sourceLanguageFile = Files :: concatenatePaths ( [ $ translationPath , $ sourceLanguageKey , 'Main.xlf' ] ) ; $ this -> generateFile ( $ sourceLanguageFile , $ fileContent ) ; if ( $ targetLanguageKeys ) { $ xliffParser = new XliffParser ( ) ; $ parsedXliffArray = $ xliffParser -> getParsedData ( $ sourceLanguageFile ) ; foreach ( $ targetLanguageKeys as $ targetLanguageKey ) { $ contextVariables [ 'targetLanguageKey' ] = $ targetLanguageKey ; $ contextVariables [ 'translationUnits' ] = $ parsedXliffArray [ 'translationUnits' ] ; $ templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/TargetLanguageTemplate.xlf.tmpl' ; $ fileContent = $ this -> renderTemplate ( $ templatePathAndFilename , $ contextVariables ) ; $ targetPathAndFilename = Files :: concatenatePaths ( [ $ translationPath , $ targetLanguageKey , 'Main.xlf' ] ) ; $ this -> generateFile ( $ targetPathAndFilename , $ fileContent ) ; } } return $ this -> generatedFiles ; }
Generate translation for the package key

@param string $packageKey
@param string $sourceLanguageKey
@param array $targetLanguageKeys
@return array An array of generated filenames
Generate translation for the package key