Make cli locale commands working outside of source tree
This commit is contained in:
@@ -21,7 +21,7 @@ class LocaleComparatorCommand extends BaseCommand
|
|||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$strings = array();
|
$strings = array();
|
||||||
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('app'));
|
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(APP_DIR));
|
||||||
$it->rewind();
|
$it->rewind();
|
||||||
|
|
||||||
while ($it->valid()) {
|
while ($it->valid()) {
|
||||||
@@ -44,7 +44,7 @@ class LocaleComparatorCommand extends BaseCommand
|
|||||||
|
|
||||||
public function compare(array $strings)
|
public function compare(array $strings)
|
||||||
{
|
{
|
||||||
$reference_file = 'app/Locale/'.self::REF_LOCALE.'/translations.php';
|
$reference_file = APP_DIR.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.self::REF_LOCALE.DIRECTORY_SEPARATOR.'translations.php';
|
||||||
$reference = include $reference_file;
|
$reference = include $reference_file;
|
||||||
|
|
||||||
echo str_repeat('#', 70).PHP_EOL;
|
echo str_repeat('#', 70).PHP_EOL;
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ class LocaleSyncCommand extends BaseCommand
|
|||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$reference_file = 'app/Locale/'.self::REF_LOCALE.'/translations.php';
|
$reference_file = APP_DIR.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.self::REF_LOCALE.DIRECTORY_SEPARATOR.'translations.php';
|
||||||
$reference = include $reference_file;
|
$reference = include $reference_file;
|
||||||
|
|
||||||
foreach (new DirectoryIterator('app/Locale') as $fileInfo) {
|
foreach (new DirectoryIterator(APP_DIR.DIRECTORY_SEPARATOR.'Locale') as $fileInfo) {
|
||||||
if (! $fileInfo->isDot() && $fileInfo->isDir() && $fileInfo->getFilename() !== self::REF_LOCALE) {
|
if (! $fileInfo->isDot() && $fileInfo->isDir() && $fileInfo->getFilename() !== self::REF_LOCALE) {
|
||||||
$filename = 'app/Locale/'.$fileInfo->getFilename().'/translations.php';
|
$filename = APP_DIR.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.$fileInfo->getFilename().DIRECTORY_SEPARATOR.'translations.php';
|
||||||
echo $fileInfo->getFilename().' ('.$filename.')'.PHP_EOL;
|
echo $fileInfo->getFilename().' ('.$filename.')'.PHP_EOL;
|
||||||
|
|
||||||
file_put_contents($filename, $this->updateFile($reference, $filename));
|
file_put_contents($filename, $this->updateFile($reference, $filename));
|
||||||
|
|||||||
Reference in New Issue
Block a user