@@ -35,8 +35,13 @@ return [
3535
3636 'lang_path' => lang_path(),
3737
38+ /**
39+ * Auto sort translations keys after each manipulations: translate, grammar, ...
40+ */
41+ 'sort_keys' => false,
42+
3843 'translate' => [
39- 'service' => 'deepl ',
44+ 'service' => 'openai ',
4045 'services' => [
4146 'deepl' => [
4247 'key' => env('DEEPL_KEY'),
@@ -48,19 +53,55 @@ return [
4853 ],
4954 ],
5055
51- 'grammar ' => [
56+ 'proofread ' => [
5257 'service' => 'openai',
5358 'services' => [
5459 'openai' => [
5560 'model' => 'gpt-4o',
5661 'prompt' => '
57- Fix the grammar and the syntax the following json string while preserving the keys.
58- Do not change the meaning or the tone of the sentences and never change the keys.
62+ Fix the grammar and the syntax the following json string while respecting the following rules:
63+ - Never change the keys.
64+ - Do not escape nor change HTML tags.
65+ - Do not escape nor change special characters or emojis.
66+ - Do not change the meaning or the tone of the sentences.
5967 ',
6068 ],
6169 ],
6270 ],
6371
72+ 'searchcode' => [
73+ 'service' => 'php-parser',
74+
75+ /**
76+ * Files or directories to include
77+ */
78+ 'paths' => [
79+ app_path(),
80+ resource_path(),
81+ ],
82+
83+ /**
84+ * Files or directories to exclude
85+ */
86+ 'excluded_paths' => [],
87+
88+ /**
89+ * Translations to exclude from deadcode detection
90+ */
91+ 'ignored_translations' => [
92+ // 'validation',
93+ // 'passwords',
94+ // 'pagination',
95+ ],
96+
97+ 'services' => [
98+ 'php-parser' => [
99+ 'cache_path' => base_path('.translator.cache'),
100+ ],
101+ ],
102+
103+ ],
104+
64105];
65106```
66107
@@ -69,7 +110,7 @@ return [
69110This package can be used:
70111
71112- Like a CLI tool, using commands.
72- - In a programmatic way using ` \Elegantly\Translator\Facades\Translator::class ` facade class .
113+ - In a programmatic way using ` \Elegantly\Translator\Facades\Translator::class ` facade.
73114
74115### Sort all translations in natural order
75116
@@ -87,7 +128,7 @@ Translator::sortAllTranslations();
87128
88129### Find the missing translations
89130
90- You can display all the missing translations present in a given locale but not in the other ones using :
131+ You can display all the missing translations keys defined for a given locale but not for the other ones:
91132
92133``` bash
93134php artisan translator:missing fr
@@ -101,8 +142,8 @@ Translator::getAllMissingTranslations('fr');
101142
102143### Auto translate strings
103144
104- This package can automatically translate your files for you.
105- It includes 2 services right now :
145+ This package can automatically translate your translations strings for you.
146+ Right now, it includes 2 services :
106147
107148- DeepL
108149- OpenAI
@@ -146,9 +187,9 @@ Ommitting the `--to` option will translate to every available languages in your
146187use Elegantly\Translator\Facades\Translator;
147188
148189Translator::translateTranslations(
149- referenceLocale : 'fr',
150- targetLocale : 'en',
151- namespace: 'namespace-file',
190+ source : 'fr',
191+ target : 'en',
192+ namespace: 'namespace-file-or-null ',
152193 keys: ['title', ...]
153194);
154195```
0 commit comments