@@ -35,8 +35,13 @@ return [
35
35
36
36
'lang_path' => lang_path(),
37
37
38
+ /**
39
+ * Auto sort translations keys after each manipulations: translate, grammar, ...
40
+ */
41
+ 'sort_keys' => false,
42
+
38
43
'translate' => [
39
- 'service' => 'deepl ',
44
+ 'service' => 'openai ',
40
45
'services' => [
41
46
'deepl' => [
42
47
'key' => env('DEEPL_KEY'),
@@ -48,19 +53,55 @@ return [
48
53
],
49
54
],
50
55
51
- 'grammar ' => [
56
+ 'proofread ' => [
52
57
'service' => 'openai',
53
58
'services' => [
54
59
'openai' => [
55
60
'model' => 'gpt-4o',
56
61
'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.
59
67
',
60
68
],
61
69
],
62
70
],
63
71
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
+
64
105
];
65
106
```
66
107
@@ -69,7 +110,7 @@ return [
69
110
This package can be used:
70
111
71
112
- 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.
73
114
74
115
### Sort all translations in natural order
75
116
@@ -87,7 +128,7 @@ Translator::sortAllTranslations();
87
128
88
129
### Find the missing translations
89
130
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:
91
132
92
133
``` bash
93
134
php artisan translator:missing fr
@@ -101,8 +142,8 @@ Translator::getAllMissingTranslations('fr');
101
142
102
143
### Auto translate strings
103
144
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 :
106
147
107
148
- DeepL
108
149
- OpenAI
@@ -146,9 +187,9 @@ Ommitting the `--to` option will translate to every available languages in your
146
187
use Elegantly\Translator\Facades\Translator;
147
188
148
189
Translator::translateTranslations(
149
- referenceLocale : 'fr',
150
- targetLocale : 'en',
151
- namespace: 'namespace-file',
190
+ source : 'fr',
191
+ target : 'en',
192
+ namespace: 'namespace-file-or-null ',
152
193
keys: ['title', ...]
153
194
);
154
195
```
0 commit comments