Jump to content

Language Redirect To Default


jobl
 Share

Recommended Posts

I just pushed my first module to github: https://github.com/jobl/LanguageRedirectToDefault

It's basically a redirect to the default language if the user hits a inactive localized link wich normally throws a 404.

If the page isn't viewable in the default language it does nothing and let pw handle the request (throws a 404).

Some questions on my mind:

- Is the naming right?

- Is there a better method to check for installed languages?

Any input is welcome.

Have a nice day - jobl

Link to comment
Share on other sites

About your two questions. I think that's all right there.

Just note for potential users how this is supposed to work. E.g. it won't work for users not using localised urls (not sure if i would serve an 404 error there in the first place). Also it won't work for a language named "german", which will have a localised url like this www.example.com/de/… or this www.example.de/… .

Link to comment
Share on other sites

About your two questions. I think that's all right there.

Just note for potential users how this is supposed to work. E.g. it won't work for users not using localised urls (not sure if i would serve an 404 error there in the first place). Also it won't work for a language named "german", which will have a localised url like this www.example.com/de/… or this www.example.de/… .

Thanks, i'll update the module description according to your suggestions.

This module will only work if you installed the LanguageSupport module and let pw handle the urls on a per page basis.

Maybe i should make it required.

Please correct me if i'm wrong but the API says it's using the "name" variable to generate the url e.g. a language wich has the name german will produce a localized url like /german/yourpageingerman

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...