laravel-i18n-strings-batch maintained by yaroslawww
i18n strings batch
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(
); ?>



