PHP code example of cosavostra / localise-bundle
1. Go to this page and download the library: Download cosavostra/localise-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cosavostra / localise-bundle example snippets
// config/bundles.php
return [
// ...
CosaVostra\LocaliseBundle\CosaVostraLocaliseBundle::class => ['all' => true],
];
use CosaVostra\LocaliseBundle\LocaliseManager;
use Symfony\Component\HttpFoundation\Response;
public function action(LocaliseManager $localiseManager): Response
{
$extension = 'yaml';
$purge = true; // This flag should be "TRUE" to purge translation directory and remove old files.
$localiseManager->import($extension, $purge);
// Clear the cache manually here ...
return new Response('Translations imported.');
}