Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 13656e3

Browse files
v1.18: [docs] translation support (backport of #35166) (#35169)
[docs] translation support (#35166) * chore: update crowdin and add serve command * feat: upload all desired files to crowdin * fix: absolute urls for pdfs * fix: do not import components with relative paths * feat: updated readme * fix: whitespace (cherry picked from commit 8f7fda8) Co-authored-by: Nick Frostbutter <[email protected]>
1 parent 0fc3969 commit 13656e3

File tree

6 files changed

+79
-50
lines changed

6 files changed

+79
-50
lines changed

docs/README.md

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,58 @@ npm run start
6363
6464
## Translations
6565

66-
Translations are sourced from [Crowdin](https://docusaurus.io/docs/i18n/crowdin) and generated when `master` is built.
67-
For local development use the following two commands in this `docs` directory.
66+
Translations are sourced from [Crowdin](https://docusaurus.io/docs/i18n/crowdin)
67+
and generated when the branch noted as the `STABLE` channel is built via the
68+
`build.sh` script.
69+
70+
For local development, and with the `CROWDIN_PERSONAL_TOKEN` env variable set,
71+
use the following two commands in this `docs` directory.
6872

6973
To download the newest documentation translations run:
7074

7175
```sh
7276
npm run crowdin:download
7377
```
7478

75-
To upload changes from `src` & generate [explicit IDs](https://docusaurus.io/docs/markdown-features/headings#explicit-ids):
79+
To upload changes from `src` & generate
80+
[explicit IDs](https://docusaurus.io/docs/markdown-features/headings#explicit-ids):
7681

7782
```shell
7883
npm run crowdin:upload
7984
```
8085

86+
> Translations are only included when deploying the `STABLE` channel of the docs
87+
> (via `build.sh`). Resulting in only the `docs.solanalabs.com` documentation
88+
> site to include translated content. Therefore, the `edge` and `beta` docs
89+
> sites are not expected to include translated content, even though the language
90+
> selector will still be present.
91+
92+
### Common issues
93+
94+
#### `CROWDIN_PERSONAL_TOKEN` env variable
95+
96+
The `crowdin.yml` file requires a `CROWDIN_PERSONAL_TOKEN` env variable to be
97+
set with a valid Crowdin access token.
98+
99+
For local development, you can store this in a `.env` file that the Crowdin CLI
100+
will auto detect.
101+
102+
For building and publishing via the GitHub actions, the `CROWDIN_PERSONAL_TOKEN`
103+
secret must be set.
104+
105+
#### Translation locale fails to build with `SyntaxError`
106+
107+
Some translation locales may fail to build with a `SyntaxError` thrown by
108+
Docusaurus due to how certain language symbols get parsed by Docusaurus while
109+
generating the static version of the docs.
110+
111+
> Note: When any locale fails to build, the entire docs build will fail
112+
> resulting in the docs not being able to be deployed at all.
113+
114+
There are several known locales that fail to build the current documentation.
115+
They are listed in the commented out `localesNotBuilding` attribute in the
116+
[`docusaurus.config.js`](https://github.com/solana-labs/solana/blob/master/docs/docusaurus.config.js)
117+
81118
## CI Build Flow
82119

83120
The docs are built and published in Travis CI with the `./build.sh` script. On each PR, the docs are built, but not published.

docs/crowdin.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@ base_url: 'https://solana.crowdin.com'
44
preserve_hierarchy: true
55
files: [
66
# JSON translation files
7-
# {
8-
# source: '/i18n/en/**/*',
9-
# translation: '/i18n/%two_letters_code%/**/%original_file_name%',
10-
#},
7+
{
8+
source: '/i18n/en/**/*',
9+
translation: '/i18n/%two_letters_code%/**/%original_file_name%',
10+
},
1111
# Docs Markdown files
1212
{
1313
source: '/src/**/*.md',
1414
translation: '/i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%',
1515
},
16+
{
17+
source: '/src/**/*.mdx',
18+
translation: '/i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%',
19+
},
20+
# Custom sidebar category files
21+
{
22+
source: '/src/**/*.json',
23+
translation: '/i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%',
24+
},
1625
]

docs/package-lock.json

Lines changed: 17 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"scripts": {
66
"start": "docusaurus start",
77
"build": "docusaurus build",
8+
"serve": "docusaurus serve",
89
"clear": "docusaurus clear",
910
"help": "docusaurus --help",
1011
"swizzle": "docusaurus swizzle",
@@ -20,7 +21,7 @@
2021
"crowdin:upload": "npm run write-i18n && crowdin upload"
2122
},
2223
"dependencies": {
23-
"@crowdin/cli": "^3.6.1",
24+
"@crowdin/cli": "^3.17.0",
2425
"@docusaurus/core": "^2.2.0",
2526
"@docusaurus/plugin-google-gtag": "^2.4.0",
2627
"@docusaurus/preset-classic": "^2.2.0",

docs/src/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ Explore what it takes to operate a Solana validator and help secure the network.
5555

5656
## Learn more
5757

58-
import HomeCtaLinks from "../components/HomeCtaLinks";
58+
import HomeCtaLinks from "@site/components/HomeCtaLinks";
5959

6060
<HomeCtaLinks />

docs/src/runtime/zk-token-proof.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ cannot change the original value that is contained in a commitment.
4141
Interested readers can refer to the following resources for a more in-depth
4242
treatment of Pedersen commitment and the (twisted) ElGamal encryption schemes.
4343

44-
- [Notes](./zk-docs/twisted_elgamal.pdf) on the twisted ElGamal encryption
44+
- [Notes](https://github.com/solana-labs/solana/blob/master/docs/src/runtime/zk-docs/twisted_elgamal.pdf)
45+
on the twisted ElGamal encryption
4546
- A technical
4647
[overview](https://github.com/solana-labs/solana-program-library/blob/master/token/zk-token-protocol-paper/part1.pdf)
4748
of the SPL Token 2022 confidential extension
@@ -98,14 +99,14 @@ The ZK Token proof program supports the following list of zero-knowledge proofs.
9899
- The ElGamal public-key validity proof instruction certifies that an ElGamal
99100
public-key is a properly formed public key.
100101
- Mathematical description and proof of security:
101-
[[Notes]](./zk-docs/pubkey_proof.pdf)
102+
[[Notes]](https://github.com/solana-labs/solana/blob/master/docs/src/runtime/zk-docs/pubkey_proof.pdf)
102103

103104
- `VerifyZeroBalance`:
104105

105106
- The zero-balance proof certifies that an ElGamal ciphertext encrypts the
106107
number zero.
107108
- Mathematical description and proof of security:
108-
[[Notes]](./zk-docs/zero_proof.pdf)
109+
[[Notes]](https://github.com/solana-labs/solana/blob/master/docs/src/runtime/zk-docs/zero_proof.pdf)
109110

110111
#### Equality proofs
111112

@@ -114,11 +115,11 @@ The ZK Token proof program supports the following list of zero-knowledge proofs.
114115
- The ciphertext-commitment equality proof certifies that an ElGamal
115116
ciphertext and a Pedersen commitment encode the same message.
116117
- Mathematical description and proof of security:
117-
[[Notes]](./zk-docs/ciphertext_commitment_equality.pdf)
118+
[[Notes]](https://github.com/solana-labs/solana/blob/master/docs/src/runtime/zk-docs/ciphertext_commitment_equality.pdf)
118119

119120
- `VerifyCiphertextCiphertextEquality`:
120121

121122
- The ciphertext-ciphertext equality proof certifies that two ElGamal
122123
ciphertexts encrypt the same message.
123124
- Mathematical description and proof of security:
124-
[[Notes]](./zk-docs/ciphertext_ciphertext_equality.pdf)
125+
[[Notes]](https://github.com/solana-labs/solana/blob/master/docs/src/runtime/zk-docs/ciphertext_ciphertext_equality.pdf)

0 commit comments

Comments
 (0)