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

Add language picker for docs #2403

Merged
merged 7 commits into from
Aug 30, 2023
Merged
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
15 changes: 14 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ defaults:

env:
RUSTFLAGS: --deny warnings
LANGUAGES:

jobs:
docs:
Expand All @@ -34,7 +35,18 @@ jobs:
chmod +x mdbook-linkcheck
pwd >> $GITHUB_PATH

- run: mdbook build docs
- name: Build docs
run: mdbook build docs -d build

- name: Build all translations for docs
run: |
for lang in ${{ env.LANGUAGES }}; do
echo "::group::Building $lang translation"
MDBOOK_BOOK__LANGUAGE=$lang \
mdbook build docs -d build/$lang
mv docs/build/$lang/html docs/build/html/$lang
echo "::endgroup::"
done

- name: Deploy Pages
uses: peaceiris/actions-gh-pages@v3
Expand All @@ -43,6 +55,7 @@ jobs:
github_token: ${{secrets.GITHUB_TOKEN}}
publish_branch: gh-pages
publish_dir: docs/build/html

lint:
runs-on: ubuntu-latest

Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,15 @@ Release x.y.z
- Update dependencies
- Update database schema version
```

Translations
------------

To translate [the docs](https://docs.ordinals.com) we use this
[mdBook i18n helper](https://github.com/google/mdbook-i18n-helpers).
So read through their [usage guide](https://github.com/google/mdbook-i18n-helpers/blob/main/USAGE.md)
to see the structure that translations should follow.

There are some other things to watch out for but feel free to just start a
translation and open a PR. A maintainer will then help you integrate it into our
build system.
5 changes: 5 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ src = "src"
[build]
build-dir = "build"
create-missing = false
extra-watch-dirs = ["po"]

[output.html]
cname = "docs.ordinals.com"
default-theme = "coal"
git-repository-url = "https://github.com/ordinals/ord"
preferred-dark-theme = "coal"
additional-css = ["language-picker.css"]

[output.linkcheck]

[preprocessor.gettext]
after = ["links"]
8 changes: 8 additions & 0 deletions docs/language-picker.css
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;
}
Loading