src/Service/MelisCoreTranslationService.php
public function updateTranslations($currentTrans, $transDiff)
    {
        $status = false;
        $current = include $currentTrans;
        $current = is_array($current)? $current : array();
        $transUpdate =  array_merge($current, $transDiff);

        $content = "<?php". PHP_EOL . "\t return array(" . PHP_EOL;
        foreach($transUpdate as $key => $value){
            $content .= "\t\t'". addslashes($key) . "' => '" . addslashes($value) ."'," .PHP_EOL;
        }
        $content .= "\t );" . PHP_EOL;

        if(file_put_contents($currentTrans, $content, LOCK_EX)){
            $status = true;
        }

        return $status;

    }
public function updateTranslations($currentTrans, $transDiff)
    {
        $status = false;
        $current = include $currentTrans;
        $current = is_array($current)? $current : array();
        $transUpdate =  array_merge($current, $transDiff);

        $content = "<?php". PHP_EOL . "\t return array(" . PHP_EOL;
        foreach($transUpdate as $key => $value){
            $content .= "\t\t'". addslashes($key) . "' => '" . addslashes($value) ."'," .PHP_EOL;
        }
        $content .= "\t );" . PHP_EOL;

        if(file_put_contents($currentTrans, $content, LOCK_EX)){
            $status = true;
        }

        return $status;

    }
public function updateTranslations ( $ currentTrans , $ transDiff ) { $ status = false ; $ current = include $ currentTrans ; $ current = is_array ( $ current ) ? $ current : array ( ) ; $ transUpdate = array_merge ( $ current , $ transDiff ) ; $ content = "<?php" . PHP_EOL . "\t return array(" . PHP_EOL ; foreach ( $ transUpdate as $ key => $ value ) { $ content .= "\t\t'" . addslashes ( $ key ) . "' => '" . addslashes ( $ value ) . "'," . PHP_EOL ; } $ content .= "\t );" . PHP_EOL ; if ( file_put_contents ( $ currentTrans , $ content , LOCK_EX ) ) { $ status = true ; } return $ status ; }
Updates the translation files

@param string $currentTrans The path of the current translation
@param array $transDiff array of translations to be added

@return boolean
Updates the translation files