Translate Missing Keys in Laravel with Auto Translate

Translate Missing Keys in Laravel with Auto Translate

Laravel Auto Translate is a Laravel package to translate your language files using a translator service (i.e., Google Translate). Similar to the Laravel Google Translate package we shared recently, this is another option that provides a CLI to automatically create the missing translation keys from the source language file you specify:

# Translates all source translations that are not set in your target translations
$ php artisan autotrans:missing

# Translates all source translations to target translations
$ php artisan autotrans:all

The configuration file that ships with this package define a “source” language and “target” language(s):

At the time of writing this package only supports Google Translate; however, the package ships with a TranslatorInterface class you can use to provide other options besides Google Translate:

<?php

namespace Ben182\AutoTranslate\Translators;

interface TranslatorInterface
{
    public function setSource(string $source);
    public function setTarget(string $target);
    public function translate(string $string) : string;
}

You can learn more about this package, get full installation instructions, and view the source code on GitHub at ben182/laravel-auto-translate.


Filed in: News


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Senior Laravel Engineer
Remote okay (must already live in USA)
Hawthorne Effect
Senior Software Engineer (Remote - Contract)
Remote
Koodi Systems
PHP Developer
Pittsburgh / Remote
Sequoia Waste Solutions
Software Developer
Eindhoven
Simac IDS
Application Developer Level II (CakePHP / MySql / Vue.js)
Lancaster, PA
Harbor Compliance
FULL STACK LARAVEL DEVELOPER
LONDON - WEST END
AMPERSAND HEATLH
Mid/Senior Laravel Developer - U.S. Only
Kenner, Louisiana
Profit Miner Technologies