Skip to content
This repository was archived by the owner on Oct 29, 2020. It is now read-only.

Redirects users on homepage to proper path prefix#5458

Merged
itsjoekent merged 5 commits intoDoSomethingArchive:globalfrom
itsjoekent-archive:5349
Oct 13, 2015
Merged

Redirects users on homepage to proper path prefix#5458
itsjoekent merged 5 commits intoDoSomethingArchive:globalfrom
itsjoekent-archive:5349

Conversation

@itsjoekent
Copy link
Contributor

What's this PR do?

Redirects users on the homepage to the proper path prefix (eg: dosomething.org/us, /mx, etc) if they're in one of the countries we support

Where should the reviewer start?

dosomething_global_init() changes

How should this be manually tested?

Access the homepage as an MX user, verify you goto MX homepage (and rest of our supported languages)
Access the homepage as an French user, verify you goto global homepage (no redirect)

Any background context you want to provide?

I think the comments covered everything that needs context.

What are the relevant tickets?

Fixes #5349
Fixes #5348

Screenshots (if appropriate)

This code effects all users, not just anonymous ones like the title of the issue states. Raised this here in Slack for further discussion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drupal has a function language_list() that returns all of the languages with their information. This query works, but I'm thinking that using the built-in function is more drupally, and it's a little less code for us to maintain. This is what language_list() returns by default, but it can return a list keyed by the field you pass in.

Array
(
    [en] => stdClass Object
        (
            [language] => en
            [name] => English
            [native] => English
            [direction] => 0
            [enabled] => 1
            [plurals] => 0
            [formula] => 
            [domain] => 
            [prefix] => us
            [weight] => 0
            [javascript] => 
        )

    [en-global] => stdClass Object
        (
            [language] => en-global
            [name] => English, Global
            [native] => English, Global
            [direction] => 0
            [enabled] => 1
            [plurals] => 0
            [formula] => 
            [domain] => 
            [prefix] => en-global
            [weight] => 0
            [javascript] => 
        )

    [pt-br] => stdClass Object
        (
            [language] => pt-br
            [name] => Portuguese, Brazil
            [native] => Português Brasileiro
            [direction] => 0
            [enabled] => 1
            [plurals] => 2
            [formula] => ($n!=1)
            [domain] => 
            [prefix] => br
            [weight] => 0
            [javascript] => 
        )

    [es-mx] => stdClass Object
        (
            [language] => es-mx
            [name] => Spanish, Mexico
            [native] => Español Mexicano
            [direction] => 0
            [enabled] => 1
            [plurals] => 0
            [formula] => 
            [domain] => 
            [prefix] => mx
            [weight] => 0
            [javascript] => 
        )

)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh thats better, for some reason i thought language list only returned a list of the languages, not all of the details. Ill switch this out!

@itsjoekent
Copy link
Contributor Author

@blisteringherb fixed, good to merge?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

their* local version (sp)

@itsjoekent
Copy link
Contributor Author

@blisteringherb I added support for /campaigns to fix #5348 as well, can you re-look it over real quick?

@angaither
Copy link
Contributor

👍 for now
but I think we should try to refactor some of this to make it a little more readable/maintainable

@itsjoekent
Copy link
Contributor Author

yes for sure

itsjoekent pushed a commit that referenced this pull request Oct 13, 2015
Redirects users on homepage to proper path prefix
@itsjoekent itsjoekent merged commit 1c2f555 into DoSomethingArchive:global Oct 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants