Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

HOC: Update to 2020 dates - #35735

#35735
Merged
molly-moen merged 4 commits into
stagingcode-dot-org/code-dot-org:stagingfrom
molly/hoc-datescode-dot-org/code-dot-org:molly/hoc-datesCopy head branch name to clipboard
Jul 10, 2020
Merged

HOC: Update to 2020 dates#35735
molly-moen merged 4 commits into
stagingcode-dot-org/code-dot-org:stagingfrom
molly/hoc-datescode-dot-org/code-dot-org:molly/hoc-datesCopy head branch name to clipboard

Conversation

@molly-moen

@molly-moen molly-moen commented Jul 9, 2020

Copy link
Copy Markdown
Contributor

Update our HOC dates for the 2020 events. This is a re-haul of how we previously stored dates, which was in a single json file we updated manually each year for all countries. This should make future year updates much easier.

There are 4 sets of dates now: Latin America has one date (called this latam), Europe has one date (called this europe), Africa has one date (called this africa) and everyone else (US/Canada, Asia, Australia/New Zealand) use the December date (called this default). We still have countries.json but instead of storing the date translations it stores which date type the country uses, along with the language to use. Then we have 3 sets of date variables in the translations file, and pick a date to use depending on the user's country. We already funneled the date translation through hourofcode_helpers.campaign_date, so I repurposed that method to pick the correct variable and send it back.

The dates are:
Latin America: October 1 - December 18
Africa: October 1-31
Europe: October 10-25
Default: December 7-13

Links

Testing story

Validated the dates appear correctly depending on the type of the user's country.

Reviewer Checklist:

  • Tests provide adequate coverage
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@molly-moen
molly-moen requested review from a team, Hamms and breville July 9, 2020 18:40
@molly-moen
molly-moen requested a review from a team as a code owner July 9, 2020 18:40

@breville breville left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Really great work.

I guess one downside is that we will lose the existing translations until new ones come in?

id = "europe_#{id}"
end

return HOC_I18N[language][id] || HOC_I18N['en'][id]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does HOC_COUNTRIES vs. HOC_I18N represent?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

HOC_COUNTRIES is the parsed countries.json file as an object. HOC_I18N is all the *.yml files (per language) for the hour of code translation variables--so the new variables I put in en.yml will be in HOC_I18N

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 thanks!

@molly-moen

Copy link
Copy Markdown
Contributor Author

Really great work.

I guess one downside is that we will lose the existing translations until new ones come in?

That is true, although with so many switching to the non-default hour of code week it would have been hard to maintain the existing translations (a lot of switches from December to October).

@molly-moen

Copy link
Copy Markdown
Contributor Author

Update on this PR: it turns out Latin America and Africa have different date ranges, so what was originally 3 sets of variables is now 4. The description has been updated with the new dates.

id = 'campaign_date_full_year'
end

if %w(latam europe africa).include? type

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it worth doing the opposite of this? i.e. unless type == 'default'. I feel like it's possible that we add another set of dates and then we would only have to edit countries.json and en.yml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that's fair, I was worried about the likelihood of someone putting an incorrect type in there, in which case we would want to fall back to default instead of using an id that doesn't exist

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ooo good point!

@bethanyaconnor

Copy link
Copy Markdown
Contributor

Really great work.

I guess one downside is that we will lose the existing translations until new ones come in?

That's true but given that the dates are changing, this feels like when we want to lose the translations so there isn't incorrect info on the site.

@molly-moen
molly-moen merged commit 8e85b6a into staging Jul 10, 2020
@molly-moen
molly-moen deleted the molly/hoc-dates branch July 10, 2020 00:08
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.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.