atpro/translator

Atpro translator allows you to translate lang files into several languages and thus save time in managing the internationalization of your laravel projects

v2.0.2 2023-01-17 08:39 UTC

This package is auto-updated.

Last update: 2024-11-17 13:17:27 UTC


README

Build Status Latest Stable Version License

Introduction

Atpro-translator is a package that allows you to easily manage the internationalization in your applications.

Installation

To get started with Atpro-translator, use Composer to add the package to your project's dependencies:

    composer require atpro/translator

Configuration

After installing the Atpro-translator library, register the \Atpro\Translator\AtproServiceProvider::class in your config/app.php configuration file:

'providers' => [

        \Atpro\Translator\AtproServiceProvider::class,
    ],

Also, register the middleware in web middleware groups by simply adding the middleware class :

AtproTranslateMiddleware::class,

into the $middlewareGroups of your app/Http/Kernel.php file.

And then run :

php artisan vendor:publish

publish AtproServiceProvider.

Usage

To translate your lang files into other languages:

Run the command in terminal

    php artisan atpro:translate 

Example:

  1. php artisan atpro:translate and click enter
  2. --> Your started language ? en
  3. --> Your translated list language seperated with commas (,) example: fr,es ... ? fr,it,es
  4. Click enter and wait for translated files

It will generate translated files in respective folder fr,it,es

OPTIONAL OPTIONS:

B. To generate views for translation:

Run the command in terminal

    php artisan atpro:generate-view-translate

Example:

  1. php artisan atpro:generate-view-translate and click enter
  2. --> Yours languages seperated with commas (,) example: fr,es ... ? fr,it,es
  3. Click enter and wait for generate views translate

It will generate a middleware, in controller, a routes file and a component containing the different options according to the chosen languages

You will also have a new component <x-atpro::language> </x-atpro::language>. You can use it in views.

Note: Make sure that the started language folder exists in your language folder and contains files you want to translate.