• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
language abbreviation in url

#1
Hello everybody,

I am working with codeigniter 4. I have a problem.
how can i recognize language abbreviation in url.

with
PHP Code:
$routes->get('{locale}/books''App\Books::index'); 

I tried but the problem is the following.

1. for all routes {locale} must be defined.
2. without language abbreviation the controller is not found.
3. $routes->setAutoRoute(true); no longer works.

it has to work like this:
when user enters the URL:
http://www.domain.com requires its browser language to be recognized and redirected to http://www.domain.com/en/

and if user enters the URL http://www.domain.com/de/ the locale must be changed in German.

this must work as well:
http://www.domain.com/contoller/method redirect to http://www.domain.com/en/contoller/method

I look forward to your suggestions
thanks
Reply

#2
Did you read this section in the user guide? I didn't try it yet, but it explains how to do it:
https://codeigniter4.github.io/CodeIgnit...#in-routes
Test your translation files with Translation Tester
Reply

#3
(04-24-2019, 06:28 AM)includebeer Wrote: Did you read this section in the user guide? I didn't try it yet, but it explains how to do it:
https://codeigniter4.github.io/CodeIgnit...#in-routes

yes but that is not four for this.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.