karlvalentin/laravel-i18n-check

用于检查语言资源的 Artisan 命令。

v2.0.0 2024-09-17 20:19 UTC

This package is auto-updated.

Last update: 2024-09-17 20:21:39 UTC


README

此包提供 artisan 命令 i18n:check

它检查所有翻译是否在每种语言中都可用。

安装

可以使用 composer 安装此包

composer require karlvalentin/laravel-i18n-check

可选:配置

发布配置

要更改配置,需要将其发布

artisan vendor:publish --provider="KarlValentin\LaravelI18nCheck\I18nCheckServiceProvider" --tag="config"

此包的配置现在可以在 /config/i18ncheck.php 中找到。

选项

array skipDirectories

skipDirectories 选项是一个目录数组,这些目录不应被解析。

默认定义

'skipDirectories' => [
    'vendor',
],

用法

运行 Artisan 命令

要检查您的语言资源,请运行

artisan i18n:check

在测试中运行 i18n:check

您可能希望在测试中运行 artisan 命令。

<?php

use Illuminate\Foundation\Testing\TestCase;
use Tests\CreatesApplication;

class LanguageResourcesTest extends TestCase
{
    use CreatesApplication;

    public function testTranslationsAreAvailableInAllLanguages()
    {
        $this
            ->artisan('i18n:check')
            ->assertExitCode(0);
    }
}