Welcome Guest, Not a member yet? Register   Sign In
defaultLocale no effect
#1

(This post was last modified: 06-29-2022, 08:36 AM by Arquero. Edit Reason: typo )

PHP 7.4.28, CodeIgniter 4.1.9 fresh instalation.

Copy "es" folder from languages zip to "app/Language" and change "app/Config/App.php" that way:

PHP Code:
public $defaultLocale 'es';
public 
$negotiateLocale false;
public 
$supportedLocales = ['es''en'];
public 
$appTimezone 'Europe/Madrid'

In browser go to URL + "añslkjfañ", and see 404 error page translated.

The exact same thing with CodeIgniter 4.2.1 and 404 error page is still in english and no way to see it translated.

Bug? Missconfiguratión? I forget something to do in new version?

No new autoroutes enabled, I just upload zip file and set "writable" folder writable, nothing else just the changes related to language en "app/Config/App.php" so easily replicable.

Thanks for your time.
Reply
#2

(This post was last modified: 06-29-2022, 02:07 AM by kenjis.)

It seems a bug.

Try spark command:
Code:
$ php spark x

If the lang files are correctly installed and configured,
you can see a translated error message.
Reply
#3

(This post was last modified: 06-29-2022, 08:37 AM by Arquero. Edit Reason: typo )

Thanks for your answer kenjis.

Indeed if I run:

PHP Code:
php spark x 


I see the error message translated. Is it a bug so?
Reply
#4

The bug was fixed in develop branch, and it will be included in v4.2.2.
https://github.com/codeigniter4/CodeIgniter4/pull/6202
Reply
#5

In development environment, the error message is hard coded. So you can't translate it.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB