2017 © Pedro Peláez
 

library magic-translation

Automatically translate your Laravel localization files to any language using Google Translate through an Artisan command.

image

alkalab/magic-translation

Automatically translate your Laravel localization files to any language using Google Translate through an Artisan command.

  • Sunday, April 8, 2018
  • by 2Fwebd
  • Repository
  • 1 Watchers
  • 2 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 44 % Grown

The README.md

Laravel Magic Translation

Automatically translate your Laravel localization files to any language using Google Translate through an Artisan command., (*1)

This package supports for any string: * Parameters (example: 'localized string :foo') * Emojis (example: 'localized string 🚀') * HTML tags (example: 'localized string <i>yes </i>'), (*2)

Installation

As any Laravel package, simply, (*3)

composer require alkalab/magic-translation, (*4)

How to use it?

Simple, once installed the Artisan command is:, (*5)

php artisan magic:translate {file} {target} {--no-validation}, (*6)

  • {file}: the file that needs to be translated inside your resources/assets/lang/en/, without the .php extension. Example: "validation" to translate resources/assets/lang/en/validation.php
  • {target}: the language code (2 characters) in which the strings will be translated. Example: "fr" to translate to resources/assets/lang/fr/
  • --no-validation: an optional command option. If set, the strings will be automatically translated without validation. You can always change them afterward of course. Otherwise, you will be validating every translation 1 by 1.

Example:, (*7)

php artisan magic:translate validation fr --no-validation, (*8)

Important notes

  • This is using Google Translator, please check the translations as even though it's pretty good sometimes it will not work correctly 😉.
  • This first version only translates from English to another language. Not the other way around.
  • As of right now, this is using the wonderful Stichoza/google-translate-php package. This package does not use the Google Cloud API but directly the Google Translate website. Therefore, it might stop working at some point. If that happens, this package will be updated to use the Cloud API instead.

Any bug, idea or improvement, feel free to improve it or create a new issue., (*9)

The Versions

08/04 2018

dev-master

9999999-dev https://github.com/2Fwebd/magic-translation

Automatically translate your Laravel localization files to any language using Google Translate through an Artisan command.

  Sources   Download

MIT

The Requires

 

by Avatar 2Fwebd

laravel php google translate automatic

08/04 2018

0.0.2

0.0.2.0 https://github.com/2Fwebd/magic-translation

Automatically translate your Laravel localization files to any language using Google Translate through an Artisan command.

  Sources   Download

MIT

The Requires

 

by Avatar 2Fwebd

laravel php google translate automatic

08/04 2018

0.0.1

0.0.1.0

Automatically translate your Laravel localization files to any language using Google Translate through an Artisan command.

  Sources   Download

MIT

The Requires

 

by Avatar 2Fwebd

laravel php google translate automatic