Laravel: Whole lang files in on view
Clash Royale CLAN TAG#URR8PPP
Laravel: Whole lang files in on view
I want to localize my Laravel app.
I call it on blade like this: @lang('bot.bots')
@lang('bot.bots')
But my view I got this:
My bot.php
is:
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',
];
What can be the problem? I did everything like what's in the documentation
trans_choice('bot.bots', $count);
1 Answer
1
Just indicate the count like this
$bots_count = 4 //replace with count
@lang('bot.bots', $bots_count)
You may also use translation choices, for which your array would look like this
return [
'bots' => '0 No Bots|1 Bot|[2,*] Bots',
...
];
Thank you for your answer :)
– Feralheart
Aug 12 at 19:05
You are welcome, Feralheart :-)
– Elisha Senoo
Aug 14 at 14:11
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
It probably works with 'bot.editBot' but not with 'bot.bots'. You gave a translation choice. In this case use the helper
trans_choice('bot.bots', $count);
with count the number of whatever it represents. It could be $bots->count()– Dimitri Mostrey
Aug 12 at 11:18