kirby-date-methods
kirby-date-methods copied to clipboard
"tt(): Argument #4 ($locale) must be of type ?string, array given, called in /site/plugins/kirby-date-methods/index.php on line 317"
I'm running a multi-language setup and this snippet:
always returns an array for me, which results in the error.
My language file looks like this:
<?php
return [
'code' => 'en',
'default' => true,
'direction' => 'ltr',
'locale' => [
'LC_ALL' => 'en_US'
],
'name' => 'English',
'translations' => [],
'url' => '/'
];
Although I tried the following and it didn't work as well:
<?php
return [
'code' => 'en',
'default' => true,
'direction' => 'ltr',
'locale' => 'en_US',
'name' => 'English',
'translations' => [],
'url' => '/'
];
Thanks for the report! You are on Kirby 4, I guess?
We have to adjust our code to also handle full locale arrays. But you say setting a locale as string didn't work either – that's a bit strange because I know this to be working. Are you getting the same error or something else?
same error
Would you mind checking, if this change fixes your issue (adding LC_ALL to the locale method call):
if (kirby()->language()) {
$locale = kirby()
->language()
->locale(LC_ALL);
} else {
$locale = option('locale');
}