alexeybob/laravel-translator

PHP Laravel artisan 命令,自动提取翻译内容并更新翻译文件

v1.2.4 2019-10-16 15:23 UTC

This package is not auto-updated.

Last update: 2024-09-29 06:02:28 UTC


README

翻译应用程序时最耗时的任务是提取所有要翻译的模板内容,并保持所有翻译文件同步。此包包含一个名为 translation:update 的命令,可帮助您完成这些任务。

安装

$ composer require alexeybob/laravel-translator dev-master

命令

更新命令

从源代码更新翻译。

$ php artisan translation:update {locale} {--force} {--dump-messages}

参数

选项

更新未跟踪命令

使用未跟踪消息更新翻译。

如果您想跟踪未跟踪的消息,请使用 __abtrans_choice_ab

未跟踪 消息是什么:{{ __($message) }}{{ trans_choice($message, 5, ['value' => 5]) }}

当您使用 __abtrans_choice_ab@lang_ab@choice_ab 函数时,它们将以与 __trans_choice@lang@choice 相同的方式工作,同时将所有消息记录到特殊的日志文件中。

$ php artisan translation:untracked {locale} {--force} {--dump-messages}

参数

选项

差异命令

翻译文件和源代码消息之间的差异。

php artisan translation:diff en

参数

选项

如果由于任何原因 artisan 无法找到命令,您可以在您的 config/app.php 文件上手动注册提供者。

return [
    ...
    'providers' => [
        ...
        AB\Laravel\Translator\ServiceProvider::class,
        ...
    ]
]