Laravel: 整个 lang 文件都在视图中

Laravel: Whole lang files in on view

我想本地化我的 Laravel 应用程序。

我在 blade 上这样称呼它:@lang('bot.bots')

但我的观点是:

我的 bot.php 是:

<?

return [

    'bots' => 'Bot|Bots',
    'addBot' => 'Add bot',
    'editBot' => 'Edit bot',
    'deleteBot' => 'Delete bot',
    'compose' => 'Compose',
    'addGroup' => 'Add group',
    'editGroup' => 'Edit group',
    'deleteGroup' => 'Delete group',
    'confirmDeleteGroup' => 'Are you sure you want to delete the group?',
    'textRecognition' => 'Text recognition',
    'newRule' => 'Add rule',
    'deleteRule' => 'Delete rule',
    'confirmDeleteRule' => 'Are you sure you want to delete the rule?',
    'editBot' => 'Bot szerkesztése',
    'input' => 'Input',
    'output' => 'Output',
    'addInput' => 'Add input',
    'addOutput' => 'Add output',
    'blocks' => 'Block|Blocks',
    'groups' => 'Group|Groups',
    'text' => 'Text',
    'broadcast' => 'Broadcast',
    'analytics' => 'Analytics',
    'chatPartners' => 'Chat Partners',
];

可能是什么问题?我做了文档中的所有内容

像这样表示计数

$bots_count = 4 //replace with count
@lang('bot.bots', $bots_count)

您也可以使用翻译选项,为此您的数组如下所示

return [

    'bots' => '{0} No Bots|{1} Bot|[2,*] Bots',
    ...
];