Welcome Guest, Not a member yet? Register   Sign In
Add a global function to return the default locale
#3
Thumbs Up 
(This post was last modified: 02-24-2024, 06:37 AM by Elvis254.)

(02-23-2024, 06:01 PM)kenjis Wrote: You can write it as follows:
PHP Code:
$dateToday Time::today(); 

Because the default locale is used by default.

If you really want to get it, you can use PHP's Locale::getDefault().

Here is the solution.
Code:
rtrim(slash_item('defaultLocale'), '/')

Routing currently includes locale because its negotiated. Anyway thanks.

(02-24-2024, 06:22 AM)Elvis254 Wrote:
(02-23-2024, 06:01 PM)kenjis Wrote: You can write it as follows:
PHP Code:
$dateToday Time::today(); 

Because the default locale is used by default.

If you really want to get it, you can use PHP's Locale::getDefault().

Here is the solution.
Code:
rtrim(slash_item('defaultLocale'), '/')

Routing currently includes locale because its negotiated. Anyway thanks.

Another solution of getting configurations is using the new settings library as shown below.
This one marks the best solution of the problem I was facing yesterday. Am done writing the system. Thanks a lot CodeIgniter Team.

Code:
setting('App.defaultLocale')
Reply


Messages In This Thread
RE: Add a global function to return the default locale - by Elvis254 - 02-24-2024, 06:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB