@@ -30,22 +30,36 @@ php artisan vendor:publish --tag="translator-config"
30
30
This is the contents of the published config file:
31
31
32
32
``` php
33
-
34
33
return [
35
34
36
35
'lang_path' => lang_path(),
37
36
38
- 'service' => DeepLService::class,
39
-
40
- 'services' => [
41
- DeepLService::class => [
42
- 'key' => env('DEEPL_KEY'),
37
+ 'translate' => [
38
+ 'service' => 'deepl',
39
+ 'services' => [
40
+ 'deepl' => [
41
+ 'key' => env('DEEPL_KEY'),
42
+ ],
43
+ 'openai' => [
44
+ 'model' => 'gpt-4o',
45
+ 'prompt' => "Translate the following json to the locale '{targetLocale}' while preserving the keys.",
46
+ ],
43
47
],
44
- OpenAiService::class => [
45
- 'model' => 'gpt-4o',
46
- 'prompt' => 'Translate the following json to the locale {targetLocale} while preserving the keys.',
48
+ ],
49
+
50
+ 'grammar' => [
51
+ 'service' => 'openai',
52
+ 'services' => [
53
+ 'openai' => [
54
+ 'model' => 'gpt-4o',
55
+ 'prompt' => '
56
+ Fix the grammar and the syntax the following json string while preserving the keys.
57
+ Do not change the meaning or the tone of the sentences and never change the keys.
58
+ ',
59
+ ],
47
60
],
48
61
],
62
+
49
63
];
50
64
```
51
65
@@ -100,36 +114,17 @@ First, you need to edit the config file to add your DeepL api key and select dee
100
114
101
115
``` php
102
116
return [
103
-
104
- 'lang_path' => lang_path(),
105
-
106
117
'translate' => [
107
- 'service' => 'deepl',
118
+ 'service' => 'deepl', // select the default service here
119
+
108
120
'services' => [
109
121
'deepl' => [
110
- 'key' => env('DEEPL_KEY'),
122
+ 'key' => env('DEEPL_KEY'), // add you api key here
111
123
],
112
- 'openai' => [
113
- 'model' => 'gpt-4o',
114
- 'prompt' => "Translate the following json to the locale '{targetLocale}' while preserving the keys.",
115
- ],
116
- ],
117
- ],
118
124
119
- 'grammar' => [
120
- 'service' => 'openai',
121
- 'services' => [
122
- 'openai' => [
123
- 'model' => 'gpt-4o',
124
- 'prompt' => '
125
- Fix the grammar and the syntax the following json string while preserving the keys.
126
- Do not change the meaning or the tone of the sentences and never change the keys.
127
- ',
128
- ],
129
125
],
130
126
],
131
-
132
- ];
127
+ ]
133
128
```
134
129
135
130
To translate all the missing translations use:
0 commit comments