amgrade/laravel-js-translations

将翻译提取到JS

1.0.1 2024-02-29 13:24 UTC

This package is auto-updated.

Last update: 2024-08-29 14:32:15 UTC


README

轻松将Laravel翻译导出到JavaScript。

安装

composer require amgrade/laravel-js-translations

然后,如果您不使用Laravel包自动发现功能,您需要将 JsTranslationServiceProvider 添加到 config/app.php

/*
 * Package Service Providers...
 */
AMgrade\JsTranslations\JsTranslationServiceProvider::class,

配置

您可以根据需要声明多个束(bundle),并使用不同的选项。例如,当您想将翻译分为管理部分和客户端部分时,只需传递 php artisan js-translations:extract --bundle=adminphp artisan js-translations:extract --bundle=client。有关详细配置,请参阅配置文件。

使用方法

只需运行 php artisan js-translations:extract