Download the PHP package rpwebdevelopment/laravel-translate without Composer

On this page you can find all versions of the php package rpwebdevelopment/laravel-translate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-translate

Laravel Translate

Packagist Version Packagist Downloads License: MIT

Laravel Translate is a tool intended to automatically generate translated language files. Currently, the package leverages either DeepL API, Amazon Translate or the amazing Google Translate package from Stichoza which allows for zero configuration usage.

The default configuration makes use of Google translations and can be used straight out of the box with no sign-up or configuration. If you would rather use the DeepL translations API you will need to sign up here; DeepL configuration details described below.

Installation

You can install the package via composer:

You can publish the config file with:

This is the contents of the published config file:

DeepL Configuration

In order to make use of the DeepL API you will need to publish the config file as detailed above and update the provider to deepl. You will then need to add your DeepL API auth token to your .env file under the env variable DEEPL_AUTH_TOKEN.

Amazon Configuration

In order to make use of the AWS Translate API you will need to publish the config file as detailed above and update the provider to aws. You will then need to ensure that you .env file contains the required AWS variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY & AWS_DEFAULT_REGION.

Note:

You will need to ensure that the AWS IAM role has the permission policy TranslateFullAccess .

Usage

This package is designed to function with as much flexibility as possible, as such it is designed to work for multiple configurations with minimal setup, whether you have a single file or directory per language, or if you are using PHP lang files or JSON lang files.

Options:

Command Required Description
target required Set locale/language to be translated into.
--source= optional Set locale/language source being translated from.
--file= optional Set specific filename being translated from & into.
--missing-only optional Flag only missing values need to be translated/added.

Bulk Processing

Rather than processing each target language manually you can add all your target locales to the target_locales option in the translations configuration file, this will enable the usage of the bulk translate command:

Options:

Command Required Description
--source= optional Set locale/language source being translated from.
--file= optional Set specific filename being translated from & into.
--missing-only optional Flag only missing values need to be translated/added.

Key Validation

If you simply wish to ascertain if translations are missing from your project you can implement the missing command:

Options:

Command Required Description
--verbose optional Flag to indicate if full details of missing keys are required.

This command can be used in conjunction with git-hooks in order to prevent changes being deployed to your repository with missing translations, this can be done by adding the following bash script to your .git/hooks/pre-commit:

Example Usages

Directory Structure:

Example directory structure:

Assuming the config default_source is set to en_GB; for the above structure the following command:

Would produce the following structure:

Alternately, you can explicitly declare the source locale:

If you are only wanting to replace a specific file you can also pass in the file option (note the file extension is optional):

Single File Structure

If you are using a single file per language rather than a directory structure as below:

You can use the exact same command syntax, so the following:

Would result in the following output:

Notes

Credits

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-translate with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
aws/aws-sdk-php-laravel Version ^3.9
deeplcom/deepl-php Version *
illuminate/contracts Version ^10.0||^11.0
spatie/laravel-package-tools Version ^1.16
stichoza/google-translate-php Version ^5.2
symfony/var-exporter Version ^7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rpwebdevelopment/laravel-translate contains the following files

Loading the files please wait ....