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

Host translations in gitbook, using monorepo approach #578

Merged
merged 24 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
35916db
Remove the main gitbook yaml file. Need to be sure that config is pic…
spier Aug 23, 2023
82a95a8
Change config of the en book
spier Aug 23, 2023
033d404
Change config of the ja book
spier Aug 23, 2023
4f0238f
Trying without gitbook.yaml config entirely, to see how the gitbook d…
spier Aug 23, 2023
73a70f5
Change links in en SUMMARY/toc
spier Aug 23, 2023
098ac7e
Revert "Change links in en SUMMARY/toc"
spier Aug 23, 2023
c888a35
Revert "Trying without gitbook.yaml config entirely, to see how the g…
spier Aug 23, 2023
f3ad49e
Change config of the zh book
spier Aug 23, 2023
30a8159
Trying if gitbook picks up the frontmatter
spier Aug 23, 2023
42d79c7
GITBOOK-1: change request with no subject merged in GitBook
spier Aug 23, 2023
96a0dc8
Revert "GITBOOK-1: change request with no subject merged in GitBook"
spier Aug 23, 2023
edc7fce
Testng icon in title (toc) and frontmatter for 30-day-warranty pattern
spier Aug 23, 2023
9188537
Revert "Testng icon in title (toc) and frontmatter for 30-day-warrant…
spier Aug 24, 2023
0d18e79
Generate the TOCs for all books in a GHA matrix build
spier Aug 24, 2023
8f78951
Fix typo
spier Aug 24, 2023
3b71b2a
Fixing yet another typo
spier Aug 24, 2023
931f321
cleanup
spier Aug 24, 2023
59533c0
Writing updated files for the book
spier Aug 24, 2023
101f12b
Update documentation
spier Aug 24, 2023
e8e871c
Change commit messsage in book.yaml workflow run to make clear which …
spier Aug 25, 2023
b6aa268
Improve documentation
spier Aug 27, 2023
999927b
Testing how fast a content change propagates
spier Aug 27, 2023
5d1673f
Testing a formatting change
spier Aug 27, 2023
c59239f
Revert "Trying if gitbook picks up the frontmatter"
spier Aug 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .gitbook.yaml

This file was deleted.

27 changes: 12 additions & 15 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ name: Gitbook Generation
on:
push:
branches:
- "main"
- "book-*"
- main
pull_request:
branches:
- main

jobs:
gitbook-generation:
runs-on: ubuntu-latest

strategy:
matrix:
language: [en, ja, zh]

steps:
- uses: actions/checkout@v3
with:
Expand All @@ -21,22 +27,13 @@ jobs:
working-directory: 'book/scripts/'
bundler-cache: true

- name: Determine book language
run: |
[[ "$GITHUB_REF_NAME" =~ ^book-.*$ ]] && book_language=${GITHUB_REF_NAME:5:2} || book_language="en"
echo "BOOK_LANGUAGE=$book_language" >> $GITHUB_ENV
- name: Generate ToC
run: |
cd book/scripts/
ruby generate_toc.rb $BOOK_LANGUAGE
echo "Generated book for: $BOOK_LANGUAGE" >> $GITHUB_STEP_SUMMARY
- name: Copy .gitbook.yml to root
run: |
cp book/$BOOK_LANGUAGE/.gitbook.yaml .
ruby generate_toc.rb ${{ matrix.language }}
echo "Generated book for: ${{ matrix.language }}" >> $GITHUB_STEP_SUMMARY
- name: Commit updated files for the book
- name: Commit updated toc.md for the book
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Writing updated files for the book
commit_message: Writing updated toc.md for the ${{ matrix.language }} book
15 changes: 9 additions & 6 deletions book/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ We use the [gitbook.com](https://www.gitbook.com) service to host our book.

The `/book` folder contains generator scripts and extra content required to create the gitbook.

- `.github/workflows/book.yml` - A GitHub Action that triggers scripts to generate the book.
- `/book/scripts/generate_toc.rb` - Generates the table of contents (ToC) for the book. It takes patterns of maturity **Structured** and **Validated**, extracts title and patlet, and injects this info into `/book/en/toc_template.md`. The output is written to `/book/en/toc.md`. The ToC is what you see on the left-hand-side menu in the gitbook.
- `/book/en/.gitbook.yaml` - Holds basic configuration for the gitbook service. This file is copied to the root of the repo, if the English book is generated.
- `.github/workflows/book.yml` - A GitHub Action that triggers `generate_toc.rb`.
- `/book/scripts/generate_toc.rb` - Generates the table of contents (ToC) for the book. It takes patterns of maturity **Structured** and **Validated**, extracts title and patlet, and injects this info into `/book/en/toc_template.md`. The output is written to `/book/en/toc.md`. The ToC is what you see in the menu on the left in the gitbook.
- `/book/en/.gitbook.yaml` - Holds basic configuration for the gitbook service.
- `/book/en/introduction.md` - The introduction to our book. This is what the reader sees first when they open the book. *Note:* The current content is based on [README.md](../README.md).
- `/book/en/contribute.md` - Explains how to contribute to this book.
- `/book/en/explore-patterns.md` - Shows the mind map of all patterns. Allows readers to link to the mind map directly.
Expand All @@ -42,10 +42,13 @@ For more on the translation process see [these translation instructions](../tran

The book is generated in multiple languages.

Depending on which **branch** a change is merged into, a different book is generated:
gitbook takes care of the markdown to HTML rendering for us.
To do so, we need to provide a full list of all patterns that should be dipslayed in the book.

* changes merged to `main` branch: triggers the book generation for the **English** book.
* changes merged to `book-<YOUR_LANGUAGE>`[^1] branch: triggers the book generation for the book in the given language e.g. `book-jp` for the **Japanese** book.
As the list of patterns grows over time, we generate the list automatically using `/book/scripts/generate_toc.rb`.
The script is triggered by the [.github/workflows/book.yml](https://github.com/InnerSourceCommons/InnerSourcePatterns/blob/main/.github/workflows/book.yml) workflow, which contains a hard-coded list of all languages for which we need to generate `toc.md` files.

If a new language is added, you need to modify [this line](https://github.com/InnerSourceCommons/InnerSourcePatterns/blob/monorepo-test/.github/workflows/book.yml#L17) in `.github/workflows/book.yml` and add the 2-letter language code of the language that you are adding.

## Objectives of the book

Expand Down
4 changes: 2 additions & 2 deletions book/en/.gitbook.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
root : ./

structure:
readme: book/en/introduction.md
summary: book/en/toc.md
readme: introduction.md
summary: toc.md
4 changes: 2 additions & 2 deletions book/en/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
![InnerSource Patterns book](innersource-patterns-book-cover.jpg)

{% hint style="info" %}
You are reading an early release of the InnerSource Patterns book and may still find broken links, spelling mistakes, or other errors.
Please help us to fix them to produce the best book possible :). Learn how to [contribute to this book](contribute.md).
You can help us to create the best possible book about InnerSource Patterns :).
Learn how to [contribute to this book](contribute.md).
{% endhint %}

Welcome to the **InnerSource Patterns Book**.
Expand Down
4 changes: 2 additions & 2 deletions book/ja/.gitbook.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
root : ./

structure:
readme: book/ja/introduction.md
summary: book/ja/toc.md
readme: introduction.md
summary: toc.md

1 change: 1 addition & 0 deletions book/ja/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Instead edit toc_template.md
* [基本原則ガイダンスの文書化](../../translation/ja/patterns/document-your-guiding-principles.md) - 「オープンソースのベストプラクティスを組織内に適用する」という通常のインナーソースの説明は、オープンソースのバックグラウンドがない人々にはうまく機能しません。 解決策として、インナーソースの最も重要な原則を文書化し広く公開しましょう。
* [実験として始める](../../translation/ja/patterns/start-as-experiment.md) - インナーソースイニシアチブを期間限定の実験として開始し、インナーソースに慣れていないマネージャーがイニシアチブを承認およびサポートしやすくします。
* [成熟度モデル](../../translation/ja/patterns/maturity-model.md) - チームはインナーソースを採用し始めました。このプラクティスは、複数の部門に広がっています。しかし、インナーソースプロジェクトを構成する概念への理解は様々です。解決策は、チームがセルフチェックを経て、まだ気づいていないパターンやプラクティスを発見できるよう、成熟度モデルを提供することです。
* [持続可能な成長のためのエクステンション](../../translation/ja/patterns/extensions-for-sustainable-growth.md) - インナーソースプロジェクトは多くのコントリビューションを受けており、メンテナンスが難しくなっています。メンテナは、プロジェクトのコア部分から離れた拡張機構を提供することで、最小のコストとメンテナンスオーバーヘッドでプロジェクトの能力をスケールアップすることを可能にします。
* [正式なコミュニティリーダー](../../translation/ja/patterns/dedicated-community-leader.md) - インナーソースの取り組みを成功させるために、コミュニケーションとテクニカルの両方のスキルを持つ人をコミュニティのリーダーとして選ぶ。

## 付録<a id="appendix"></a>
Expand Down
4 changes: 2 additions & 2 deletions book/zh/.gitbook.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
root : ./

structure:
readme: book/zh/introduction.md
summary: book/zh/toc.md
readme: introduction.md
summary: toc.md
11 changes: 6 additions & 5 deletions translation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ Please note that this document contains recommendations, aimed at removing barri
- Please make your changes to the respective `.md` file.
- Once you are ready, send us a Pull Request.

### Translating a new InnerSource Patterns
### Adding a new InnerSource Pattern to an Existing Translation

- Copy the pattern that you want to translate from `/patterns/2-structured/<file>.md` to `/translation/<YOUR_LANGUAGE>/patterns/<file>.md`.[^1] Make sure to keep the file name the same.
- Then start your translation in that new file.
- Once you are ready, send us a Pull Request.

### Starting the Translation of a New Language
### Starting the Translation of an Entirely New Language

That is awesome! We welcome your passion. When implementing InnerSource practices in your region, there can be language barriers. There is great value in getting people in your organization to understand InnerSource in their own language.

Before starting a new translation please talk to us in Slack (in the `#innersource-patterns` channel). Alternatively open an issue on this GitHub repo to start an async conversation about your translation project.

The translation should begin by creating a `book-<YOUR_LANGUAGE>` branch to work on.[^1]
e.g. `book-jp` is used for the Japanese translation.
The translation should begin by creating a new `translation-<YOUR_LANGUAGE>` branch to work on.[^1]
e.g. `translation-de` would be used for the German translation.

There are a few things you should prepare before starting a translation project.

Expand All @@ -56,7 +56,8 @@ In particular, for special terms, such as "Trusted Committer", please review not
The patterns books is published in multiple languages, including English, Japanese and Chinese (as of August/2023).
Find the full list of available languages in the [patterns books](https://patterns.innersourcecommons.org/).

Trusted Committers in this repository will also be onboarded during the translation process.
When publishing an entirely new language to our book, we also like to add at least one of the translators as a Trusted Committer to the project.
They will then get notified on any fixes/additions to the translation in the future, and can greatly help us by providing reviews.

When you complete a translation under `/translation/<YOUR_LANGUAGE>/`, a GitHub Actions pipeline will run to generate the output for publication in the gitbook. The process is described in detail in [/book/README.md](/book/README.md).

Expand Down