Skip to content

Commit

Permalink
Change translations approach
Browse files Browse the repository at this point in the history
Instead of having each of the translations live on a separate GitHub
Pages site that we link out to let’s get all of the translations
inside this repository. This will make it easier for others to track
and modify all translations as well as making changes that affect all
translations in a single pass.
  • Loading branch information
MikeMcQuaid committed Feb 13, 2018
1 parent 055412a commit 42ee0b0
Show file tree
Hide file tree
Showing 27 changed files with 164 additions and 271 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ If you'd like to contribute, start by searching through the [issues](https://git

If you don't see your idea listed, and you think it fits into the goals of this guide, do one of the following:
* **If your contribution is minor,** such as a typo fix, open a pull request.
* **If your contribution is major,** such as a new guide or a [translation](docs/translations.md), start by opening an issue first. That way, other people can weigh in on the discussion before you do any work.
* **If your contribution is major,** such as a new guide, start by opening an issue first. That way, other people can weigh in on the discussion before you do any work.

## Style guide
If you're writing content, see the [style guide](./docs/styleguide.md) to help your prose match the rest of the Guides.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
locale: en-US
lang: en
title: Best Practices for Maintainers
description: Making your life easier as an open source maintainer, from documenting processes to leveraging your community.
class: best-practices
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
locale: en-US
lang: en
title: Building Welcoming Communities
description: Building a community that encourages people to use, contribute to, and evangelize your project.
class: building
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
locale: en-US
lang: en
title: Your Code of Conduct
description: Facilitate healthy and constructive community behavior by adopting and enforcing a code of conduct.
class: coc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
locale: en-US
lang: en
title: Finding Users for Your Project
description: Help your open source project grow by getting it in the hands of happy users.
class: finding
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
locale: en-US
lang: en
title: Getting Paid for Open Source Work
description: Sustain your work in open source by getting financial support for your time or your project.
class: getting-paid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
locale: en-US
lang: en
title: How to Contribute to Open Source
description: Want to contribute to open source? A guide to making open source contributions, for first-timers and for veterans.
class: contribute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
locale: en-US
lang: en
title: Leadership and Governance
description: Growing open source projects can benefit from formal rules for making decisions.
class: leadership
Expand Down
2 changes: 1 addition & 1 deletion _articles/en-US/legal.md → _articles/legal.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
locale: en-US
lang: en
title: The Legal Side of Open Source
description: Everything you've ever wondered about the legal side of open source, and a few things you didn't.
class: legal
Expand Down
2 changes: 1 addition & 1 deletion _articles/en-US/metrics.md → _articles/metrics.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
locale: en-US
lang: en
title: Open Source Metrics
description: Make informed decisions to help your open source project thrive by measuring and tracking its success.
class: metrics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
locale: en-US
lang: en
title: Starting an Open Source Project
description: Learn more about the world of open source and get ready to launch your own project.
class: beginners
Expand Down
9 changes: 1 addition & 8 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
title: "Open Source Guides"
description: "Learn how to launch and grow your project."

# See: docs/translations.md
locale: en-US
translations:
en-US:
name: English (US)
url: https://opensource.guide

exclude:
- bin
- CNAME
Expand All @@ -29,7 +22,7 @@ permalink: /:path/
collections:
articles:
output: true
permalink: /:name/
permalink: /:path/

defaults:
- scope:
Expand Down
2 changes: 1 addition & 1 deletion _data/fields.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Each piece of content has YAML front matter with these properties:

locale:
lang:
type: String

layout:
Expand Down
30 changes: 0 additions & 30 deletions _data/locale/en-US.yml

This file was deleted.

31 changes: 31 additions & 0 deletions _data/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
en:
locale_name: English
nav:
about: About
contribute: Contribute
index:
lead: Open source software is made by people just like you. Learn how to launch and grow your project.
opensourcefriday: It's Friday! Invest a few hours contributing to the software you use and love
article:
table_of_contents: Table of Contents
back_to_all_guides: Back to all guides
related_guides: Related Guides
footer:
contribute:
heading: Contribute
description: Want to make a suggestion? This content is open source. Help us improve it.
button: Contribute
subscribe:
heading: Stay in touch
description: Be the first to hear about GitHub's latest open source tips and resources.
label: Email Address
button: Subscribe
byline:
# [code], [love], and [github] will be replaced by octicons
format: "[code] with [love] by [github] and [friends]"
# Label for code octicon
code_label: code
# Label for love octicon
love_label: love
# Label for the contributors link
friends_label: friends
49 changes: 27 additions & 22 deletions _includes/footer.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{% assign t = site.data.locales[page.lang][page.lang] %}
<footer class="bg-white border-top text-center pt-5">
<div class="container-lg p-responsive mx-auto">

<div class="d-flex flex-wrap flex-items-stretch">
<div class="col-12 col-sm-6 mb-4 col-border">
<div class="height-full p-5">
<img src="{{ "/assets/images/illos/squirrel.svg" | relative_url }}" class="little-illo mb-3" alt="squirrel illustration">
<h3 class="alt-h3 mb-3">{{ site.data.locale[site.locale].footer.contribute.heading }}</h3>
<p class="mb-3 p-large">{{ site.data.locale[site.locale].footer.contribute.description }}</p>
<h3 class="alt-h3 mb-3">{{ t.footer.contribute.heading }}</h3>
<p class="mb-3 p-large">{{ t.footer.contribute.description }}</p>
<p>
<a data-proofer-ignore href="https://github.com/{{ site.github.repository_nwo }}/edit/{{ site.branch }}/{{ page.path }}" class="btn btn-outline">
{{ site.data.locale[site.locale].footer.contribute.button }}
{{ t.footer.contribute.button }}
</a>
</p>
</div>
Expand All @@ -20,14 +21,14 @@ <h3 class="alt-h3 mb-3">{{ site.data.locale[site.locale].footer.contribute.headi
<form action="//github.us11.list-manage.com/subscribe/post?u=9d7ced8c4bbd6c2f238673f0f&amp;id=b514344ba3" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<img src="{{ "/assets/images/illos/bird.svg" | relative_url }}" class="little-illo mb-3" alt="bird illustration">
<h3 class="alt-h3 mb-3">{{ site.data.locale[site.locale].footer.subscribe.heading }}</h3>
<p class="mb-3 p-large">{{ site.data.locale[site.locale].footer.subscribe.description }}</p>
<h3 class="alt-h3 mb-3">{{ t.footer.subscribe.heading }}</h3>
<p class="mb-3 p-large">{{ t.footer.subscribe.description }}</p>

<div class="mc-field-group col-12">
<label for="mce-EMAIL" class="d-none">{{ site.data.locale[site.locale].footer.subscribe.label }}</label>
<input type="email" placeholder="{{ site.data.locale[site.locale].footer.subscribe.label }}" name="EMAIL" class="form-input required email d-block col-10 mx-auto py-2 px-3 mb-3" id="mce-EMAIL" autocomplete="home email">
<label for="mce-EMAIL" class="d-none">{{ t.footer.subscribe.label }}</label>
<input type="email" placeholder="{{ t.footer.subscribe.label }}" name="EMAIL" class="form-input required email d-block col-10 mx-auto py-2 px-3 mb-3" id="mce-EMAIL" autocomplete="home email">
<input type="checkbox" value="1" name="group[9617][1]" id="mce-group[9617]-9617-0" checked="checked" style="display:none">
<input type="submit" value="{{ site.data.locale[site.locale].footer.subscribe.button }}" name="subscribe" id="mc-embedded-subscribe" class="btn btn-outline">
<input type="submit" value="{{ t.footer.subscribe.button }}" name="subscribe" id="mc-embedded-subscribe" class="btn btn-outline">
</div>
<div id="mce-responses" class="clear">
<div class="" id="mce-error-response" style="display:none"></div>
Expand All @@ -42,38 +43,42 @@ <h3 class="alt-h3 mb-3">{{ site.data.locale[site.locale].footer.subscribe.headin
</div>

<div class="border-top text-gray py-5">
{% if page.lang and site.data.locales.size > 1 %}
<select id="language" class="float-md-left">
{% assign locales = site.data.locales | sort %}
{% for locale in locales %}
{% assign lang = locale[0] %}
{% assign locale_name = locale[1][lang].locale_name %}
{% if page.lang == lang %}
<option value="{{ lang }}" selected="selected">{{ locale_name }}</option>
{% else %}
<option value="{{ lang }}">{{ locale_name }}</option>
{% endif %}
{% endfor %}
</select>
{% endif %}
<p class="float-md-right"><a class="text-gray-light text-small" href="{{ "/notices/" | relative_url }}">fine print</a></p>

<div>
{% capture code %}
{% assign code_label = site.data.locale[site.locale].footer.byline.code_label %}
{% assign code_label = t.footer.byline.code_label %}
<svg height="20" class="octicon octicon-code v-align-middle fill-gray mr-1" aria-label="{{ code_label }}" viewBox="0 0 14 16" version="1.1" width="17" role="img"><path d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"></path></svg>
{% endcapture %}
{% capture love %}
{% assign love_label = site.data.locale[site.locale].footer.byline.love_label %}
{% assign love_label = t.footer.byline.love_label %}
<svg height="20" class="octicon octicon-heart v-align-middle fill-gray mx-1" aria-label="{{love_label}}" viewBox="0 0 12 16" version="1.1" width="15" role="img"><path d="M11.2 3c-.52-.63-1.25-.95-2.2-1-.97 0-1.69.42-2.2 1-.51.58-.78.92-.8 1-.02-.08-.28-.42-.8-1-.52-.58-1.17-1-2.2-1-.95.05-1.69.38-2.2 1-.52.61-.78 1.28-.8 2 0 .52.09 1.52.67 2.67C1.25 8.82 3.01 10.61 6 13c2.98-2.39 4.77-4.17 5.34-5.33C11.91 6.51 12 5.5 12 5c-.02-.72-.28-1.39-.8-2.02V3z"></path></svg>
{% endcapture %}
{% capture github %}
<svg height="20" class="octicon octicon-mark-github v-align-middle fill-gray mx-1" aria-label="GitHub" viewBox="0 0 16 16" version="1.1" width="20" role="img"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
{% endcapture %}
{% capture friends %}
{% assign friends_label = site.data.locale[site.locale].footer.byline.friends_label %}
{% assign friends_label = t.footer.byline.friends_label %}
<a href="https://github.com/github/opensource.guide/graphs/contributors" class="text-gray">{{ friends_label }}</a>
{% endcapture %}

{% assign byline = site.data.locale[site.locale].footer.byline.format %}
{% assign byline = t.footer.byline.format %}
{{ byline | replace: "[code]", code | replace: "[love]", love | replace: "[github]", github | replace: "[friends]", friends }}
</div>

{% if site.translations.size > 1 %}
<div class="text-small my-6">
{% for translation in site.translations %}
<a class="locale-chooser text-gray-light d-inline-block px-1"
lang="{{ translation[0] }}"
href="{{ page.url | prepend: translation[1].url }}?l={{ translation[0] }}">{{ translation[1].name }}</a>
{% endfor %}
</div>
{% endif %}
</div>
</div>
</footer>
14 changes: 14 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,18 @@
<link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i" rel="stylesheet">
<link href="{{ "/assets/css/index.css" | relative_url }}" rel="stylesheet">
{% seo %}
{% if page.lang and site.data.locales.size > 1 %}
{% assign locales = site.data.locales | sort %}
{% for locale in locales %}
{% assign lang = locale[0] %}
{% assign page_lang_slash = page.lang | append: '/' | prepend: '/' %}
{% assign default_url = page.url | replace: page_lang_slash, '/' %}
{% if lang == "en" %}
<link rel="alternate" hreflang="en" href="{{ site.url }}{{ default_url }}" />
<link rel="alternate" hreflang="x-default" href="{{ site.url }}{{ default_url }}" />
{% else %}
<link rel="alternate" hreflang="{{ lang }}" href="{{ site.url }}/{{ lang }}{{ default_url }}" />
{% endif %}
{% endfor %}
{% endif %}
</head>
7 changes: 4 additions & 3 deletions _includes/nav.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{% assign t = site.data.locales[page.lang][page.lang] %}
<nav class="main-nav">
<div class="container-lg mx-auto clearfix">
<div class="float-sm-right">
<ul class="main-links d-flex flex-wrap flex-items-stretch border-left border-bottom border-sm-0 list-style-none">
<li class="d-inline-block border-right">
<a class="d-block p-3 p-sm-4" href="https://github.com/github/opensource.guide#readme">
{{ site.data.locale[site.locale].nav.about }}
{{ t.nav.about }}
</a>
</li>
<li class="d-inline-block border-right">
<a class="d-block p-3 p-sm-4" href="https://github.com/github/opensource.guide/blob/gh-pages/CONTRIBUTING.md">
{{ site.data.locale[site.locale].nav.contribute }}
{{ t.nav.contribute }}
</a>
</li>
</ul>
</div>
{% if page.path != 'index.html' %}
{% if page.layout != 'index' %}
<div class="float-sm-left pl-3 breadcrumb">
<p class="my-0 py-3 py-sm-4 text-gray">
<a href="/" class="text-gray">{{ site.title }}</a>
Expand Down
12 changes: 7 additions & 5 deletions _layouts/article.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
---

{% assign t = site.data.locales[page.lang][page.lang] %}
{% include nav.html %}

<header class="article-header {{ page.class }} bg-gray-light">
Expand All @@ -12,7 +12,7 @@ <h1 class="alt-h1 lh-condensed text-center mb-3">{{ page.title }}</h1>
<nav class="toc mb-4 mb-md-6">
<div class="card col-sm-8 col-md-4 col-lg-3 mx-auto">
<a class="toc-trigger d-block text-center p-3">
<span class="text-black">{{ site.data.locale[site.locale].article.table_of_contents }}</span><svg height="18" class="octicon octicon-triangle-down ml-2 fill-blue v-align-middle icon-flip" viewBox="0 0 12 16" version="1.1" width="13" role="img"><path fill-rule="evenodd" d="M0 5l6 6 6-6z"></path></svg>
<span class="text-black">{{ t.article.table_of_contents }}</span><svg height="18" class="octicon octicon-triangle-down ml-2 fill-blue v-align-middle icon-flip" viewBox="0 0 12 16" version="1.1" width="13" role="img"><path fill-rule="evenodd" d="M0 5l6 6 6-6z"></path></svg>
</a>
<ol class="toc-list list-style-none">
{% for section in page.toc %}
Expand All @@ -34,16 +34,18 @@ <h1 class="alt-h1 lh-condensed text-center mb-3">{{ page.title }}</h1>
{{ content }}
</div>
<div class="text-center pb-4">
<a class="alt-h3" href="/">Back to all guides</a>
<a class="alt-h3" href="/{% if page.lang and page.lang != 'en' %}{{ page.lang | append: '/' }}{% endif %}">
{{ t.article.back_to_all_guides }}
</a>
</div>
</article>

{% if page.related %}
<div class="container-lg p-responsive mx-auto border-top text-center pt-5">
<h2 class="alt-h2">Related Guides</h2>
<h2 class="alt-h2">{{ t.article.related_guides }}</h2>
<div class="gutter-sm d-flex flex-wrap flex-items-stretch pb-md-6">
{% for related in page.related %}
{% assign article = site.articles | where: "class", related | first %}
{% assign article = site.articles | where: 'lang', page.lang | where: 'class', related | first %}
<div class="col-12 col-sm-9 mx-auto col-md-6 mt-4 mt-lg-5">
<a href="{{ article.url | relative_url }}" class="guide-cover {{ article.class }} card height-full d-block">

Expand Down
5 changes: 1 addition & 4 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ site.locale }}">
<html lang="{{ page.lang }}">
{% include head.html %}
<body>
<main>
Expand All @@ -10,9 +10,6 @@

<script src="{{ "/assets/js/index.js" | relative_url }}"></script>
<script type="text/javascript" src="//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js"></script>
{% unless site.locale == "en-US" %}
<script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.15.0/localization/messages_{{ site.locale | split: "-" | first }}.js"></script>
{% endunless %}
<script type="text/javascript">(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';}(jQuery));var $mcj = jQuery.noConflict(true);</script>
</body>
</html>
Loading

0 comments on commit 42ee0b0

Please sign in to comment.