File tree 5 files changed +445
-2
lines changed
5 files changed +445
-2
lines changed Original file line number Diff line number Diff line change 1
1
name : CI
2
2
on : [push, pull_request]
3
3
4
+ env :
5
+ # Update the language picker in index.hbs to link new languages.
6
+ LANGUAGES :
7
+
4
8
jobs :
5
9
test :
6
10
name : Run tests
7
11
runs-on : ubuntu-latest
8
12
steps :
9
- - uses : actions/checkout@master
13
+ - uses : actions/checkout@v4
14
+ with :
15
+ # We need the full history below.
16
+ fetch-depth : 0
10
17
11
18
- name : Update rustup
12
19
run : rustup self update
23
30
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.15/mdbook-v0.4.15-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
24
31
echo "$(pwd)/bin" >> ${GITHUB_PATH}
25
32
33
+ - name : Install mdbook-i18n-helpers
34
+ run : |
35
+ cargo install --git https://github.com/google/mdbook-i18n-helpers mdbook-i18n-helpers
36
+
26
37
- name : Report versions
27
38
run : |
28
39
rustup --version
41
52
https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
42
53
sh linkcheck.sh --all rust-by-example
43
54
55
+ - name : Build all translations
56
+ run : |
57
+ for po_lang in ${{ env.LANGUAGES }}; do
58
+ POT_CREATION_DATE=$(grep --max-count 1 '^"POT-Creation-Date:' po/$po_lang.po | sed -E 's/".*: (.*)\\n"/\1/')
59
+ if [[ $POT_CREATION_DATE == "" ]]; then
60
+ POT_CREATION_DATE=now
61
+ fi
62
+
63
+ echo "::group::Building $po_lang translation as of $POT_CREATION_DATE"
64
+ rm -r src/
65
+ git restore --source "$(git rev-list -n 1 --before "$POT_CREATION_DATE" @)" src/
66
+
67
+ # Set language and adjust site URL. Clear the redirects
68
+ # since they are in sync with the source files, not the
69
+ # translation.
70
+ MDBOOK_BOOK__LANGUAGE=$po_lang \
71
+ MDBOOK_OUTPUT__HTML__SITE_URL=/rust-by-example/$po_lang/ \
72
+ MDBOOK_OUTPUT__HTML__REDIRECT='{}' \
73
+ mdbook build -d book/$po_lang
74
+ echo "::endgroup::"
75
+ done
76
+
44
77
- name : Upload Artifact
45
78
uses : actions/upload-artifact@v3
46
79
with :
Original file line number Diff line number Diff line change 1
1
book
2
2
3
+ po /messages.pot
4
+
3
5
# Auto-generated files from macOS
4
- .DS_Store
6
+ .DS_Store
Original file line number Diff line number Diff line change @@ -13,6 +13,15 @@ enable = true
13
13
14
14
[output .html ]
15
15
git-repository-url = " https://github.com/rust-lang/rust-by-example"
16
+ additional-css = [
17
+ " theme/css/language-picker.css" ,
18
+ ]
16
19
17
20
[rust ]
18
21
edition = " 2021"
22
+
23
+ [build ]
24
+ extra-watch-dirs = [" po" ]
25
+
26
+ [preprocessor .gettext ]
27
+ after = [" links" ]
Original file line number Diff line number Diff line change
1
+ # language-list {
2
+ left : auto;
3
+ right : 10px ;
4
+ }
5
+
6
+ [dir = "rtl" ] # language-list {
7
+ left : 10px ;
8
+ right : auto;
9
+ }
10
+
11
+ # language-list a {
12
+ color : inherit;
13
+ }
You can’t perform that action at this time.
0 commit comments