CodeIgniter Forums
Ci4 system error localization not working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Ci4 system error localization not working (/showthread.php?tid=78303)

Pages: 1 2


Ci4 system error localization not working - MrWhite - 12-31-2020

hey check this image. 

[Image: T64MpuK.png]

I did put de local lang directory inside or app/Language directory. and default local is 'en'.

but these kind of system error messages still display in English. why?

my app's view files work fine with 'de' local. system ones are the problem.

any idea?


RE: Ci4 system error localization not working - InsiteFX - 12-31-2020

Because you need to load each language file for the language being used.

So you need a dropdown or whatever to pick the language and then load the language
they picked.


RE: Ci4 system error localization not working - MrWhite - 12-31-2020

(12-31-2020, 12:31 PM)InsiteFX Wrote: Because you need to load each language file for the language being used.

So you need a dropdown or whatever to pick the language and then load the language
they picked.

No, thats wrong.

CI4 automatically pick the local from the url (im using {local} in my routes) and if its a valid defined local then its set to the current local. as i said my apps views works fine with the de local. only the system views like this wont work.


RE: Ci4 system error localization not working - InsiteFX - 01-01-2021

There are no 404 error language files the 404 is a html view under Views errors.

Which means the web browser should change it depending on the language.


RE: Ci4 system error localization not working - MrWhite - 01-01-2021

(01-01-2021, 02:36 AM)InsiteFX Wrote: There are no 404 error language files the 404 is a html view under Views errors.

Which means the web browser should change it depending on the language.

Yeah I guess we have to create custom error pages for achieve this.


RE: Ci4 system error localization not working - includebeer - 01-01-2021

As you can see here, the default 404 error page is not localized. You will need to create your own view and add translated error messages to your language files.


RE: Ci4 system error localization not working - paulbalandan - 01-05-2021

You need to have in the routes definition a `{locale}` placeholder so that the Request object can set the locale properly.


RE: Ci4 system error localization not working - MrWhite - 01-06-2021

(01-05-2021, 11:22 PM)paulbalandan Wrote: You need to have in the routes definition a `{locale}` placeholder so that the Request object can set the locale properly.

Hey, thats the strange thing here.

As I said in one of my previous replies to this thread, {local} part already in my routes group. and working fine for my custom views. but not working for these system error pages.

I get that (404 - File Not Found) title part cannot be localized. but I think error message itself should get localized to the right local in the url (HTTP.php lang file does have corresponding lang string for this error messsage.). but its not happening. but when I change public $defaultLocale = 'en'; to public $defaultLocale = 'de'; then that error message get localized into 'de' local. I think this a bug. These error messages should respect {local} part in the urls.


RE: Ci4 system error localization not working - davis.lasis - 01-06-2021

You need Codeigniter global language translations. It has DE language as well. 
Add this in your composer or download manually in your system

https://github.com/codeigniter4/translations


RE: Ci4 system error localization not working - MrWhite - 01-06-2021

(01-06-2021, 09:55 AM)davis.lasis Wrote: You need Codeigniter global language translations. It has DE language as well. 
Add this in your composer or download manually in your system

https://github.com/codeigniter4/translations

Already have 'de' translations. and working greate for validation and etc... but not working as expected for error messages for these system error pages. I think this is a bug.