Skip to content
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

feat(www): Pull in translated gatsby docs (ENABLE_LOCALIZATIONS env var needed) #20637

Merged
merged 18 commits into from
Jan 22, 2020
Merged

feat(www): Pull in translated gatsby docs (ENABLE_LOCALIZATIONS env var needed) #20637

merged 18 commits into from
Jan 22, 2020

Conversation

tesseralis
Copy link
Contributor

@tesseralis tesseralis commented Jan 16, 2020

Description

Pull in translated gatsby docs and display those docs on the site.

Live Example

https://build-57f60042-fb09-471c-9527-4479f5ba2c36.gtsb.io/es/tutorial/

Notes

  • Languages are Spanish, Indonesian, Polish, Brazilian Portuguese, and Simplified Chinese. These are the languages so far that have the main tutorial series translated.
  • Only tutorial pages are translated right now, since other directories have relatively imported components that cause the site to crash
  • Translations are disabled by default, and can be turned on using by setting the ENABLE_LOCALIZATIONS variable
  • Lots of follow up issues, listed below

Follow-up Issues

  • Show localized pages as "active" in the sidebar
  • Support anchor links
  • Replace all gatsby links with localizedLink (and lint against using the default gatsby link)

Related Issues

fixes: #19353 #17759

@@ -4,7 +4,7 @@ import { graphql, useStaticQuery } from "gatsby"

import gatsbyIcon from "../assets/gatsby-icon.png"

const SiteMetadata = ({ pathname }) => {
const SiteMetadata = ({ pathname, locale }) => {
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 it better to pull in context or pass the locale down? SiteMetadata is so far only used in Layout

Copy link
Contributor

Choose a reason for hiding this comment

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

For the current setup I don't think it'll make a difference. I would consider using Context if the component e.g. would be used in MDX (for ease of use).

@@ -475,6 +487,7 @@ exports.createPages = ({ graphql, actions, reporter }) => {
node {
fields {
slug
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might end up causing confusion since here, "slug = path without locale".

Copy link
Contributor

@LekoArts LekoArts Jan 22, 2020

Choose a reason for hiding this comment

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

I guess in the interim phase we have to live with that, once we have all parts of the site we could make a localizedSlug or localize the slug

@tesseralis tesseralis marked this pull request as ready for review January 17, 2020 02:31
@tesseralis tesseralis requested a review from a team as a code owner January 17, 2020 02:31
@KyleAMathews
Copy link
Contributor

Is there a preview of this we can look at?

@tesseralis
Copy link
Contributor Author

@KyleAMathews I'm trying to build it on Gatsby Cloud but it's been finnicky, and there's currently no way to re-trigger a build AFAIK. Do we not have it set up to create a preview build on PRs?

@tesseralis
Copy link
Contributor Author

Here's a version of it with localizations not enabled, to test that everything works as before:

https://build-62c1fb03-2fe2-4db8-8b36-3d08af0fdde2.gtsb.io/

@KyleAMathews
Copy link
Contributor

It's not setup yet for preview builds. If you add your fork as a site however it'll build your branches.

LekoArts
LekoArts previously approved these changes Jan 22, 2020
Copy link
Contributor

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

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

Overall LGTM 👍 Good job :)

Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

What Lennart said ;)

@pieh pieh changed the title Pull in translated gatsby docs feat(www): Pull in translated gatsby docs (ENABLE_LOCALIZATIONS env var needed) Jan 22, 2020
@tesseralis tesseralis merged commit 56bc2b1 into gatsbyjs:master Jan 22, 2020
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.

Pull in translation repos as sources to gatsbyjs.org
4 participants