ben182 / laravel-auto-translate Goto Github PK
View Code? Open in Web Editor NEWAutomatically translate your language files using a translator service
License: MIT License
Automatically translate your language files using a translator service
License: MIT License
Hey ๐
I would love if you support/add DeepL. This is an very good translator eg. for EN <-> DE. I personally prefer this translator over google translate, because of they better translation results.
You can find more information and statistics here: https://www.deepl.com/press.html
API Docs: https://www.deepl.com/docs-api.html
Drawbacks:
because this package never updated since 2019 so i decided to fork this repo and laravel-langman (the package that this package depends on) and make it support laravel 8 (i've tested laravel 9 but no luck).
you can install it from my repo with the following way:
...
"repositories": [
{
"type": "vcs",
"url": "https://github.com/AbidKhairyAK/laravel-auto-translate"
},
{
"type": "vcs",
"url": "https://github.com/AbidKhairyAK/laravel-langman"
}
],
...
"require": {
...
"themsaid/laravel-langman": "dev-master",
"ben182/laravel-auto-translate": "dev-master",
...
}
...
composer update
Thanks for this fantastic tool.
The only detail I can see is that the default language can be indicated in the configuration, in my case: "es", but the "messages" file is always written in the "en" folder.
Currently waiting for https://github.com/themsaid/laravel-langman
First, thanks in advance for sharing this very useful package!.
I tried the package and receive:
| => php artisan autotrans:missing
ErrorException : Server error: `POST https://translate.google.com/translate_a/single?client=t&hl=en&dt=t&dt=bd&dt=at&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&sl=en&tl=de&ie=UTF-8&oe=UTF-8&multires=1&otf=0&pc=1&trs=1&ssel=0&tsel=0&kc=1&tk=319219.191885` resulted in a `503 Service Unavailable` response:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="te (truncated...)
at /Applications/MAMP/htdocs/domain/vendor/stichoza/google-translate-php/src/GoogleTranslate.php:312
308| 'query' => $queryUrl,
309| 'body' => $queryBodyEncoded,
310| ] + $this->options);
311| } catch (RequestException $e) {
> 312| throw new ErrorException($e->getMessage());
313| }
314|
315| $body = $response->getBody(); // Get response body
316|
Exception trace:
1 Stichoza\GoogleTranslate\GoogleTranslate::getResponse("Activate")
/Applications/MAMP/htdocs/domain/vendor/stichoza/google-translate-php/src/GoogleTranslate.php:223
2 Stichoza\GoogleTranslate\GoogleTranslate::translate("Activate")
/Applications/MAMP/htdocs/domain/vendor/ben182/laravel-auto-translate/src/Translators/SimpleGoogleTranslator.php:32
I dont know if Im missing any setup, like API personal key or similar. any help appreciated.
Symfony\Component\Debug\Exception\FatalThrowableError : Return value of Stichoza\GoogleTranslate\GoogleTranslate::translate() must be of the type string, null returned
at /var/www/html/vendor/stichoza/google-translate-php/src/GoogleTranslate.php: 235
231: }
232:
233: // Check if translation exists
234: if (!isset($responseArray[0]) || empty($responseArray[0])) {
235: return null;
236: }
237:
238: // Detect languages
239: $detectedLanguages = [];
240:
Exception trace:
1 Stichoza\GoogleTranslate\GoogleTranslate::translate("About")
/var/www/html/vendor/ben182/laravel-auto-translate/src/Translators/SimpleGoogleTranslator.php : 32
2 Ben182\AutoTranslate\Translators\SimpleGoogleTranslator::translate("About")
/var/www/html/vendor/ben182/laravel-auto-translate/src/AutoTranslate.php : 65
Please use the argument -v to see more details.
'target_language' => ['ar', 'bg', 'bn', 'cn', 'cs', 'da', 'de', 'en', 'es', 'et', 'ir', 'fr', 'gr', 'it', 'nl', 'pl', 'pt', 'br', 'ro', 'ru', 'tr', 'tw'],
It appears to have failed php artisan autotrans:all
at ro
with the error above.
However ro
is correct for Romanian
Hi,
Love this package, works great, thank you!
Do you plan to add support for Translation Strings (json) files as well as the Translation Strings
Thanks, James
I'm aware that this project hasn't had work done on it for some time.
For other people thinking of evaluating this module, they should be aware that if they do get it working with later versions of laravel (they will need to fork and allow for laravel 8 in both this project and laravel-langman) , then the project does not support parameters (used in laravel's validation translations for one) or for the 'translation strings as keys' functionality, where translations are stored in json files.
Hello.
I'm using laravel 5.7 and php 7.2, and when I execute "php artisan autotrans:missing", I get the following:
**root@c3ac4083fd6f:/var/www# php artisan autotrans:missing
Found 1 language to translate
ErrorException : strlen() expects parameter 1 to be string, array given
at /var/www/vendor/ben182/laravel-auto-translate/src/Commands/MissingCommand.php:57
53| foreach ($targetLanguages as $targetLanguage) {
54| $missing = $this->autoTranslator->getMissingTranslations($targetLanguage);
55| $missingCount += $missing->count();
56| $strLen += $missing->map(function ($value) {
57| return strlen($value);
58| })->sum();
59| $this->line('Found '.$missing->count().' missing keys in '.$targetLanguage);
60| }
61|
Exception trace:
1 strlen([])
/var/www/vendor/ben182/laravel-auto-translate/src/Commands/MissingCommand.php:57
2 Ben182\AutoTranslate\Commands\MissingCommand::Ben182\AutoTranslate\Commands{closure}([], "validation.attributes")
[internal]:0
Please use the argument -v to see more details.**
Do you know where can my problem be?.
Thanks
Is there any way this package is gonna have support for laravel v9 and php 8.1 ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.