Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default routing language #29

Closed
mandricmihai opened this issue Jul 26, 2017 · 1 comment
Closed

Change default routing language #29

mandricmihai opened this issue Jul 26, 2017 · 1 comment

Comments

@mandricmihai
Copy link

mandricmihai commented Jul 26, 2017

How to change defualt routing language?
I always get redirected to /en
I tried:

app.php
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'ro_RO'),
Application.php
->add(new \ADmad\I18n\Middleware\I18nMiddleware([
				'defaultLanguage' => 'ro',
				'languages' => [
					'ro' => ['locale' => 'ro_RO'],
					'en' => ['locale' => 'en_US'],
					
				],
			]));
bootstrap.php
Configure::write('I18n.languages', ['ro', 'en']);

When I go to / I get redirected to /en not /ro

My routes

	$routes->connect(
        '/:controller',
        ['action' => 'index'],
        ['routeClass' => 'ADmad/I18n.I18nRoute']
    );
	$routes->connect(
        '/',
		[
			'controller' => 'Pages',
			'action' => 'display','home',
		]);
    $routes->connect(
        '/:controller/:action/*',
        [],
        ['routeClass' => 'ADmad/I18n.I18nRoute']
    );
@ADmad ADmad closed this as completed in f7d642e Jul 27, 2017
@ADmad
Copy link
Owner

ADmad commented Jul 27, 2017

Set detectLanguage to false if you want to always redirect to /ro. Else it will redirect based on your browser language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants