Skip to content

Commit 569dc18

Browse files
authored
Merge pull request #666 from TownSquareXYZ/l10n_localization
feat: New mandarin localization workflow
2 parents 7625a8b + 16f08b6 commit 569dc18

File tree

357 files changed

+10445
-5354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

357 files changed

+10445
-5354
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ npm-debug.log*
2424
yarn-debug.log*
2525
yarn-error.log*
2626
.gitpod.yml
27+
28+
.env

crowdin.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
project_id: '663652'
2+
api_token_env: CROWDIN_PERSONAL_TOKEN
3+
preserve_hierarchy: 1
4+
files:
5+
- source: /i18n/en/**/*
6+
translation: /i18n/%two_letters_code%/**/%original_file_name%
7+
- source: /docs/**/*
8+
translation: /i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%
9+
ignore:
10+
- /docs/**/*.png
11+
- source: /src/pages/learn/**/*
12+
translation: /i18n/%two_letters_code%/docusaurus-plugin-content-pages/learn/**/%original_file_name%

docs/contribute/archive/hacktoberfest-2022/README.mdx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import Button from '@site/src/components/button'
22

33
# What is Hacktoberfest?
4-
4+
````mdx-code-block
55
<div style={{ textAlign: 'center', margin: '50px 0' }}>
66
<img alt="tlb structure"
77
src="/docs/img/docs/hacktoberfest.webp"
88
width="100%" />
99
</div>
10-
10+
````
1111
[Hacktoberfest](https://hacktoberfest.digitalocean.com/) is a month-long celebration of *open-source projects*, their *maintainers*, and the entire community of *contributors*. Each October, open source maintainers give new contributors extra attention as they guide developers through their first pull requests.
1212

1313
For the TON Community it's time to help ecosystem growth together, so let's join the whole world with our **Hack-TON-berfest** party and become *#1 open-source ecosystem of the year*!
@@ -30,14 +30,16 @@ For everyone in TON it's an opportunity to drive the growth of the entire ecosys
3030
## What are the rewards?
3131

3232
To motivate the community to contribute to open source projects in the TON Ecosystem, you'll be able to receive a special reward from TON Foundation. Every participant will receive a **Limited Hack-TON-berfest NFT** achievement as a proof of participating:
33-
33+
````mdx-code-block
3434
<div style={{width: '100%', textAlign:'center', margin: '0 auto'}}>
3535
<video width="300" style={{width: '100%', borderRadius:'10pt', margin:'15pt auto'}} muted={true} autoPlay={true} loop={true}>
3636
<source src="/docs/files/nft-sm.mp4" type="video/mp4" />
37-
Your browser does not support the video tag.
37+
````
38+
Your browser does not support the video tag.
39+
````mdx-code-block
3840
</video>
3941
</div>
40-
42+
````
4143
:::info IMPORTANT!
4244
TON Foundation will mint a collection in November to all wallet addresses submitted to the [@toncontests_bot](https://t.me/toncontests_bot). It will happen after the calculation and validation of all contribution results.
4345
:::
@@ -46,8 +48,18 @@ You have plenty of time to participate in the event. Let's build decentralized I
4648

4749

4850

49-
<Button href="/contribute/hacktoberfest/as-contributor"
51+
````mdx-code-block
52+
<Button href="/contribute/hacktoberfest/as-contributor"
5053
colorType="primary" sizeType={'lg'}>
51-
I want to become a Contributor
52-
</Button>
53-
<Button href="/contribute/hacktoberfest/as-maintainer" colorType={'secondary'} sizeType={'lg'}>I'm a Maintainer</Button>
54+
````
55+
I want to become a Contributor
56+
````mdx-code-block
57+
</Button>
58+
````
59+
````mdx-code-block
60+
<Button href="/contribute/hacktoberfest/as-maintainer" colorType={'secondary'} sizeType={'lg'}>
61+
````
62+
I'm a Maintainer
63+
````mdx-code-block
64+
</Button>
65+
````

docs/contribute/docs/schemes-guidelines.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ If the order of transactions doesn't matter, you can omit their labels. This sim
2929

3030

3131
#### Message Processing Example
32-
32+
````mdx-code-block
3333
<br></br>
3434
<ThemedImage
3535
alt=""
@@ -39,7 +39,7 @@ If the order of transactions doesn't matter, you can omit their labels. This sim
3939
}}
4040
/>
4141
<br></br>
42-
42+
````
4343

4444

4545
Learn references directly from Visio [message-processing.vsdx](/static/schemes-visio/message-processing.vsdx).
@@ -72,7 +72,7 @@ Learn references directly from Visio [message-processing.vsdx](/static/schemes-v
7272
In the case of complex and repetitive communication schemes between 2-3 actors, it is advisable to use a sequence diagram. For messages, use the notation of a common synchronous message arrow.
7373

7474
#### Example
75-
75+
````mdx-code-block
7676
<br></br>
7777
<div class="text--center">
7878
<ThemedImage
@@ -84,7 +84,7 @@ In the case of complex and repetitive communication schemes between 2-3 actors,
8484
/>
8585
</div>
8686
<br></br>
87-
87+
````
8888

8989
### Scheme References
9090

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# How It Works
2+
3+
![how it works](/img/localizationProgramGuideline/localization-program.png)
4+
5+
The **TownSquare Labs Localization Program** comprises several key components. This chapter will provide an overview of how the program operates, helping you understand its workings and how to use it effectively.
6+
7+
Within this system, we integrate several applications to function seamlessly as a unified program:
8+
9+
- **GitHub**: Hosts the documentation, synchronizes docs from the upstream repository, and syncs translations to specific branches.
10+
- **Crowdin**: Manages translation processes, including translating, proofreading, and setting language preferences.
11+
- **AI Systems**: Utilizes advanced AI to assist translators, ensuring smooth workflow.
12+
- **Customized Glossary**: Guides translators and ensures AI generates accurate translations based on the project’s context. Users can also upload their glossaries as needed.
13+
14+
:::info
15+
This guide won't cover the entire process in detail, but it will highlight the key components that make the TownSquare Labs Localization Program unique. You can explore the program further on your own.
16+
:::
17+
18+
## GitHub Synchronization for Documentation and Translations
19+
20+
Our repository utilizes several branches for managing documentation and translations. Below is a detailed explanation of the purpose and function of each special branch:
21+
22+
### Branches Overview
23+
24+
#### 1. `dev`
25+
The `dev` branch runs GitHub Actions to handle synchronization tasks. You can find the workflow configurations in the [**`.github/workflows`**](https://github.com/TownSquareXYZ/ton-docs/tree/dev/.github/workflows) directory:
26+
27+
- **`sync-fork.yml`**: This workflow synchronizes documentation from the upstream repository. It runs daily at 00:00.
28+
- **`sync-translations.yml`**: This workflow synchronizes updated translations to the respective language branches for preview purposes on the corresponding language websites.
29+
30+
#### 2. `localization`
31+
This branch stays in sync with the upstream repository through GitHub Actions running on the `dev` branch. It is also used for updating certain codes that we intend to propose to the original repository.
32+
33+
#### 3. `l10n_localization`
34+
This branch includes all changes from the `localization` branch and translations from Crowdin. All modifications in this branch are committed to the upstream repository.
35+
36+
#### 4. `[lang]_localization`
37+
These branches are designated for specific language previews, such as `ko_localization` for Korean and `ja_localization` for Japanese. They allow us to preview the website in different languages.
38+
39+
By maintaining these branches and using GitHub Actions, we efficiently manage the synchronization of our documentation and translation updates, ensuring that our multilingual content is always up to date.
40+
41+
## How to Set Up a New Crowdin Project
42+
43+
1. Log in to your [**Crowdin account**](https://accounts.crowdin.com/login).
44+
2. Click `Create new project` in the menu.
45+
![Create new project](/img/localizationProgramGuideline/howItWorked/create-new-project.png)
46+
3. Set your Project name and Target languages. You can change the languages in the settings later.
47+
![Create project setting](/img/localizationProgramGuideline/howItWorked/create-project-setting.png)
48+
4. Go to the project you just created, select the Integrations tab, click the `Add Integration` button, search for `GitHub`, and install it.
49+
![install-github-integration](/img/localizationProgramGuideline/howItWorked/install-github-integration.png)
50+
5. Before configuring GitHub integrations on Crowdin, specify which files to upload to Crowdin to avoid uploading unnecessary files:
51+
52+
1. Create a **crowdin.yml** file in the root of **your GitHub repo** with the basic configuration:
53+
54+
```yml
55+
project_id: <Your project id>
56+
preserve_hierarchy: 1
57+
files:
58+
- source: <Path of your original files>
59+
translation: <Path of your translated files>
60+
```
61+
62+
2. Get the correct configuration values:
63+
- **project_id**: In your Crowdin project, go to the Tools tab, select API, and find the **project_id** there.
64+
![select-api-tool](/img/localizationProgramGuideline/howItWorked/select-api-tool.png)
65+
![projectId](/img/localizationProgramGuideline/howItWorked/projectId.png)
66+
- **preserve_hierarchy**: Maintains the GitHub directory structure on the Crowdin server.
67+
- **source** and **translation**: Specify the paths for the files to upload to Crowdin and where the translated files should be output.
68+
69+
Refer to [**our official config file**](https://github.com/TownSquareXYZ/ton-docs/blob/localization/crowdin.yml) for an example.
70+
More details can be found in the [**Crowdin configuration documentation**](https://developer.crowdin.com/configuration-file/).
71+
72+
6. Configure Crowdin to connect to your GitHub repo:
73+
1. Click `Add Repository` and select `Source and translation files mode`.
74+
![select-integration-mode](/img/localizationProgramGuideline/howItWorked/select-integration-mode.png)
75+
2. Connect your GitHub account and search for the repo you want to translate.
76+
![search-repo](/img/localizationProgramGuideline/howItWorked/search-repo.png)
77+
3. Select the branch on the left, which will generate a new branch where Crowdin will post the translations.
78+
![setting-branch](/img/localizationProgramGuideline/howItWorked/setting-branch.png)
79+
4. Choose the frequency for updating translations to your GitHub branch. Default settings can be kept for other configurations, then click save to enable the integration.
80+
![frequency-save](/img/localizationProgramGuideline/howItWorked/frequency-save.png)
81+
82+
Refer to the [**GitHub integration documentation**](https://support.crowdin.com/github-integration/) for more details.
83+
84+
7. Finally, you can click the `Sync Now` button to sync the repo and translations whenever needed.
85+
86+
## Glossary
87+
88+
### What is a Glossary?
89+
90+
Sometimes, AI translators can't recognize specific terms that shouldn't be translated. For instance, we don't want "Rust" translated when referring to the programming language. To prevent such mistakes, we use a glossary to guide translations.
91+
92+
A **glossary** allows you to create, store, and manage project-specific terminology in one place, ensuring terms are translated correctly and consistently.
93+
94+
You can check our [**ton-i18n-glossary**](https://github.com/TownSquareXYZ/ton-i18n-glossary) for reference.
95+
![ton-i18n-glossary](/img/localizationProgramGuideline/howItWorked/ton-i18n-glossary.png)
96+
97+
### How to Set Up a Glossary for a New Language?
98+
99+
Most translation platforms support glossaries. In Crowdin, after setting up a glossary, each term appears as an underlined word in the Editor. Hover over the term to see its translation, part of speech, and definition (if provided).
100+
![github-glossary](/img/localizationProgramGuideline/howItWorked/github-glossary.png)
101+
![crowdin-glossary](/img/localizationProgramGuideline/howItWorked/crowdin-glossary.png)
102+
103+
In DeepL, simply upload your glossary, and it will be used automatically during AI translation.
104+
105+
We have created [**a program for glossary**](https://github.com/TownSquareXYZ/ton-i18n-glossary) that auto-uploads updates.
106+
107+
To add a term to the glossary:
108+
1. If the English term already exists in the glossary, find the corresponding line and column for the language you want to translate, input the translation, and upload it.
109+
2. To upload a new glossary, clone the project and run:
110+
111+
- `npm i`
112+
- `npm run generate -- <glossary name you want>`
113+
114+
Repeat step 1 to add the new term.
115+
116+
**Simple and efficient, isn’t it?**
117+
118+
## How to Take Advantage of AI Translation Copilot?
119+
120+
AI translation copilot helps break down language barriers with several advantages:
121+
122+
- **Enhanced Consistency**: AI translations are based on up-to-date information, providing the most accurate and current translations.
123+
- **Speed and Efficiency**: AI translation is instantaneous, handling large volumes of content in real-time.
124+
- **Robust Scalability**: AI systems continuously learn and improve, enhancing translation quality over time. With the provided glossary, AI translations can be tailored to the specific needs of different repositories.
125+
126+
To use AI translation in Crowdin (we use DeepL in our project):
127+
1. Select Machine Translation in the Crowdin menu and click edit on the DeepL line.
128+
![select-deepl](/img/localizationProgramGuideline/howItWorked/select-deepl.png)
129+
2. Enable DeepL support and input the DeepL Translator API key.
130+
> [How to get DeepL Translator API key](https://www.deepl.com/pro-api?cta=header-pro-api)
131+
132+
![config-crowdin-deepl](/img/localizationProgramGuideline/howItWorked/config-crowdin-deepl.png)
133+
134+
3. Our DeepL setup uses a customized glossary. Check [**ton-i18n-glossary**](https://github.com/TownSquareXYZ/ton-i18n-glossary) for details on uploading the glossary.
135+
136+
4. In the repo, click Pre-translation and select via Machine Translation.
137+
![pre-translation](/img/localizationProgramGuideline/howItWorked/pre-translation.png)
138+
5. Choose DeepL as the Translation Engine, select the target languages, and select the files to translate.
139+
![pre-translate-config](/img/localizationProgramGuideline/howItWorked/pre-translate-config.png)
140+
141+
That's it! Now you can take a break and wait for the pre-translation to complete.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# How to Contribute
2+
3+
In our quest to make **TON the most successful blockchain**, ensuring that TON documentation is comprehensible to people worldwide is crucial. Localization is key, and we're **excited** to have you join us in this effort.
4+
5+
## Prerequisites
6+
7+
The **TownSquare Labs Localization Program** is open to everyone! Here are a few steps you need to take before you start contributing:
8+
9+
1. Log in to your [**Crowdin**](https://crowdin.com) account or sign up.
10+
2. Select the language you want to contribute to.
11+
3. Familiarize yourself with the [**How to Use Crowdin**](/contribute/localization-program/how-to-contribute) guide and the [**Translation Style Guide**](/contribute/localization-program/translation-style-guide) for tips and best practices.
12+
4. Use machine translations to aid your work but do not rely solely on them.
13+
5. All translation results can be previewed on the website one hour after they have been proofread.
14+
15+
## Roles
16+
17+
Here are the **roles** you can assume in the system:
18+
19+
- **Language Coordinator** – Manages project features within assigned languages.
20+
- **Developer** – Uploads files, edits translatable text, connects integrations, and uses the API.
21+
- **Proofreader** – Translates and approves strings.
22+
- **Translator** (in-house or community) – Translates strings and votes on translations added by others.
23+
24+
Our localization project is hosted on [Crowdin](https://crowdin.com/project/ton-docs).
25+
26+
:::info
27+
Before you start contributing, **read the guidelines below** to ensure standardization and quality, making the review process much faster.
28+
29+
## Side-by-Side Mode
30+
31+
All tasks are performed in **side-by-side** mode in the Crowdin Editor. To enable this, click a file you want to work on. At the top right of the page, click the **Editor view** button and select **side-by-side** mode for a clearer editor view.
32+
![side-by-side mode](/img/localizationProgramGuideline/side-by-side.png)
33+
:::
34+
35+
### Language Coordinator
36+
- **Translate and approve strings**
37+
- **Pre-translate project content**
38+
- **Manage project members and join requests**
39+
![manage-members](/img/localizationProgramGuideline/manage-members.png)
40+
- **Generate project reports**
41+
![generate-reports](/img/localizationProgramGuideline/generate-reports.png)
42+
- **Create tasks**
43+
![create-tasks](/img/localizationProgramGuideline/create-tasks.png)
44+
45+
### Developer
46+
- **Upload files**
47+
- **Edit translatable text**
48+
- **Connect integrations** (e.g., add GitHub integration)
49+
![install-github-integration](/img/localizationProgramGuideline/howItWorked/install-github-integration.png)
50+
- **Use the [Crowdin API](https://developer.crowdin.com/api/v2/)**
51+
52+
### Proofreader
53+
54+
As a **Proofreader**, you'll work on files with a **blue progress bar**.
55+
![proofread step1](/img/localizationProgramGuideline/proofread-step1.png)
56+
Click on a file to enter the editing interface.
57+
58+
#### Let's Start Contributing
59+
60+
1. Make sure you're in [**side-by-side mode**](#side-by-side-mode). Filter by **Not Approved** translations to see strings needing proofreading.
61+
![proofread filter](/img/localizationProgramGuideline/proofread-filter.png)
62+
63+
2. Follow these rules:
64+
- Select strings with a **blue cube icon**. Check each translation:
65+
- If **correct**, click the ☑️ button.
66+
- If **incorrect**, move to the next line.
67+
68+
![proofread approved](/img/localizationProgramGuideline/proofread-approved.png)
69+
70+
:::info
71+
You can also review approved lines:
72+
1. Filter by **Approved**.
73+
2. If an approved line has issues, click the ☑️ button to revert it to needing proofreading.
74+
:::
75+
76+
3. To move to the next file, click the file name at the top, select the new file from the pop-up window, and continue proofreading.
77+
![to next](/img/localizationProgramGuideline/redirect-to-next.png)
78+
79+
#### Previewing Your Work
80+
Every approved content will be deployed to a preview website within one hour. Check [**our repo**](https://github.com/TownSquareXYZ/ton-docs/pulls) for the **preview** link in the newest PR.
81+
![preview link](/img/localizationProgramGuideline/preview-link.png)
82+
83+
### Translator
84+
85+
As a **Translator**, your goal is to ensure translations are faithful and expressive, making them as close to the original meaning and as understandable as possible. Your mission is to make the **blue progress bar** reach 100%.
86+
87+
#### Let's Start Translating
88+
89+
Follow these steps for a successful translation process:
90+
91+
1. Select files that haven't reached 100% translation.
92+
![translator select](/img/localizationProgramGuideline/translator-select.png)
93+
94+
2. Ensure you're in [**side-by-side mode**](#side-by-side-mode). Filter by **Untranslated** strings.
95+
![translator filter](/img/localizationProgramGuideline/translator-filter.png)
96+
97+
3. Your workspace has four parts:
98+
- **Top left:** Input your translation based on the source string.
99+
- **Bottom left:** Preview the translated file. Maintain the original format.
100+
- **Bottom right:** Suggested translations from Crowdin. Click to use, but verify for accuracy, especially with links.
101+
102+
4. Save your translation by clicking the **Save** button at the top.
103+
![translator save](/img/localizationProgramGuideline/translator-save.png)
104+
105+
5. To move to the next file, click the file name at the top and select the new file from the pop-up window.
106+
![to next](/img/localizationProgramGuideline/redirect-to-next.png)
107+
108+
## How to Add Support for a New Language
109+
110+
Currently, we have all desired languages in Crowdin. If you are a community manager, follow these steps:
111+
112+
1. Add a new branch named `[lang]_localization` (e.g., `ko_localization` for Korean) on [TownSquareXYZ/ton-docs](https://github.com/TownSquareXYZ/ton-docs).
113+
2. **Contact the Vercel owner of this repo** to add the new language to the menu.
114+
3. Create a PR request to the dev branch. **Do not merge to dev**; this is for preview purposes only.
115+
116+
Once these steps are completed, you can see the preview of your language in the PR request.
117+
![ko preview](/img/localizationProgramGuideline/ko_preview.png)
118+
119+
When your language is ready for the TON docs, create an issue, and we'll set your language into the production environment.

0 commit comments

Comments
 (0)