Skip to content

Commit

Permalink
Translate attributes of one produt at once. Refactor translation process
Browse files Browse the repository at this point in the history
  • Loading branch information
drejmanMacopedia committed Jun 5, 2023
1 parent e247a54 commit 32685cf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ public function supports(JobInterface $job): bool
{
return in_array($job->getName(), $this->supportedJobNames);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ public function supports(JobInterface $job): bool
{
return in_array($job->getName(), $this->supportedJobNames);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Akeneo\Tool\Component\Batch\Job\BatchStatus;
use Akeneo\Tool\Component\Batch\Model\StepExecution;
use Akeneo\Tool\Component\Connector\Step\TaskletInterface;
use Exception;

class ValidateOpenAiKeyTasklet implements TaskletInterface
{
Expand All @@ -15,7 +16,7 @@ class ValidateOpenAiKeyTasklet implements TaskletInterface
public function execute(): void
{
if (empty($this->stepExecution->getJobParameters()->get('open_ai_key'))) {
$this->stepExecution->addFailureException(new \Exception('OpenAI key is not set'));
$this->stepExecution->addFailureException(new Exception('OpenAI key is not set'));
$this->stepExecution->setStatus(new BatchStatus(BatchStatus::FAILED));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function translate(string $text, Language $targetLanguageCode): ?string
->ask('user', sprintf(self::MESSAGE, $targetLanguageCode->asText(), $text));

if ($answer !== null) {
$answer = preg_replace('/(\(Note.*)/','',$answer);
$answer = preg_replace('/(\(Note.*)/', '', $answer);
}

return $answer;
Expand Down

0 comments on commit 32685cf

Please sign in to comment.