isaeken/laravel-translator

Laravel translation helpers

v1.1 2021-10-06 05:59 UTC

This package is auto-updated.

Last update: 2024-04-29 04:41:03 UTC


README

Laravel Translator

Latest Version CircleCI GitHub Code Style Action Status Total Downloads

Installation and setup

Installation

You can install the package via composer:

composer require isaeken/laravel-translator

Setup

You can publish the config file with:

php artisan vendor:publish --provider="IsaEken\LaravelTranslator\LaravelTranslatorServiceProvider" --tag="laravel-translator-config"

Usage

You can activate auto save translation

// config/translator.php
'autosave' => true

You can use the translation system as in Laravel standards.

__('Hello :var', ['var' => 'World']); // save to your fallback file when auto save enabled.

You can use the translation system with javascript by adding the "@translator" directive to the head in your design.

<head>
    @translator
    <script src="..."></script>
</head>
__('Hello');
__('Hello :var', {'var': 'World'});

Automatic recording or errors will not work in the translations you use on Javascript.

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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