Skip to content

Commit 4d6161f

Browse files
committed
better doc
1 parent 5bbce30 commit 4d6161f

File tree

1 file changed

+76
-5
lines changed

1 file changed

+76
-5
lines changed

README.md

Lines changed: 76 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,35 @@ Here’s the content of the published config file:
3838
```php
3939
return [
4040

41+
/*
42+
|--------------------------------------------------------------------------
43+
| Language Paths
44+
|--------------------------------------------------------------------------
45+
|
46+
| This is the path where your translation files are stored. In a standard Laravel installation, you should not need to change it.
47+
|
48+
*/
4149
'lang_path' => lang_path(),
4250

43-
/**
44-
* Automatically sort translation keys after each manipulation (translate, grammar check, etc.).
45-
*/
51+
/*
52+
|--------------------------------------------------------------------------
53+
| Auto Sort Keys
54+
|--------------------------------------------------------------------------
55+
|
56+
| If set to true, all keys will be sorted automatically after any file manipulation such as 'edit', 'translate', or 'proofread'.
57+
|
58+
*/
4659
'sort_keys' => false,
4760

61+
/*
62+
|--------------------------------------------------------------------------
63+
| Third-Party Services
64+
|--------------------------------------------------------------------------
65+
|
66+
| Define the API keys for your third-party services. These keys are reused for both 'translate' and 'proofread'.
67+
| You can override this configuration and define specific service options, for example, in 'translate.services.openai.key'.
68+
|
69+
*/
4870
'services' => [
4971
'openai' => [
5072
'key' => env('OPENAI_API_KEY'),
@@ -56,17 +78,48 @@ return [
5678
],
5779
],
5880

81+
/*
82+
|--------------------------------------------------------------------------
83+
| Translation Service
84+
|--------------------------------------------------------------------------
85+
|
86+
| These are the services that can be used to translate your strings from one locale to another.
87+
| You can customize their behavior here, or you can define your own service.
88+
|
89+
*/
5990
'translate' => [
91+
/**
92+
* Supported: 'openai', 'deepl', 'MyOwnServiceClass::name'
93+
* Define your own service using the class's name: 'MyOwnServiceClass::class'
94+
*/
6095
'service' => null,
6196
'services' => [
6297
'openai' => [
6398
'model' => 'gpt-4o',
64-
'prompt' => "Translate the following JSON to the locale '{targetLocale}' while preserving the keys.",
99+
'prompt' => "
100+
As an experienced copywriter and translator specializing in website copy, your task is to translate the provided content from a specific website.
101+
Your translations should maintain the original tone while being adapted to the target language, ensuring they are both relevant and clear.
102+
The content will be provided in JSON format, and you must translate it to the locale '{targetLocale}'.
103+
Ensure that all JSON keys remain preserved and unchanged.
104+
",
65105
],
66106
],
67107
],
68108

109+
/*
110+
|--------------------------------------------------------------------------
111+
| Proofreading Service
112+
|--------------------------------------------------------------------------
113+
|
114+
| These are the services that can be used to proofread your strings.
115+
| You can customize their behavior here, or you can define your own service.
116+
|
117+
*/
69118
'proofread' => [
119+
/**
120+
* Supported: 'openai', 'MyOwnServiceClass::name'
121+
* Define your own service using the class's name: 'MyOwnServiceClass::class'
122+
*/
70123
'service' => null,
71124
'services' => [
72125
'openai' => [
@@ -82,7 +135,19 @@ return [
82135
],
83136
],
84137

138+
/*
139+
|--------------------------------------------------------------------------
140+
| Search Code / Dead Code Service
141+
|--------------------------------------------------------------------------
142+
|
143+
| These are the services that can be used to detect dead translation strings in your codebase.
144+
| You can customize their behavior here, or you can define your own service.
145+
|
146+
*/
85147
'searchcode' => [
148+
/**
149+
* Supported: 'php-parser', 'MyOwnServiceClass::name'
150+
*/
86151
'service' => 'php-parser',
87152

88153
/**
@@ -100,21 +165,27 @@ return [
100165

101166
/**
102167
* Translation keys to exclude from dead code detection.
168+
* By default, the default Laravel translations are excluded.
103169
*/
104170
'ignored_translations' => [
105171
'auth',
106172
'pagination',
107173
'passwords',
108-
'validation'
174+
'validation',
109175
],
110176

111177
'services' => [
112178
'php-parser' => [
179+
/**
180+
* To speed up detection, all the results of the scan will be stored in a file.
181+
* Feel free to change the path if needed.
182+
*/
113183
'cache_path' => base_path('.translator.cache'),
114184
],
115185
],
116186

117187
],
188+
118189
];
119190
```
120191

0 commit comments

Comments
 (0)