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

Translated facts bug fix olé#5660

Merged
weerd merged 5 commits intoDoSomethingArchive:globalfrom
weerd:translated-facts-bug-fix-olé
Oct 29, 2015

Hidden character warning

The head ref may contain hidden characters: "translated-facts-bug-fix-ol\u00e9"
Merged

Translated facts bug fix olé#5660
weerd merged 5 commits intoDoSomethingArchive:globalfrom
weerd:translated-facts-bug-fix-olé

Conversation

@weerd
Copy link
Contributor

@weerd weerd commented Oct 28, 2015

Fixes #5572

What's this PR do?

To minimize the potential for breaking lots of campaign related code, took a more subtle approach to fixing the translation bug related to Facts. The EntityDrupalWrapper class was causing problems with grabbing the correct facts related to regional content (translated, but as separate unique nodes and not nodes with translations as part of the node object).

Instead, created a separate function to handle grabbing that data from the node, without interrupting how the rest of the campaign node data is loaded when constructing the campaign object. It allows for grabbing content if there are translations and ones specific to the language defined by the url path (/us/ or /mx/ etc) or just grabbing the available content if no language specific options available, but there is definitely content in the field.

Where should the reviewer start?

Probably in the dosomething_campaign.helpers.inc file at line 183 with the @TODO explanation and then follow the bread crumb trail of code... 🍞

How should this be manually tested?

We'll test on Thor which has a bunch of language related content to make testing easier.

Any background context you want to provide?

To help with mitigating bugs and not break how the dosomething_campaign_load() function loads and creates the campaign standard object, the aim with the custom function was to set it up in a way that it would return data back to the dosomething_campaign_load() function in the same format/structure that the EntityDrupalWrapper would have, because that's the structure the rest of the code is relying on. Deviating from that structure could end up causing more bugs that we'd need thorough testing to actually find and then iron out. So went with the path of least resistance; but also why some of the code may see a little odd in places, in the effort to accommodate the above intentions! 🌎

What are the relevant tickets?

#5572

Screenshots (if appropriate)

US specific content at /us/node/1283:
image

MX specific content at /mx/node/1283:
image

MX specific content, but none entered in the admin /mx/node/1321:
image


@angaither

cc: @mikefantini @namimody

Diego Lorenzo added 5 commits October 27, 2015 17:01
The function body that executes to conver the country to the appropriate language code requires the country to be in uppercase, so wrapped it in php strtoupper() so it always uppercases it and doesn't break or give false result because a lowercase country string was passed.
To minimize the potential for breaking lots of campaign related code, took a more subtle approach to fixing the translation bug related to Facts. The EntityDrupalWrapper class was causing problems with grabbing the correct facts related to regional content. Instead, created a separate function to handle grabbing that data from the node, without interrupting how the rest of the campaign node data is loaded when constructing the campaign object. It allows for grabbing content if there are translations and ones specific to the language defined by path (/us/ or /mx/ etc) or just grabbing the available content if no language specific options available, but there is definitely content in the field.
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, also check out the helper function that @sergii-tkachenko just wrote in #5661

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is global $language_content based on just the path prefix or does it take into account user preference, headers, etc?

I can take a look and see what it outputs in various url path scenarios...

@angaither
Copy link
Contributor

just some minor comments, but not needed for merge 👍
olé

🎉 💃

weerd added a commit that referenced this pull request Oct 29, 2015
@weerd weerd merged commit a37f063 into DoSomethingArchive:global Oct 29, 2015
@weerd weerd deleted the translated-facts-bug-fix-olé branch October 29, 2015 14:14
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.

2 participants