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

fix to handle different url rules in different languages for the same action #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

albertborsos
Copy link

related to #129

I have tried to use different urls in different languages which are points to a static controller/action route.

With this modification and the following url rules it is working well.
Order of the language related url rules is matter.
Default language comes first then the rules for other languages.

    ...
    'urlManager' => [
        'class' => '\codemix\localeurls\UrlManager',
        'languages' => ['en', 'hu'],
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules' => [
            '/'           => 'frontend/default/landing',
            [
                'pattern' => '/jatek',
                'route' => 'frontend/default/game',
                'defaults' => ['language' => 'hu'],
            ],
            [
                'pattern' => '/feliratkozas',
                'route' => 'frontend/default/subscribe',
                'defaults' => ['language' => 'hu'],
            ],
            [
                'pattern' => '/game',
                'route' => 'frontend/default/game',
                'defaults' => ['language' => 'en'],
            ],
            [
                'pattern' => '/subscribe',
                'route' => 'frontend/default/subscribe',
                'defaults' => ['language' => 'en'],
            ],
        ],
    ],
    ...

I cannot manage to run tests locally, I will check this in travis.

@mikehaertl
Copy link
Collaborator

I currently don't have time to take a closer look here. But I'm quite surprised that there are still problems with URL rules. If you check the current set of tests you'll see, that they are quite extensive and already try to check each and every aspect. It's crucial that you get those running locally first. Your change now seems to break things.

@albertborsos
Copy link
Author

Ok, I also have no time to figure it out, why this change breaks the build.
I would have written tests, but there is no dependencies for the dev environment in the composer.json.
But I will check soon how Travis runs the tests.

@mikehaertl
Copy link
Collaborator

All you need should be phpunit. I'm using version 6 here via the global .phar file:

https://phpunit.de/getting-started/phpunit-6.html

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

Successfully merging this pull request may close these issues.

2 participants