Welcome Guest, Not a member yet? Register   Sign In
Getting supportedLocales after upgrade to 4.5.1
#1

Hi everyone,
I am using https://includebeer.com/en/blog/creating...r-4-part-1 for localization and after upgrading to 4.5.1, I am getting this error: 
Code:
Cannot access protected property CodeIgniter\HTTP\IncomingRequest::$config

APPPATH/Controllers/BaseController.php at line 61

60        $this->viewData['locale'] = $request->getLocale();
61        $this->viewData['supportedLocales'] = $request->config->supportedLocales;

Looking at the documentation, I tried to replace the call with
Code:
$this->viewData['supportedLocales'] = config('supportedLocales');
I don't get the error anymore, but when I want to display the navigation elements and call $supportedLocales inside my view, It is NULL so I am not doing the right thing.

Can anyone help me?
Reply
#2

config("App")->supportedLocales ?
Reply
#3

(This post was last modified: 04-22-2024, 08:57 AM by kcs.)

I actually managed to solve it this way:

Code:
$this->viewData['supportedLocales'] = config('App')->supportedLocales;

In case someone needs it too Shy

(04-22-2024, 08:30 AM)ozornick Wrote: config("App")->supportedLocales ?
Thanks for your help, I found it at the same time Big Grin
Reply
#4

PHP Code:
$this->viewData['supportedLocales'] = config('App')->supportedLocales
What did you Try? What did you Get? What did you Expect?

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

(04-23-2024, 12:24 AM)InsiteFX Wrote:
PHP Code:
$this->viewData['supportedLocales'] = config('App')->supportedLocales

Thanks @InsiteFX for having also provided help Smile I find this forum very understanding of the struggles less savvy people like me go through
Reply




Theme © iAndrew 2016 - Forum software by © MyBB