Welcome Guest, Not a member yet? Register   Sign In
Ci4 system error localization not working
#1

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?
Reply
#2

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(This post was last modified: 12-31-2020, 08:09 PM by MrWhite.)

(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.
Reply
#4

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(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.
Reply
#6

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.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#7

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

(This post was last modified: 01-06-2021, 07:14 AM by MrWhite.)

(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.
Reply
#9

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
Reply
#10

(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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB