-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41c7f10
commit 1d84135
Showing
22 changed files
with
259 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace StudioMitte\Csv2Xlf\Command; | ||
|
||
use StudioMitte\Csv2Xlf\Service\ConvertService; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
use TYPO3\CMS\Core\Core\Environment; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
class ConvertXlf2CsvCommand extends Command | ||
{ | ||
protected function configure(): void | ||
{ | ||
$this->addArgument('in', InputArgument::REQUIRED, 'XLF file to convert'); | ||
$this->addArgument('out', InputArgument::REQUIRED, 'Path to save the CSV file'); | ||
$this->addArgument('languages', InputArgument::REQUIRED, 'Comma separated list of languages'); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$io = new SymfonyStyle($input, $output); | ||
$io->title($this->getDescription()); | ||
|
||
$in = $input->getArgument('in') ?? ''; | ||
$out = $input->getArgument('out') ?? ''; | ||
$languages = GeneralUtility::trimExplode(',', $input->getArgument('languages') ?? '', true); | ||
|
||
if (!str_starts_with('/', $in)) { | ||
$in = Environment::getProjectPath() . '/' . $in; | ||
} | ||
|
||
if (!is_file($in)) { | ||
$io->error(sprintf('File "%s" could not be found', $in)); | ||
return Command::FAILURE; | ||
} | ||
if (empty($languages)) { | ||
$io->error('No languages provided'); | ||
return Command::FAILURE; | ||
} | ||
|
||
$convertService = GeneralUtility::makeInstance(ConvertService::class); | ||
$statistic = $convertService->convertXlf2Csv($in, $out, $languages); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<xliff version="1.2" xmlns:t3="http://typo3.org/schemas/xliff" xmlns="urn:oasis:names:tc:xliff:document:1.2"> | ||
<file source-language="en" target-language="de" datatype="plaintext" original="messages"> | ||
<header/> | ||
<body> | ||
<trans-unit id="example" resname="example" approved="yes"> | ||
<source>This is an example NEW</source> | ||
<target>Das ist ein Beispiel</target> | ||
</trans-unit> | ||
<trans-unit id="privacy" resname="privacy" approved="yes"> | ||
<source><![CDATA[<h3>Privacy</h3></source> | ||
<target><![CDATA[<h3>Datenschutzhinweis (bs)</h3></target> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<xliff version="1.2" xmlns:t3="http://typo3.org/schemas/xliff" xmlns="urn:oasis:names:tc:xliff:document:1.2"> | ||
<file source-language="en" target-language="fr" datatype="plaintext" original="messages"> | ||
<header/> | ||
<body> | ||
<trans-unit id="example" resname="example" approved="yes"> | ||
<source>This is an example</source> | ||
<target>Ceci est un exemple</target> | ||
</trans-unit> | ||
<trans-unit id="privacy" resname="privacy" approved="yes"> | ||
<source><![CDATA[<h3>Datenschutzhinweis</h3></source> | ||
<target><![CDATA[<h3>Protection des données</h3></target> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<xliff version="1.2" xmlns:t3="http://typo3.org/schemas/xliff" xmlns="urn:oasis:names:tc:xliff:document:1.2"> | ||
<file source-language="en" datatype="plaintext" original="messages"> | ||
<header/> | ||
<body> | ||
<trans-unit id="example" resname="example"> | ||
<source>This is an example NEW</source> | ||
</trans-unit> | ||
<trans-unit id="privacy" resname="privacy"> | ||
<source><![CDATA[<h3>Price</h3></source> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
key,en,de,fr | ||
example,"This is an example NEW","Das ist ein Beispiel","Ceci est un exemple" | ||
privacy,<![CDATA[<h3>Price</h3>,"<![CDATA[<h3>Datenschutzhinweis (bs)</h3>","<![CDATA[<h3>Protection des données</h3>" |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<xliff version="1.2" xmlns:t3="http://typo3.org/schemas/xliff" xmlns="urn:oasis:names:tc:xliff:document:1.2"> | ||
<file source-language="en" target-language="de" datatype="plaintext" original="messages"> | ||
<header/> | ||
<body> | ||
<trans-unit id="example" resname="example" approved="yes"> | ||
<source>This is an example NEW</source> | ||
<target>Das ist ein Beispiel</target> | ||
</trans-unit> | ||
<trans-unit id="privacy" resname="privacy" approved="yes"> | ||
<source><![CDATA[<h3>Privacy</h3></source> | ||
<target><![CDATA[<h3>Datenschutzhinweis (bs)</h3></target> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
Oops, something went wrong.