Skip to content

Commit

Permalink
Merge pull request #1 from lispking/main
Browse files Browse the repository at this point in the history
feat: 翻译中文,用i18n-helpers优雅的翻译完第一版
  • Loading branch information
uvd authored Oct 30, 2024
2 parents 4f8e8f0 + 5c35994 commit 93fbe16
Show file tree
Hide file tree
Showing 13 changed files with 18,328 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ walrus
examples/CONFIG/bin/walrus
./client_config.yaml
examples/CONFIG/config_dir/client_config.yaml

book/
po/*.po~
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ You can also build and access the documentation locally (assuming you have Rust
cargo install mdbook
cargo install [email protected] --locked
cargo install [email protected] --locked
cargo install mdbook-i18n-helpers --locked
mdbook serve
```

### Using translated version

If there is a translated resource in `po/` directory, it can be specified through `MDBOOK_BOOK__LANGUAGE` like below:

```bash
MDBOOK_BOOK__LANGUAGE=zh_CN mdbook build
MDBOOK_BOOK__LANGUAGE=zh_CN mdbook serve
```

## Get help and report issues

If you have general questions or require help on how to use Walrus, please check for [existing
Expand Down
49 changes: 49 additions & 0 deletions TRANSLATING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Translation Guidelines

## Translation workflow

### Preparation

RBE uses [mdbook-i18n-helpers](https://github.com/google/mdbook-i18n-helpers) as a translation framework.
The following tools are required.

* GNU gettext utilities ( `msgmerge` and `msgcat` )
* mdbook-i18n-helpers ( `cargo install mdbook-i18n-helpers` )

### Creating and Updating Translations

Please see the [mdbook-i18n-helpers USAGE](https://github.com/google/mdbook-i18n-helpers/blob/main/i18n-helpers/USAGE.md) file for the detailed usage of mdbook-i18n-helpers.
The summarized command list is below:

#### Generating a message template

The generated message templete `po/messages.pot` is required to create or update translations.

```bash
MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot"}}' \
mdbook build -d po
```

#### Creating a new translation resource

`xx` is [ISO 639](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code.

```bash
msginit -i po/messages.pot -l xx -o po/xx.po
```

#### Updating the existing translation resource

```bash
msgmerge --update po/xx.po po/messages.pot
```

### Editing translation resources

After generating a translation resource `po/xx.po`, you can write translation messages in `msgstr` entry of `po/xx.po`.
To build a translated book, the following command can be used.

```bash
MDBOOK_BOOK__LANGUAGE=xx mdbook build
MDBOOK_BOOK__LANGUAGE=xx mdbook serve
```
7 changes: 5 additions & 2 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ src = "docs"
title = "Walrus"

[build]
build-dir = "build"
# build-dir = "build"
extra-watch-dirs = ["po"]

[output.html]
theme = "theme"
Expand All @@ -17,7 +18,6 @@ optional = true
follow-web-links = true
warning-policy = "error"
exclude = [
'MystenLabs/walrus-docs',
'walrus\.site', # No service worker in the link checker.
'google\.com',
'x\.com',
Expand All @@ -35,3 +35,6 @@ assets_version = "3.0.2" # do not edit: managed by `mdbook-admonish install`
# Using `\(` and `\)` for inline math and `\[` and `\]` for math blocks.
block-delimiter = { left = "\\[", right = "\\]" }
inline-delimiter = { left = "\\(", right = "\\)" }

[preprocessor.gettext]
after = ["links"]
8 changes: 8 additions & 0 deletions contracts/wal/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ dependencies = [
compiler-version = "1.35.0"
edition = "2024.beta"
flavor = "sui"

[env]

[env.testnet]
chain-id = "4c78adac"
original-published-id = "0x9f992cc2430a1f442ca7a5ca7638169f5d5c00e0ebc3977a65e9ac6e497fe5ef"
latest-published-id = "0x9f992cc2430a1f442ca7a5ca7638169f5d5c00e0ebc3977a65e9ac6e497fe5ef"
published-version = "1"
22 changes: 10 additions & 12 deletions contracts/walrus/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

[move]
version = 3
manifest_digest = "A8705FC4DA1640884D71727CDCE9E5C95451481B9AEAEFF0DF4EBC83042B042A"
deps_digest = "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3"
manifest_digest = "7AEFA3AEAE5A828C7DC259D678D9B79B76EF3C980A2DA1DAA9CB1B13287C9FFF"
deps_digest = "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600"
dependencies = [
{ id = "Sui", name = "Sui" },
{ id = "WAL", name = "WAL" },
{ id = "WAL_exchange", name = "WAL_exchange" },
]

[[move.package]]
Expand All @@ -30,16 +29,15 @@ dependencies = [
{ id = "Sui", name = "Sui" },
]

[[move.package]]
id = "WAL_exchange"
source = { local = "../wal_exchange" }

dependencies = [
{ id = "Sui", name = "Sui" },
{ id = "WAL", name = "WAL" },
]

[move.toolchain-version]
compiler-version = "1.35.0"
edition = "2024.beta"
flavor = "sui"

[env]

[env.testnet]
chain-id = "4c78adac"
original-published-id = "0x9f992cc2430a1f442ca7a5ca7638169f5d5c00e0ebc3977a65e9ac6e497fe5ef"
latest-published-id = "0x9f992cc2430a1f442ca7a5ca7638169f5d5c00e0ebc3977a65e9ac6e497fe5ef"
published-version = "1"
2 changes: 1 addition & 1 deletion docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Summary

[Walrus](./README.md)
[Walrus](./index.md)

---

Expand Down
2 changes: 1 addition & 1 deletion docs/blog/03_whitepaper.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ To be part of this journey:

- Follow us on [Twitter](https://x.com/WalrusProtocol)
- Join our [Discord](https://discord.com/invite/walrusprotocol)
- [Build apps](../README.md) on Walrus
- [Build apps](../index.md) on Walrus
- [Publish a Walrus Site](../walrus-sites/intro.md) and share it
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/walrus-sites/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ site](./tutorial-migration.md) today to take advantage of these new features!

```admonish danger title="Walrus Sites Devnet being discontinued"
Since the Walrus Devnet will [be shut down
soon](../README.md#admonition-discontinuation-of-walrus-devnet), all the Walrus Sites stored on it will
soon](../index.md#admonition-discontinuation-of-walrus-devnet), all the Walrus Sites stored on it will
be wiped. To minimize the downtime, the Devnet Walrus Sites will be available after the Testnet
upgrade for two weeks (until **2024-10-31**), to ensure that everyone has enough time to update.
Expand Down
8 changes: 8 additions & 0 deletions examples/move/walrus_dep/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Example Move package depending on Walrus

A simple example of depending on the Walrus Testnet Move package.

You can build, test, and publish this with the following commands (from this directory):

```sh
sui move build
sui move test
sui client publish --skip-dependency-verification
```
Loading

0 comments on commit 93fbe16

Please sign in to comment.