Skip to content

Commit 50f7a22

Browse files
committed
fix bug
1 parent 04d2f32 commit 50f7a22

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ To translate your language files, run the following command:
194194
php artisan ai-translator:translate
195195
```
196196

197-
To speed up translating multiple locales, you can run them in parallel. The command uses up to five processes by default:
197+
To speed up translating multiple locales, you can run them in parallel:
198198

199199
```bash
200-
php artisan ai-translator:translate-parallel --max-processes=5
200+
php artisan ai-translator:translate-parallel
201201
```
202202

203203
Specify target locales separated by commas using the `--locale` option. For example:

src/Console/TranslateStrings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function translate(int $maxContextItems = 100): void
246246

247247
foreach ($locales as $locale) {
248248
// 소스 언어와 같거나 스킵 목록에 있는 언어는 건너뜀
249-
if ($locale === $this->sourceLocale || in_array($locale, config('ai-translator.skip_locales', []))) {
249+
if ($locale === $this->sourceLocale || in_array($locale, config('ai-translator.skip_locales', []))) {
250250
$this->warn('Skipping locale ' . $locale . '.');
251251
continue;
252252
}
@@ -273,7 +273,7 @@ public function translate(int $maxContextItems = 100): void
273273
$outputFile = $this->getOutputDirectoryLocale($locale) . '/' . basename($file);
274274

275275
if (in_array(basename($file), config('ai-translator.skip_files', []))) {
276-
$this->warn('Skipping file ' . basename($file) .'.');
276+
$this->warn('Skipping file ' . basename($file) . '.');
277277
continue;
278278
}
279279

src/Console/TranslateStringsParallel.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class TranslateStringsParallel extends TranslateStrings
1414
{--m|max-context= : Maximum number of context items to include (e.g. --max-context=1000)}
1515
{--force-big-files : Force translation of files with more than 500 strings}
1616
{--show-prompt : Show the whole AI prompts during translation}
17-
{--max-processes=5 : Number of locales to translate simultaneously}
1817
{--non-interactive : Run in non-interactive mode, using default or provided values}';
1918

2019
protected $description = 'Translates PHP language files in parallel for multiple locales.';
@@ -50,7 +49,7 @@ public function translate(int $maxContextItems = 100): void
5049
$queue[] = $locale;
5150
}
5251

53-
$maxProcesses = (int) ($this->option('max-processes') ?? 5);
52+
$maxProcesses = (int) ($this->option('max-processes') ?? 100); // This doesn't work
5453
$running = [];
5554

5655
while (!empty($queue) || !empty($running)) {
@@ -76,7 +75,7 @@ public function translate(int $maxContextItems = 100): void
7675
usleep(100000);
7776
}
7877

79-
$this->line('\n' . $this->colors['green_bg'] . $this->colors['white'] . $this->colors['bold'] . ' All translations completed ' . $this->colors['reset']);
78+
$this->line(PHP_EOL . $this->colors['green_bg'] . $this->colors['white'] . $this->colors['bold'] . ' All translations completed ' . $this->colors['reset']);
8079
}
8180

8281
private function buildLocaleCommand(string $locale, int $maxContextItems): array

0 commit comments

Comments
 (0)