@@ -13,6 +13,7 @@ class TranslateStrings extends Command
1313
1414 protected $ sourceLocale ;
1515 protected $ sourceDirectory ;
16+ protected $ chunkSize ;
1617
1718 public function __construct () {
1819 parent ::__construct ();
@@ -25,6 +26,7 @@ public function __construct() {
2526 public function handle () {
2627 $ this ->sourceLocale = config ('ai-translator.source_locale ' );
2728 $ this ->sourceDirectory = config ('ai-translator.source_directory ' );
29+ $ this ->chunkSize = config ('ai-translator.chunk_size ' , 10 );
2830
2931 $ this ->translate ();
3032 }
@@ -86,8 +88,8 @@ public function translate() {
8688 })
8789 ->toArray ();
8890
89- if (sizeof ($ sourceStringList ) > 50 ) {
90- if (!$ this ->confirm ("{$ outputFile }, Strings: " . sizeof ($ sourceStringList ) . " -> Too many strings to translate. Could be expensive. Continue? " )) {
91+ if (sizeof ($ sourceStringList ) > 100 ) {
92+ if (!$ this ->confirm ("{$ outputFile }, Strings: " . sizeof ($ sourceStringList ) . " -> Many strings to translate. Could be expensive. Continue? " )) {
9193 $ this ->warn ("Stopped translating! " );
9294 exit ;
9395 }
@@ -96,7 +98,7 @@ public function translate() {
9698 // Chunk the strings because of the pricing
9799 // But also this will increase the speed of the translation, and quality of continuous translation
98100 collect ($ sourceStringList )
99- ->chunk (10 )
101+ ->chunk ($ this -> chunkSize )
100102 ->each (function ($ chunk ) use ($ locale , $ file , $ targetStringTransformer ) {
101103 $ translator = new AIProvider (
102104 filename: $ file ,
0 commit comments