File tree Expand file tree Collapse file tree 5 files changed +445
-2
lines changed Expand file tree Collapse file tree 5 files changed +445
-2
lines changed Original file line number Diff line number Diff line change 11name : CI 
22on : [push, pull_request] 
33
4+ env :
5+   #  Update the language picker in index.hbs to link new languages.
6+   LANGUAGES :
7+ 
48jobs :
59  test :
610    name : Run tests 
711    runs-on : ubuntu-latest 
812    steps :
9-     - uses : actions/checkout@master 
13+     - uses : actions/checkout@v4 
14+       with :
15+         #  We need the full history below.
16+         fetch-depth : 0 
1017
1118    - name : Update rustup 
1219      run : rustup self update 
2330        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 
2431        echo "$(pwd)/bin" >> ${GITHUB_PATH} 
2532
33+ name : Install mdbook-i18n-helpers 
34+       run : | 
35+         cargo install --git https://github.com/google/mdbook-i18n-helpers mdbook-i18n-helpers 
36+ 
2637name : Report versions 
2738      run : | 
2839        rustup --version 
4152          https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh 
4253        sh linkcheck.sh --all rust-by-example 
4354
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+ 
4477name : Upload Artifact 
4578      uses : actions/upload-artifact@v3 
4679      with :
Original file line number Diff line number Diff line change 11book 
22
3+ po /messages.pot 
4+ 
35#  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
1313
1414[output .html ]
1515git-repository-url  = " https://github.com/rust-lang/rust-by-example" 
16+ additional-css  = [
17+   " theme/css/language-picker.css" 
18+ ]
1619
1720[rust ]
1821edition  = " 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