PHP code example of kargnas / laravel-ai-translator
1. Go to this page and download the library: Download kargnas/laravel-ai-translator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kargnas / laravel-ai-translator example snippets
'locale_names' => [
'en_reddit' => 'English (Reddit)',
],
'additional_rules' => [
'en_reddit' => [
"- Incorporate sarcasm and exaggeration",
"- Use popular internet slang and meme references",
"- Add humorous calls for sources on obvious statements",
],
],
return [
'notifications' => [
'new_feature_search_sentence' => 'New feature: Now you can type sentences not only words. Even in your languages. The AI will translate them to Chinese.',
'refresh_after_1_min' => 'Refresh after 1 minutes. New content will be available! (The previous model: :model, Updated: :updated_at)',
]
];
return [
'expertise' => [
'coding' => [
'title' => '코딩 & 제품',
'description' => '코딩은 사실상 제 인생 전부입니다. 11살 때부터 해리 포터와 스타크래프트 팬 사이트를 만들기 시작했습니다. 대학생이 되기 전에 넥서스 TK, 테일즈위버, 메이플스토리와 같은 다양한 게임 관련 웹 서비스를 개발했습니다. 대학 시절에는 웹사이트를 만드는 아르바이트로 돈을 벌었습니다. 현재 제 회사인 OP.GG도 어린 시절부터 개발해 온 게임 관련 서비스의 연장선으로, 이는 저에게 큰 자부심을 줍니다.',
]
]
];
return [
'expertise' => [
'coding' => [
'title' => '콤퓨터프로그람작성 & 제품',
'description' => '프로그람작성은 혁명적으로 나의 전생애입니다. 11살때부터 해리 포터와 스타크래프트 애호가싸이트를 만들기 시작하였습니다. 대학생이 되기전에 넥서스 TK, 테일즈위버, 메이플스토리와 같은 혁명적인 게임관련 망봉사들을 개발하였습니다. 대학시절에는 웹싸이트를 만드는 림시일로 돈을 벌었습니다. 현재 나의 회사인 OP.GG도 어린시절부터 개발하여온 게임관련 봉사의 련장선으로, 이는 나에게 큰 혁명적자부심을 줍니다.',
]
]
];
return [
'expertise' => [
'coding' => [
'title' => '코딩 & 제품',
'description' => '코딩은 사실상 제 인생 전부라 카모. 11살 때부터 해리 포터캉 스타크래프트 팬 사이트 만들기 시작했데이. 대학생이 되기 전에는 넥서스 TK, 테일즈위버, 메이플스토리 같은 여러 게임 관련 웹 서비스 개발했디. 대학 다닐 때는 웹사이트 만드는 아르바이트로 돈 벌었데이. 지금 제 회사인 OP.GG도 어릴 때부터 개발해 온 게임 관련 서비스으 연장선인데, 이기 내인데 억수로 자부심이 된다 카모.',
]
]
];
return [
'expertise' => [
'coding' => [
'title' => 'Coding & Product',
'description' => 'Coding is practically my entire life, duh. Started building Harry Potter and StarCraft fan sites at 11 (yeah, I was *that* kid). Before even hitting university, I was already knee-deep in game sites like Nexus TK, TalesWeaver, and MapleStory. Paid my way through college building websites - because who needs a social life, right? Now I run OP.GG, which is basically just the grown-up version of what little-me was doing in his bedroom. Not gonna lie, pretty damn proud of that full-circle moment.',
]
]
];
'ai' => [
'provider' => 'anthropic', // or 'openai'
'model' => 'claude-3-7-sonnet-latest', // see model list above
'api_key' => env('ANTHROPIC_API_KEY'), // or env('OPENAI_API_KEY')
],
return [
'source_directory' => 'lang',
'ai' => [
'provider' => 'anthropic',
'model' => 'claude-3-7-sonnet-latest',
'api_key' => env('ANTHROPIC_API_KEY'),
],
'locale_names' => [
'en' => 'English',
'ko' => 'Korean',
'zh_cn' => 'Chinese (Simplified)',
// ... other locales
],
'disable_plural' => false,
'additional_rules' => [
'default' => [
"Use a friendly and intuitive tone of voice, like the service tone of voice of 'Discord'.",
],
'ko' => [
"한국의 인터넷 서비스 '토스'의 서비스 말투 처럼, 유저에게 친근하고 직관적인 말투로 설명하고 존댓말로 설명하세요.",
],
],
];