You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Console/Commands/ImportTranslationsCommand.php
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ class ImportTranslationsCommand extends Command
16
16
{
17
17
publicTranslationsManager$manager;
18
18
19
-
protected$signature = 'translations:import {--F|fresh : Truncate all translations and phrases before importing}';
19
+
protected$signature = 'translations:import {--F|fresh : Truncate all translations and phrases before importing} {--force : Force the operation to run when in production}';
20
20
21
21
protected$description = 'Sync translation all keys from the translation files to the database';
22
22
@@ -40,7 +40,11 @@ public function handle(): void
40
40
{
41
41
$this->importLanguages();
42
42
43
-
if ($this->option('fresh') && $this->confirm('Are you sure you want to truncate all translations and phrases?')) {
43
+
if ($this->option('force') && $this->option('fresh')) {
44
+
$this->info('Truncating translations and phrases...' . PHP_EOL);
45
+
46
+
$this->truncateTables();
47
+
} elseif ($this->option('fresh') && $this->confirm('Are you sure you want to truncate all translations and phrases?')) {
44
48
$this->info('Truncating translations and phrases...' . PHP_EOL);
45
49
46
50
$this->truncateTables();
@@ -132,7 +136,7 @@ public function syncPhrases(Translation $source, $key, $value, $locale, $file):
132
136
protectedfunctionimportLanguages(): void
133
137
{
134
138
if (!Schema::hasTable('ltu_languages') || Language::count() === 0) {
135
-
if ($this->confirm('The ltu_languages table does not exist or is empty, would you like to install the default languages?', true)) {
139
+
if ($this->option('force') || $this->confirm('The ltu_languages table does not exist or is empty, would you like to install the default languages?', true)) {
0 commit comments