代码之家  ›  专栏  ›  技术社区  ›  Feralheart

整个lang文件在视图中

  •  1
  • Feralheart  · 技术社区  · 6 年前

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

    但我的观点是: enter image description here

    我的 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',
    ];
    

    有什么问题吗?我做的一切都像文件里的一样

    1 回复  |  直到 6 年前
        1
  •  1
  •   Elisha Senoo    6 年前

    就这样指出伯爵

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

    您也可以使用翻译选项,对于这些选项,数组将如下所示

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