Skip to content

Commit d9b2650

Browse files
committed
Merge branch 'master' of github.com:kargnas/laravel-ai-translator
2 parents 2b7e204 + 1b14e80 commit d9b2650

File tree

1 file changed

+39
-59
lines changed

1 file changed

+39
-59
lines changed

README.md

Lines changed: 39 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Do you want to know how this works? See the prompt in `src/AI`.
6262
3. (Optional) Publish the configuration file:
6363
6464
```bash
65-
php artisan vendor:publish --provider="Kargnas\LaravelAiTranslator\LaravelAiTranslatorServiceProvider"
65+
php artisan vendor:publish --provider="Kargnas\LaravelAiTranslator\ServiceProvider"
6666
```
6767
6868
This step is optional but recommended if you want to customize the package's behavior. It will create a `config/ai-translator.php` file where you can modify various settings.
@@ -116,36 +116,30 @@ return [
116116
```
117117
118118
The package will generate translations like these:
119-
120-
Korean (ko-kr):
121-
122-
```php
123-
<?php
124-
return array (
125-
'notifications.new_feature_search_sentence' => '새로운 기능: 이제 단어뿐만 아니라 문장도 입력할 수 있어요. 심지어 여러분의 언어로도 가능해요.',
126-
'notifications.refresh_after_1_min' => '1분 후에 새로고침하세요. 새로운 내용이 준비될 거예요! (이전 모델: :model, 업데이트: :updated_at)',
127-
);
128-
```
129-
130-
Chinese (zh-cn):
131-
132-
```php
133-
<?php
134-
return array (
135-
'notifications.new_feature_search_sentence' => '新功能:现在你不仅可以输入单词,还可以输入句子。甚至可以用你的语言。',
136-
'notifications.refresh_after_1_min' => '1分钟后刷新。新内容即将到来!(之前的模型::model,更新时间::updated_at)',
137-
);
138-
```
139-
140-
Thai (th-th):
141-
142-
```php
143-
<?php
144-
return array (
145-
'notifications.new_feature_search_sentence' => 'ฟีเจอร์ใหม่: ตอนนี้คุณพิมพ์ประโยคได้แล้ว ไม่ใช่แค่คำเดียว แม้แต่ภาษาของคุณเอง',
146-
'notifications.refresh_after_1_min' => 'รีเฟรชหลังจาก 1 นาที จะมีเนื้อหาใหม่ให้ดู! (โมเดลก่อนหน้า: :model, อัปเดตเมื่อ: :updated_at)',
147-
);
148-
```
119+
- Korean (ko-kr):
120+
```php
121+
<?php
122+
return array (
123+
'notifications.new_feature_search_sentence' => '새로운 기능: 이제 단어뿐만 아니라 문장도 입력할 수 있어요. 심지어 여러분의 언어로도 가능해요.',
124+
'notifications.refresh_after_1_min' => '1분 후에 새로고침하세요. 새로운 내용이 준비될 거예요! (이전 모델: :model, 업데이트: :updated_at)',
125+
);
126+
```
127+
- Chinese (zh-cn):
128+
```php
129+
<?php
130+
return array (
131+
'notifications.new_feature_search_sentence' => '新功能:现在你不仅可以输入单词,还可以输入句子。甚至可以用你的语言。',
132+
'notifications.refresh_after_1_min' => '1分钟后刷新。新内容即将到来!(之前的模型::model,更新时间::updated_at)',
133+
);
134+
```
135+
- Thai (th-th):
136+
```php
137+
<?php
138+
return array (
139+
'notifications.new_feature_search_sentence' => 'ฟีเจอร์ใหม่: ตอนนี้คุณพิมพ์ประโยคได้แล้ว ไม่ใช่แค่คำเดียว แม้แต่ภาษาของคุณเอง',
140+
'notifications.refresh_after_1_min' => 'รีเฟรชหลังจาก 1 นาที จะมีเนื้อหาใหม่ให้ดู! (โมเดลก่อนหน้า: :model, อัปเดตเมื่อ: :updated_at)',
141+
);
142+
```
149143
150144
## Configuration
151145
@@ -163,15 +157,15 @@ This will create a `config/ai-translator.php` file where you can modify the foll
163157
164158
3. `ai`: Configure the AI provider, model, and API key here.
165159
166-
| Provider | Model | Cost (Input/Output per 1M token) | Descrpition |
167-
|-----------|--------------------------------|----------------------------------|--------------------------------------------------|
168-
| anthropic | **claude-3-5-sonnet-20240620** | $3.00 / $15.00 | The best quality, little bit slow. We recommend. |
169-
| anthropic | claude-3-opus-20240229 | $15.00 / $75.00 | Good quality, but very slow. |
170-
| anthropic | claude-3-sonnet-20240229 | $3.00 / $15.00 | Don't know |
171-
| anthropic | **claude-3-haiku-20240307** | $0.25 / $1.25 | Low quality, but better than gpt-3.5 |
172-
| openai | **gpt-4o** | $5.00 / $15.00 | Balanced quality and high speed |
173-
| openai | gpt-4-turbo | Expensive more than gpt-4o | Low quality like 3.5. Don't use this. |
174-
| openai | gpt-3.5-turbo | $0.50 / $1.50 | Low quality. Use for testing purpose. |
160+
| Provider | Model | Cost (I/O per 1M tokens) | Descrpition |
161+
|-----------|--------------------------------|----------------------------|--------------------------------------------------|
162+
| anthropic | **claude-3-5-sonnet-20240620** | $3.00 / $15.00 | The best quality, little bit slow. We recommend. |
163+
| anthropic | claude-3-opus-20240229 | $15.00 / $75.00 | Good quality, but very slow. |
164+
| anthropic | claude-3-sonnet-20240229 | $3.00 / $15.00 | Don't know |
165+
| anthropic | **claude-3-haiku-20240307** | $0.25 / $1.25 | Low quality, but better than gpt-3.5 |
166+
| openai | **gpt-4o** | $5.00 / $15.00 | Balanced quality and high speed |
167+
| openai | gpt-4-turbo | Expensive more than gpt-4o | Low quality like 3.5. Don't use this. |
168+
| openai | gpt-3.5-turbo | $0.50 / $1.50 | Low quality. Use for testing purpose. |
175169
176170
4. `locale_names`: This mapping of locale codes to language names enhances translation quality by providing context to the AI.
177171
@@ -220,38 +214,24 @@ Currently, this package only supports PHP language files used by Laravel. JSON l
220214

221215
We recommend using PHP files for managing translations, especially when dealing with multiple languages. Here's why:
222216
223-
1. **Structure
224-
**: PHP files allow for a more organized structure with nested arrays, making it easier to group related translations.
217+
1. **Structure**: PHP files allow for a more organized structure with nested arrays, making it easier to group related translations.
225218
226219
2. **Comments**: You can add comments in PHP files to provide context or instructions for translators.
227220
228221
3. **Performance**: PHP files are slightly faster to load compared to JSON files, as they don't require parsing.
229222

230-
4. **Flexibility
231-
**: PHP files allow for more complex operations, such as using variables or conditions in your translations.
223+
4. **Flexibility**: PHP files allow for more complex operations, such as using variables or conditions in your translations.
232224

233-
5. **Scalability
234-
**: When managing a large number of translations across multiple languages, the directory structure of PHP files makes it easier to navigate and maintain.
225+
5. **Scalability**: When managing a large number of translations across multiple languages, the directory structure of PHP files makes it easier to navigate and maintain.
235226

236227
If you're currently using JSON files for your translations, we recommend migrating to PHP files for better compatibility with this package and improved manageability of your translations.
237228
238229
## AI Service
239230
240231
This package supports both OpenAI's GPT models and Anthropic's Claude for translations, each with its own strengths:
241232
242-
- OpenAI:
243-
- GPT-4o: Optimized for speed and efficiency. Ideal for short-form translations and high-volume tasks. It offers a great balance of speed and quality.
244-
- GPT-4: Provides high-quality translations with good understanding of context.
245-
- GPT-3.5: Faster and more cost-effective, suitable for simpler translation tasks.
246-
247-
- Anthropic:
248-
- Claude: Excels at translating longer texts and producing more natural-sounding translations. It's slower compared to GPT models but can handle complex, nuanced content better.
249-
250-
Choose your model based on your specific needs:
251-
252-
- For quick translations of short texts or UI elements, GPT-4o or GPT-3.5 might be your best bet.
253-
- For longer content where nuance and natural flow are crucial, Claude could be the better choice.
254-
- If you need a balance of speed and quality for mixed content, GPT-4 is a solid all-rounder.
233+
- OpenAI
234+
- Anthropic
255235
256236
## TODO List
257237

0 commit comments

Comments
 (0)