-
Notifications
You must be signed in to change notification settings - Fork 385
Refactor repository structure to include translations #352
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
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
3aec55d
Begin of refactoring for translations
simonsan 57e2316
Begin of refactoring for translations
simonsan a9ef011
Add third_party directory
simonsan eb062d4
Fold menu items on lvl 1
simonsan 849e856
Remove hardcoded non-existing translations
simonsan fcef1ff
Add shell attribute for GH action
simonsan b9c2b8d
Add comment for translations How to
simonsan 3360a69
Add caching for Rust builds (mdbook)
simonsan c711aa9
Fix missing version flag
simonsan 39e645c
Fix C&P leftover
simonsan 6bdf8d6
Add links to patterns repository
simonsan 8b91a39
Introduce dprint for fomratting code blocks within markdown
simonsan 9d1877f
Add dprint for markdown linting
simonsan 450ac8a
Add book.js to additional js in book.toml
simonsan e933c6a
Remove `de` mock translation
simonsan 87ab40f
Updating messages.pot
simonsan a27e9e4
Format translations.md
simonsan 169f874
Remove gh-pages workflow
simonsan 0276614
Update publish action
simonsan d16d6eb
Comment out builds for different languages
simonsan 7b7c139
Update publishing action
simonsan 972464d
Update GH actions file
simonsan 23bfb33
Add comment on language
simonsan 9b8cc69
Rename action
simonsan f0cc616
Update .github/workflows/setup-rust-cache/action.yml
simonsan 8143a55
Remove code sub-blocks in codeblocks to avoid 4 backticks problem
simonsan 39ce9fb
Update messages.pot
simonsan 29df0e4
Revert "Remove code sub-blocks in codeblocks to avoid 4 backticks pro…
simonsan 82b14e7
Update message.pot, Fix line endings
simonsan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
MDBOOK_VERSION=0.4.28 | ||
MDBOOK_I8N_HELPERS_VERSION=0.1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: Test mdbook chapters | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
mdbook-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Rust cache | ||
uses: ./.github/workflows/setup-rust-cache | ||
|
||
- name: Install mdbook | ||
uses: ./.github/workflows/install-mdbook | ||
|
||
- name: Test code snippets | ||
run: mdbook test | ||
|
||
# TODO: Activate when first translation is available | ||
# i18n-helpers: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v3 | ||
|
||
# - name: Install Gettext | ||
# run: sudo apt install gettext | ||
|
||
# - name: Setup Rust cache | ||
# uses: ./.github/workflows/setup-rust-cache | ||
|
||
# - name: Install mdbook | ||
# uses: ./.github/workflows/install-mdbook | ||
|
||
# - name: Generate po/messages.pot | ||
# run: mdbook build -d po | ||
# env: | ||
# MDBOOK_OUTPUT: '{"xgettext": {"pot-file": "messages.pot"}}' | ||
|
||
# - name: Test messages.pot | ||
# run: msgfmt --statistics -o /dev/null po/messages.pot | ||
|
||
# - name: Expand includes without translation | ||
# run: mdbook build -d expanded | ||
# env: | ||
# MDBOOK_OUTPUT: '{"markdown": {}}' | ||
|
||
# - name: Expand includes with no-op translation | ||
# run: mdbook build -d no-op | ||
# env: | ||
# MDBOOK_OUTPUT: '{"markdown": {}}' | ||
# MDBOOK_PREPROCESSOR__GETTEXT__PO_FILE: po/messages.pot | ||
|
||
# - name: Compare no translation to no-op translation | ||
# run: diff --color=always --unified --recursive expanded no-op | ||
|
||
# find-translations: | ||
# runs-on: ubuntu-latest | ||
# outputs: | ||
# languages: ${{ steps.find-translations.outputs.languages }} | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v3 | ||
|
||
# - name: Find translations | ||
# id: find-translations | ||
# shell: python | ||
# run: | | ||
# import os, json, pathlib | ||
# languages = [p.stem for p in pathlib.Path("po").iterdir() if p.suffix == ".po"] | ||
# github_output = open(os.environ["GITHUB_OUTPUT"], "a") | ||
# github_output.write("languages=") | ||
# json.dump(sorted(languages), github_output) | ||
|
||
# translations: | ||
# runs-on: ubuntu-latest | ||
# needs: | ||
# - find-translations | ||
# strategy: | ||
# matrix: | ||
# language: ${{ fromJSON(needs.find-translations.outputs.languages) }} | ||
# env: | ||
# MDBOOK_BOOK__LANGUAGE: ${{ matrix.language }} | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v3 | ||
|
||
# - name: Install Gettext | ||
# run: sudo apt install gettext | ||
|
||
# - name: Setup Rust cache | ||
# uses: ./.github/workflows/setup-rust-cache | ||
|
||
# - name: Install mdbook | ||
# uses: ./.github/workflows/install-mdbook | ||
|
||
# - name: Test ${{ matrix.language }} translation | ||
# run: msgfmt --statistics -o /dev/null po/${{ matrix.language }}.po | ||
|
||
# - name: Build book with ${{ matrix.language }} translation | ||
# run: mdbook build | ||
|
||
# - name: Upload ${{ matrix.language }} translation | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: rust-design-patterns-${{ matrix.language }} | ||
# path: book/ | ||
|
||
# - name: Test code snippets with ${{ matrix.language }} translation | ||
# run: mdbook test |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Install mdbook and dependencies | ||
|
||
description: Install the mdbook with the dependencies we need. | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Read mdbook version from .env | ||
id: mdbook-version | ||
run: | | ||
. ./.env | ||
echo "::set-output name=MDBOOK_VERSION::${MDBOOK_VERSION}" | ||
shell: bash | ||
|
||
- name: Read mdbook-i8n-helpers version from .env | ||
id: mdbook-i8n-helpers-version | ||
run: | | ||
. ./.env | ||
echo "::set-output name=MDBOOK_I8N_HELPERS_VERSION::${MDBOOK_I8N_HELPERS_VERSION}" | ||
shell: bash | ||
|
||
# The --locked flag is important for reproducible builds. | ||
- name: Install mdbook | ||
run: cargo install mdbook --locked --version '${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}' | ||
shell: bash | ||
|
||
- name: Install i18n-helpers | ||
run: cargo install mdbook-i18n-helpers --locked --version '${{ steps.mdbook-i8n-helpers-version.outputs.MDBOOK_I8N_HELPERS_VERSION }}' | ||
shell: bash | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Lint Markdown | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
style: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: dprint/[email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Deploy mdBook sites to GH Pages | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
# TODO: Update the language picker in index.hbs to link new languages. | ||
# TODO: As long as https://github.com/google/mdbook-i18n-helpers/issues/12 is not implemented, yet. | ||
# TODO: Activate when first translation is available | ||
# These are the languages in addition to 'en', which is the main language | ||
# LANGUAGES: xx | ||
|
||
jobs: | ||
publish: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Rust cache | ||
uses: ./.github/workflows/setup-rust-cache | ||
|
||
- name: Install mdbook | ||
uses: ./.github/workflows/install-mdbook | ||
|
||
- name: Build course in English | ||
run: mdbook build -d book | ||
|
||
# TODO: Activate when first translation is available | ||
# - name: Build all translations | ||
# run: | | ||
# for po_lang in ${{ env.LANGUAGES }}; do | ||
# echo "::group::Building $po_lang translation" | ||
# MDBOOK_BOOK__LANGUAGE=$po_lang \ | ||
# MDBOOK_OUTPUT__HTML__SITE_URL=/patterns/$po_lang/ \ | ||
# mdbook build -d book/$po_lang | ||
# echo "::endgroup::" | ||
# done | ||
|
||
- name: Setup Pages | ||
id: pages | ||
uses: actions/configure-pages@v3 | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: ./book | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Setup Rust cache | ||
|
||
description: Configure the rust-cache workflow. | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup Rust cache | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
prefix-key: v1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"lineWidth": 80, | ||
"markdown": {}, | ||
"includes": [ | ||
"**/*.{md}" | ||
], | ||
"excludes": [], | ||
"plugins": [ | ||
"https://plugins.dprint.dev/markdown-0.15.2.wasm" | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#language-list { | ||
left: auto; | ||
right: 10px; | ||
} | ||
|
||
#language-list a { | ||
color: inherit; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.