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

Build translations from mdbook-i18-helpers #1236

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 1 addition & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,7 @@ jobs:
run: mdbook build -d book

- name: Zip exercise templates
run: cd book/exerciser && zip --recurse-paths ../html/comprehensive-rust-exercises.zip comprehensive-rust-exercises/

- 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=/comprehensive-rust/$po_lang/ \
mdbook build -d book/$po_lang
(cd book/$po_lang/exerciser && zip --recurse-paths ../html/comprehensive-rust-exercises.zip comprehensive-rust-exercises/)
mv book/$po_lang/html book/html/$po_lang
echo "::endgroup::"
done
run: cd book && find . -name "exerciser" -type d -exec bash -c 'zip --recurse-paths ./html/$(dirname {})/comprehensive-rust-exercises.zip {}/comprehensive-rust-exercises/' \;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is doing the same thing that the original logic was doing. It looks like the original was putting the archive at book/$po_lang/html/comprehensive-rust-exercises.zip, but with the version you have here they would end up at book/html/$po_lang/comprehensive-rust-exercises.zip. Is this change intentional?


- name: Setup Pages
uses: actions/configure-pages@v2
Expand Down
19 changes: 15 additions & 4 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class = "bob"
curly-quotes = true
additional-js = ["theme/speaker-notes.js"]
additional-css = [
"theme/css/svgbob.css",
"theme/css/speaker-notes.css",
"theme/css/language-picker.css",
"theme/css/frontmatter.css",
"theme/css/svgbob.css",
"theme/css/speaker-notes.css",
"theme/css/language-picker.css",
"theme/css/frontmatter.css",
]
site-url = "/comprehensive-rust/"
git-repository-url = "https://github.com/google/comprehensive-rust"
Expand Down Expand Up @@ -88,3 +88,14 @@ line-numbers = true

[output.exerciser]
output-directory = "comprehensive-rust-exercises"

[output.i18n]
default_language = "en"
translate_all_languages = true
move_translations_to_html_directory = true

[output.i18n.languages]
"en" = "English"
"es" = "Spanish (Español)"
"ko" = "Korean (한국어)"
"pt-BR" = "Brazilian Portuguese (Português do Brasil)"