New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language links refactor #818

Merged
merged 16 commits into from May 5, 2018

Conversation

Projects
None yet
3 participants
@mdlincoln
Copy link
Member

mdlincoln commented Apr 27, 2018

This is a major back-end modification that adjusts how to point to and from translations and their sources. As a result, we should now theoretically be able to host any number of languages on the site. Another nice benefit is that clicking on the [es] or [en] links at the top of the page should now - when there is a translation / translation source - take you to the companion page for the one you were just on, rather than dumping you all the way back at the home page for that language.

This works by doing two searches every time a page is generated:

  1. if the page has YAML metadata pointing to a source translation, this identifies that exact page and makes that source's metadata available when rendering the translation's page.
  2. Searches all other pages across the site to see if they're translations of the page being rendered. If so, makes all the metadata of those pages available as needed.

This results in only one change for the editorial guidelines for producing translations: instead of using redirect-from: /lessons/LESSON-SLUG, editors will now use original: LESSON-SLUG (note no leading directory information). I've already gone through and updated all the existing translations for this. All new translations of non-lesson pages will also require this original tag. Doing this means we have a dedicated bit of metadata for finding translation sources, and leaves redirect-from to do its important work of ensuring good redirects without saddling it with other responsibilities.

I still have a few open tasks:

  • Enforce checking for original tags appropriately (might be a separate PR since #816 is also underway right now)
  • Made a little "translation map" that is mostly just useful for internal debugging, but it needs some kind of link on the site. netlify preview
  • render translation map as a table

Closes: #785

Re: #651

@mdlincoln mdlincoln self-assigned this Apr 27, 2018

@mdlincoln mdlincoln requested review from walshbr and arojascastro Apr 27, 2018

@arojascastro
Copy link
Contributor

arojascastro left a comment

Ok, thank you for this. I understand that you changed already the metadata of the existing translations by replacing redirect with original and that you also modified our guidelines for editors, right? Great job!

mdlincoln added some commits May 5, 2018

enforce "original" links on spanish lessons
This does mean that lessons submitted originally in Spanish will need to
use the "exclude_from_check" tag.

@mdlincoln mdlincoln merged commit 5329dca into gh-pages May 5, 2018

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details

@mdlincoln mdlincoln deleted the language-refactor branch May 5, 2018

@mdlincoln mdlincoln added this to the French Integration milestone May 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment