Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 896247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:41:48+00:00 2026-05-15T14:41:48+00:00

My localization files (.po) work if I change the default language, but I can’t

  • 0

My localization files (.po) work if I change the default language, but I can’t make the routes working, here’s what I’ve got atm:

Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Router::connect('/login/*', array('controller' => 'users', 'action' => 'login'));
Router::connect('/logout/*', array('controller' => 'users', 'action' => 'logout'));
Router::connect('/register/*', array('controller' => 'users', 'action' => 'register'));
Router::connect('/:lang/:controller/:action/*', array('lang' => 'en'), array('lang' => 'en|fr'));

But when I try : domain.com/fr/login, the cake is looking for the “fr” controller.

I am using this function in the AppController beforeFilter to switch between languages:

    function setLanguage() {
        if(!isset($this->params['lang']))
        {
            $this->params['lang'] = 'en';
        }
        $lang = $this->params['lang'];
        App::import('Core', 'i18n');
        $I18n =& I18n::getInstance();
        $I18n->l10n->get($lang);
        foreach (Configure::read('Config.languages') as $lang => $locale)
        {
            if($lang == $this->params['lang'])
            {
                $this->params['locale'] = $locale['locale'];
            }
        }
    }

Cheers,
Nicolas.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:41:48+00:00Added an answer on May 15, 2026 at 2:41 pm

    You do not have a login controller. So your bottom route does not match and Cake then tries the default by looking for an fr controller.

    Routes don’t interact as you expect them to:

    /login – would match your second route

    /fr/users/login – would match your last route.

    /fr/login – does NOT intelligently “merge” the two routes. You need to explicitly make such a route.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just can't seem to get localization to work. I have a class library.
I work on a lot of Asian Language localization projects, and am looking for
So, I have a few resource files for localization. They're strings that can be
I'm working on a C# .NET application and I'm performing localization with resource files.
Resource files seem great for localization of labels and messages, but are they perfect?
For localization I'm using the Resource-file (.resx files) functionality in .NET, but I'm wondering
Does Java have an equivalent to .NET resource (.resx) files for localization? In .NET,
I'm working on a quite simple Webpage (MVC2), using localisation based on Resource Files.
I am working on localization for a asp.net application that consists of several projects.
I am working on localization for an app where custom patterns are used to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.