Redirects users on homepage to proper path prefix#5458
Redirects users on homepage to proper path prefix#5458itsjoekent merged 5 commits intoDoSomethingArchive:globalfrom
Conversation
There was a problem hiding this comment.
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] =>
)
)
There was a problem hiding this comment.
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!
|
@blisteringherb fixed, good to merge? |
There was a problem hiding this comment.
their* local version (sp)
|
@blisteringherb I added support for /campaigns to fix #5348 as well, can you re-look it over real quick? |
|
👍 for now |
|
yes for sure |
Redirects users on homepage to proper path prefix
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