Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"tt(): Argument #4 ($locale) must be of type ?string, array given, called in /site/plugins/kirby-date-methods/index.php on line 317" #4

Open
tobimori opened this issue Feb 13, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@tobimori
Copy link

tobimori commented Feb 13, 2024

I'm running a multi-language setup and this snippet:

CleanShot 2024-02-13 at 17 51 30@2x

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' => '/'
];
@nilshoerrmann nilshoerrmann added the bug Something isn't working label Feb 14, 2024
@nilshoerrmann nilshoerrmann self-assigned this Feb 14, 2024
@nilshoerrmann
Copy link
Member

Thanks for the report!
You are on Kirby 4, I guess?

@nilshoerrmann
Copy link
Member

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?

@tobimori
Copy link
Author

same error

@nilshoerrmann
Copy link
Member

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');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants