You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a loop over the Supported languages and the first two are both english from my SupportedLocales so it returns only the first Locale matched and not the exact matched one.
I have test this it only works when i change the order from the
App Config
public array $supportedLocales = ['en-US','en-GB']; always shows the US page even if you have the default language en-GB
public array $supportedLocales = ['en-GB','en-US']; always shows the GB page even if you have the default language en-US.
Anything else?
No response
The text was updated successfully, but these errors were encountered:
crustamet
added
the
bug
Verified issues on the current code behavior or pull requests that will fix them
label
Nov 5, 2024
Should we make that configurable? Is it worth creating another config file/property? Personally, I'm not convinced, although I would like to hear other people's opinions.
The instant solution would be to extend the Negotiate class and declare changed service in app/Config/Services.php file - which I recommend.
Anyway, not really a bug, maybe a missing feature.
michalsn
added
missing feature
Reported issue which is not a bug but needs to be implemented
and removed
bug
Verified issues on the current code behavior or pull requests that will fix them
labels
Nov 6, 2024
Hello,
I also have an issue with {locale} in url_to() and route_to().
For example, if I create a page in French at /fr/mypage (/{locale}/mypage)
and use url_to('Mycontroller/', 'slug');, it returns the page as /en/mypage.
Please make sure you have updated the App::supportedLocales array with fr. If that's not it, please create a separate issue and provide a minimal code sample so we can reproduce the problem.
PHP Version
8.3
CodeIgniter4 Version
4.5.5
CodeIgniter4 Installation Method
Manual (zip or tar.gz)
Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
No response
What happened?
why like this ? Because i want to show different content for United Kingdom vs United States
Steps to Reproduce
to reproduce you must place UK first instead of the US
The app does not have {locale} specific routes
in your view just put it should always be equal to the $Request->getLocale()
In my Language Folder
I have them in separate folders en-US and en-GB
In the request header i have this
accept-language: en-US,en-GB;q=0.9,en;q=0.8,ro;q=0.7
and if i switch to English - United Kingdom the accept-language changes to this
accept-language:en-GB;en-US;q=0.9,en;q=0.8,ro;q=0.7
Expected Output
When i have the United Kingdom version as my default i should see
when i get the Locale from the Request the en-GB version instead of the en-US
echo $Request->getLocale(); always output en-US in both cases
it should return the en-GB version !
The problem is why is this happening is because of this file
https://github.com/codeigniter4/CodeIgniter4/blob/develop/system/HTTP/Negotiate.php#L181
There is a loop over the Supported languages and the first two are both english from my SupportedLocales so it returns only the first Locale matched and not the exact matched one.
I have test this it only works when i change the order from the
App Config
public array $supportedLocales = ['en-US','en-GB']; always shows the US page even if you have the default language en-GB
public array $supportedLocales = ['en-GB','en-US']; always shows the GB page even if you have the default language en-US.
Anything else?
No response
The text was updated successfully, but these errors were encountered: