Skip to content

Commit 3b18d75

Browse files
committed
add with medthods
1 parent ef2e8a5 commit 3b18d75

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/Facades/Translator.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@
77
use Elegantly\Translator\Collections\Translations;
88
use Elegantly\Translator\Drivers\Driver;
99
use Elegantly\Translator\Services\Exporter\ExporterInterface;
10+
use Elegantly\Translator\Services\Proofread\ProofreadServiceInterface;
11+
use Elegantly\Translator\Services\SearchCode\SearchCodeServiceInterface;
12+
use Elegantly\Translator\Services\Translate\TranslateServiceInterface;
1013
use Illuminate\Support\Facades\Facade;
1114

1215
/**
1316
* @method static \Elegantly\Translator\Translator driver(null|string|Driver $name)
17+
* @method static withProofreadService(ProofreadServiceInterface $service)
18+
* @method static withTranslateService(TranslateServiceInterface $service)
19+
* @method static withSearchcodeService(SearchCodeServiceInterface $service)
1420
* @method static array<int, string> getLocales()
1521
* @method static Translations getTranslations(string $locale)
1622
* @method static array<string, array{ count: int, files: string[] }> getMissingTranslations(string $locale)

src/Translator.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,39 @@ public function driver(null|string|Driver $name): static
3636
);
3737
}
3838

39+
public function withProofreadService(ProofreadServiceInterface $service): static
40+
{
41+
return new static(
42+
driver: $this->driver,
43+
translateService: $this->translateService,
44+
proofreadService: $service,
45+
searchcodeService: $this->searchcodeService,
46+
exporter: $this->exporter
47+
);
48+
}
49+
50+
public function withTranslateService(TranslateServiceInterface $service): static
51+
{
52+
return new static(
53+
driver: $this->driver,
54+
translateService: $service,
55+
proofreadService: $this->proofreadService,
56+
searchcodeService: $this->searchcodeService,
57+
exporter: $this->exporter
58+
);
59+
}
60+
61+
public function withSearchcodeService(SearchCodeServiceInterface $service): static
62+
{
63+
return new static(
64+
driver: $this->driver,
65+
translateService: $this->translateService,
66+
proofreadService: $this->proofreadService,
67+
searchcodeService: $service,
68+
exporter: $this->exporter
69+
);
70+
}
71+
3972
/**
4073
* @return array<int, string>
4174
*/

0 commit comments

Comments
 (0)