Skip to content

Commit

Permalink
Translate all pages into English. (#32)
Browse files Browse the repository at this point in the history
The Chinese version is temporarily removed and will be added back as
translation, so we can use English as our main version. This will help
more people on getting started on SONiC.
  • Loading branch information
r12f authored Jan 5, 2025
1 parent 1abcc84 commit f1f82a4
Show file tree
Hide file tree
Showing 55 changed files with 14,201 additions and 20,425 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode/
book
po/*~
bin.tar.gz
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Build Pipeline](https://img.shields.io/github/actions/workflow/status/r12f/sonic-book/mdbook.yml)

Version: [Chinese](https://r12f.com/sonic-book) | [English (Machine Translated, WIP)](https://r12f.com/sonic-book/en/)
Version: [English](https://r12f.com/sonic-book/en/) | [Chinese, WIP](https://r12f.com/sonic-book/cn/)

> What is SONiC?
>
Expand All @@ -14,16 +14,16 @@ You might be interested in SONiC because it is powerful enough to suite your nee

If you are in this situation, then this book is for you.

"Getting Started with SONiC" / "SONiC入门指南" is a book that intended to help people actually getting started on [SONiC](https://sonicfoundation.dev/). It contains a series of tutorials that will guide you through the process of building a SONiC image, deploying it on a switch or virtually, and using it to do some basic network operations to get hands on, as well as introducing the high level architecture, code base, and typical workflows to help you understand how it works internally and get started on development.
"Getting Started with SONiC" is a book that intended to help people actually getting started on [SONiC](https://sonicfoundation.dev/). It contains a series of tutorials that will guide you through the process of building a SONiC image, deploying it on a switch or virtually, and using it to do some basic network operations to get hands on, as well as introducing the high level architecture, code base, and typical workflows to help you understand how it works internally and get started on development.

The book is currently in [Chinese(中文)](https://r12f.com/sonic-book) and English version is still working in progress. If you like this books, please give it a star, or join the effort of authoring, bug fixing or translations by submitting PRs.
If you like this book, please help give it a star, or join the effort of authoring, bug fixing or translations by submitting PRs.

## How to build

### Prerequisites

1. Install `just` by following the [installation guide](https://github.com/casey/just#installation). We use `just` instead of `make`, because it is easier to manage and use.
2. Install powershell by following the [installation guide](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux?view=powershell-7.3). This is because we use powershell as our make file script engine, so we can run our book on any platform.
2. Install powershell by following the [installation guide](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux?view=powershell-7.3). This is because we use powershell as our make file script engine, so we can run our book on any platform.
3. Run `just init` for installing mdbook and related pluins. This is one time initialization.

### Build
Expand All @@ -44,4 +44,4 @@ Huge thanks to the following friends for their help and contribution, without yo

## License

This book is licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
This book is licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
4 changes: 2 additions & 2 deletions book.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[book]
authors = ["r12f"]
language = "cn"
language = "en"
multilingual = false
src = "src"
title = "SONiC入门指南"
title = "Getting Started with SONiC"

[build]
extra-watch-dirs = ["po"]
Expand Down
12 changes: 6 additions & 6 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ install-gh-bin GITHUB_PATH BIN_NAME:
build:
@just _log-head "Building book ..."
mdbook build
just po-build en
just po-build cn

serve:
@just _log-head "Starting mdbook server ..."
Expand All @@ -51,19 +51,19 @@ po-extract:
@just _log-head "Extracting messages.pot file from source ..."
$env:MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot"}}'; mdbook build -d po; $env:MDBOOK_OUTPUT=$null

po-update PO='en':
po-update PO='cn':
@just _log-head "Updating po files for language {{PO}} ..."
msgmerge --update po/{{PO}}.po po/messages.pot

po-build PO='en':
po-build PO='cn':
@just _log-head "Building book for language {{PO}} ..."
$env:MDBOOK_BOOK__LANGUAGE="{{PO}}"; mdbook build -d book/{{PO}}; $env:MDBOOK_BOOK__LANGUAGE=$null

po-serve PO='en':
po-serve PO='cn':
@just _log-head "Starting mdbook server with translated {{PO}} book ..."
$env:MDBOOK_BOOK__LANGUAGE="{{PO}}"; mdbook serve -d book/{{PO}} -n 0.0.0.0; $env:MDBOOK_BOOK__LANGUAGE=$null

po-tr PO='en':
po-tr PO='cn':
@just _log-head "Starting translating {{PO}} book ..."
potr -p ./po/{{PO}}.po -e deepl -t {{PO}}

Expand All @@ -80,4 +80,4 @@ _log-error LOG_LINE:
@just _log-inner "{{COLOR_RED}}" "ERROR" "{{LOG_LINE}}"

_log-inner COLOR LOG_LEVEL LOG_LINE:
@if ("{{LOG_LINE}}" -eq "") { echo ""; } else { Write-Host -ForegroundColor "{{COLOR}}" "[$(Get-Date -UFormat '%Y-%m-%d %H:%M:%S')][{{LOG_LEVEL}}] {{LOG_LINE}}"; }
@if ("{{LOG_LINE}}" -eq "") { echo ""; } else { Write-Host -ForegroundColor "{{COLOR}}" "[$(Get-Date -UFormat '%Y-%m-%d %H:%M:%S')][{{LOG_LEVEL}}] {{LOG_LINE}}"; }
Loading

0 comments on commit f1f82a4

Please sign in to comment.