LaravelPackages.net
Acme Inc.
Toggle sidebar
yaroslawww/laravel-i18n-strings-batch

Simple way to transfer strings to js component without load all lang files or additional ajax requests.

60
0
1.1.0
About yaroslawww/laravel-i18n-strings-batch

yaroslawww/laravel-i18n-strings-batch is a Laravel package for simple way to transfer strings to js component without load all lang files or additional ajax requests.. It currently has 0 GitHub stars and 60 downloads on Packagist (latest version 1.1.0). Install it with composer require yaroslawww/laravel-i18n-strings-batch. Discover more Laravel packages by yaroslawww or browse all Laravel packages to compare alternatives.

Last updated

i18n strings batch

Packagist License Packagist Version Total Downloads Build Status Code Coverage Scrutinizer Code Quality

Installation

Install the package via composer:

composer require yaroslawww/laravel-i18n-strings-batch

Usage

Set specific directory for language strings.

As usually js strings has other formatting for choise and others - you will want set all js strings to specific directory and call batches without specify directory each time:

use I18nStringsBatch\I18nStringsBatchManager; class AppServiceProvider extends ServiceProvider { public function register() { I18nStringsBatchManager::setDefaultDirectoryPrefix('front-js'); } }

Usage in php

\I18nStringsBatch\Facades\I18nStringsBatch::getBatch(["licenses-list", "modal-confirmation"]); \I18nStringsBatch\Facades\I18nStringsBatch::getBatchJson(["licenses-list", "modal-confirmation"]); // or \I18nStringsBatch\Facades\I18nStringsBatch::getBatch("modal-confirmation"); \I18nStringsBatch\Facades\I18nStringsBatch::getBatchJson("modal-confirmation"); // Using helpers i18n_strings_batch(["licenses-list", "modal-confirmation"]) i18n_strings_batch_json(["licenses-list", "modal-confirmation"]) // or i18n_strings_batch("modal-confirmation") i18n_strings_batch_json("modal-confirmation")

Usage with component

<licenses-list
    :i18n-batch='@transBatch("licenses-list")'
/>
<!-- or -->
<licenses-list
    :i18n-batch='@transBatch(["licenses-list", "modal-confirmation"])'
/>

Usage with vue

Optionally publish assets

php artisan vendor:publish --tag=i18n-string-batch-resources --force

Example you can find there

Add directive to PHPStorm

transBatch
<?php echo i18n_strings_batch_json(
); ?>

Credits

  • Think Studio

Star History Chart