-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: apply wdes/coding-standard v3
- Loading branch information
1 parent
f9ff9d4
commit 0078b11
Showing
14 changed files
with
85 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
/** | ||
* @license http://unlicense.org/UNLICENSE The UNLICENSE | ||
* @author William Desportes <[email protected]> | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
$options = getopt( | ||
'', [ | ||
'', | ||
[ | ||
'twig-cache-dir:', | ||
'twig-templates-dir:', | ||
'twig-templates-po-files:', | ||
|
@@ -52,10 +55,10 @@ | |
|
||
require_once(__DIR__ . '/../../vendor/autoload.php'); | ||
|
||
use \Wdes\phpI18nL10n\Twig\Extension\I18n as ExtensionI18n; | ||
use \Twig\Cache\FilesystemCache; | ||
use \Twig\Environment as TwigEnvironment; | ||
use \Twig\Loader\FilesystemLoader as TwigLoaderFilesystem; | ||
use Wdes\phpI18nL10n\Twig\Extension\I18n as ExtensionI18n; | ||
use Twig\Cache\FilesystemCache; | ||
use Twig\Environment as TwigEnvironment; | ||
use Twig\Loader\FilesystemLoader as TwigLoaderFilesystem; | ||
|
||
$shortTempDir = $options['twig-templates-po-files']; | ||
$jsonMaping = $options['json-mapping']; | ||
|
@@ -64,7 +67,8 @@ | |
$loader = new TwigLoaderFilesystem([ $templateDir ]); // Load all templates from the dir | ||
$cache = new FilesystemCache($options['twig-cache-dir']); | ||
$twig = new TwigEnvironment( | ||
$loader, [ | ||
$loader, | ||
[ | ||
'cache' => $cache | ||
] | ||
); | ||
|
@@ -107,10 +111,12 @@ | |
$mappings->replacements[] = $templates; | ||
|
||
// iterate over all templates | ||
foreach (new RecursiveIteratorIterator( | ||
$files = new RecursiveIteratorIterator( | ||
new RecursiveDirectoryIterator($templateDir), | ||
RecursiveIteratorIterator::LEAVES_ONLY | ||
) as $file) { | ||
); | ||
|
||
foreach ($files as $file) { | ||
// force twig to generate cache | ||
if ($file->isFile() && $file->getExtension() === 'twig') { | ||
$shortName = str_replace($templateDir, '', $file); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
/** | ||
* @license http://unlicense.org/UNLICENSE The UNLICENSE | ||
* @author William Desportes <[email protected]> | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
$options = getopt( | ||
'', [ | ||
'', | ||
[ | ||
'po-dir:', | ||
'po-template:', | ||
'json-mapping::', | ||
|
@@ -93,7 +96,7 @@ static function ($matchs) use ($mappings) { | |
echo 'PoDir: ' . $poDirectory . "\r\n"; | ||
foreach (glob($poDirectory . '*.po') as $file) { | ||
exec('msgmerge --quiet --previous -U ' . $file . ' ' . $poTemplate); | ||
echo 'File: '. $file . "\r\n"; | ||
echo 'File: ' . $file . "\r\n"; | ||
poupdate($file); | ||
} | ||
poupdate($poTemplate); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.