How to load Codeigniter 4 lang file into an array variable
PHP Snippet 1:
return [
'list' => [
'Apples',
'Bananas',
'Grapes',
'Lemons',
'Oranges',
'Strawberries'
]
];
$foo = lang('Fruit.list');
PHP Snippet 2:
$language = include('./Language/english.php')
PHP Snippet 3:
<?php
$locale = service('request')->getLocale();
$path = "Language/{$locale}/Validation.php";
$lang = require APPPATH.$path; ;
var_dump($lang);
?>