Download the PHP package coding-partners/transla-genius without Composer

On this page you can find all versions of the php package coding-partners/transla-genius. 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 transla-genius

TranslaGenius Package

The TranslaGenius package is a Laravel package designed to automatically translate fields in your Eloquent models using an external translation API. It supports multiple languages and provides flexible translation management.

Features

Installation

To install the package, you can use Composer:

Configuration

After installing the package, you need to publish the configuration file:

This will create a translaGenius.php file in your config directory. You can modify this file to set your Supported Languages, and other translation settings:

Environment Variables

Make sure to set the following environment variables in your .env file:

Usage

Step 1: Include the Translatable Trait in Your Model

To enable automatic translation for your model, include the Translatable trait in your Eloquent model:

Step 2: Update Your Migration

Ensure that the fields you want to translate are of type json in your migration:

Step 3: Middleware Setup

To automatically set the locale based on the request, you can include the SetLocale middleware in your bootstrap/app.php:

Step 4: Making Requests

When making requests to your application, you can set the Accept-Language header to specify the desired language:

This will set the locale to English (en), which means the default language of the system is now English. When you add a new record, you should send the fields in English, and the package will automatically translate them into Arabic.

Step 5: Running the Queue

The translation process is handled by a job that is dispatched when a model is created or updated. To ensure that the translations are processed, you need to run the queue worker:

This will process the TranslateFields job and perform the translations in the background.

Example of Using the fullyTranslated Scope

The Translatable trait provides a fullyTranslated scope that allows you to filter models that are fully translated in the Supported Languages.

This scope checks if all translatable fields have a translation in the Supported Languages. It ensures that only records with complete translations are returned, which is useful for ensuring data consistency and completeness.

How It Works

  1. Model Events: When a model is created or updated, the Translatable trait automatically dispatches a TranslateFields job.
  2. Translation Job: The TranslateFields job uses the AutoTranslationService to translate the specified fields into the target language.
  3. Translation Service: The AutoTranslationService communicates with the external API to perform the translation and updates the model with the translated content.

Example Workflow

Here’s a complete example of how to use the package:

Model

Migration

Controller

Request

After the request, the name and description fields will be automatically translated into Supported Languages.

Troubleshooting

Common Issues

Missing translations:

Performance:

Conclusion

The TranslaGenius package simplifies the process of adding multi-language support to your Laravel application. By following the steps outlined above, you can easily configure and use the package to automatically translate your model fields, ensuring that your application is accessible to a global audience.


All versions of transla-genius with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
illuminate/support Version ^12.0
spatie/laravel-translatable Version ^6.0
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 coding-partners/transla-genius contains the following files

Loading the files please wait ....