Skip to content

Commit 68637f8

Browse files
committed
2 parents a59a77b + 61ce630 commit 68637f8

File tree

13 files changed

+2366
-320
lines changed

13 files changed

+2366
-320
lines changed

.github/workflows/CI.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CI
2+
on: pull_request
3+
4+
jobs:
5+
local-validate:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- uses: actions/checkout@v1
10+
- uses: actions/setup-node@v1
11+
- run: yarn
12+
- run: yarn docs-sync validate-against-en
13+
14+
site-builds:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/setup-node@v1
19+
with:
20+
node-version: "13.x"
21+
22+
# Clone this PR, and setup the deps
23+
- uses: actions/checkout@v1
24+
- run: yarn
25+
26+
# Clone the TS website, basically:
27+
# git clone https://github.com/microsoft/TypeScript-Website website
28+
- name: Checkout tools repo
29+
uses: actions/checkout@v2
30+
with:
31+
repository: microsoft/TypeScript-Website
32+
path: website
33+
34+
# Both the microsoft/TypeScript-Website & 1 - don't really need to be there, but
35+
# this migrates the translated docs into the website
36+
- run: yarn docs-sync pull microsoft/TypeScript-Website 1 --from-cwd . --to-cwd website
37+
38+
# Get dependencies for building the ebooks
39+
- run: sudo apt-get update
40+
- run: sudo apt install calibre
41+
42+
- run: yarn install
43+
env:
44+
YARN_CHECKSUM_BEHAVIOR: ignore
45+
working-directory: ./website
46+
47+
48+
# Verify the website build
49+
- run: yarn bootstrap
50+
working-directory: ./website
51+
52+
- run: yarn workspace typescriptlang-org build
53+
working-directory: ./website
54+
55+
# Verify the website build
56+
- run: yarn test
57+
working-directory: ./website
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Codeowners merging
2+
on:
3+
pull_request_target: { types: opened }
4+
issue_comment: { types: created }
5+
pull_request_review: { types: submitted }
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: Run Codeowners merge check
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
uses: OSS-Docs-Tools/code-owner-self-merge@master
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
on:
2+
pull_request_target:
3+
types: [assigned, opened, synchronize, reopened]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v1
11+
- uses: actions/setup-node@v1
12+
- run: yarn install
13+
14+
- run: yarn danger ci
15+
env:
16+
DEBUG: "*"
17+
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
AZURE_TRANSLATE_KEY: ${{ secrets.AZURE_TRANSLATE_KEY }}

.github/workflows/weekly.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Weekly issue updates
2+
3+
on:
4+
schedule:
5+
# https://crontab.guru/#0_12_*_*_1
6+
- cron: "0 12 * * 1"
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
- uses: actions/setup-node@v1
16+
- run: yarn install
17+
env:
18+
YARN_CHECKSUM_BEHAVIOR: ignore
19+
20+
# Update all the translation issues on a nightly basis
21+
- run: yarn docs-sync update-github-issues microsoft/TypeScript-Website-Localizations
22+
env:
23+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A repo for handling localized versions of the TypeScript website content
44

5-
### How this works
5+
### Setting up
66

77
```sh
88
git clone https://github.com/microsoft/TypeScript-Website-Localizations
@@ -11,14 +11,56 @@ cd TypeScript-Website-Localizations
1111
# Setup
1212
yarn
1313

14-
# Optional: Grab the English files
14+
# Optional: Grab the English files to make translation easier
1515
yarn pull-en
16+
17+
# Optional: Verify your changes will correctly replace the english files
18+
yarn validate-paths
1619
```
1720

1821
That's it, you've got a copy of all the documentation and now can write documentation which follows the existing patterns.
1922

20-
More docs to come.
23+
### How translations work
24+
25+
The TypeScript website handles translations by having language specific files with matching filepaths:
26+
27+
E.g: [`/packages/documentation/copy/en/reference/JSX.md`](https://github.com/microsoft/TypeScript-website/blob/68a4f67ed5f396228eeb6d0309b51bcfb19d31a1/packages/documentation/copy/en/reference/JSX.md#L1)
28+
29+
Has existing translations in different languages:
30+
31+
```sh
32+
/packages/documentation/copy/id/reference/JSX.md
33+
/packages/documentation/copy/ja/reference/JSX.md
34+
/packages/documentation/copy/pt/reference/JSX.md
35+
```
36+
37+
Same path, just switched `en` for `id`, `ja` & `pt`.
38+
39+
#### This repo
40+
41+
This repo contains all of the non-English locale files. It means you can clone and translate without all the infrastructure overhead of the pretty complex TypeScript-Website.
42+
43+
For example if you wanted to translate a new handbook page you would:
44+
45+
- Clone this repo (see above)
46+
- Pull in the English files `yarn pull-en` (these will be gitignored)
47+
- Find your english file: `docs/documentation/en/handbook-v2/Basics.md`
48+
- Recreate the same folder path in your language: `docs/documentation/it/handbook-v2/Basics.md`
49+
- Translate the file!
50+
- Create a pull request to this repo
51+
- Once merged, the translation will appear on the next website deploy
52+
53+
#### Language owners
54+
55+
When a new language is created, we ask for a few people to become language owners. These owners are able to merge pull requests to files in their language via [code-owner-self-merge](https://github.com/OSS-Docs-Tools/code-owner-self-merge) in a pull request. They will be pinged on PRs which affect them, you can see the flow in PRs like [this](https://github.com/microsoft/TypeScript-Website/pull/1478) or [this](https://github.com/microsoft/TypeScript-Website/pull/1458).
56+
57+
The TypeScript team generally only know English, and can answer clarifying questions if needed! For quick questions, you can use the `ts-website-translation` channel in the [TypeScript Discord](https://discord.gg/typescript).
58+
59+
#### Well tested
60+
61+
This repo has extensive CI to ensure that you can't accidentally break the TypeScript website.
2162

63+
There are local, fast checks that it won't break via `yarn test` and then the full TypeScript website test suite runs with the changes, and a website build is generated to ensure that nothing breaks.
2264

2365
# Contributing
2466

dangerfile.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const markdownTranslate = require('@orta/markdown-translator')
2+
import {danger, message} from "danger"
3+
4+
const go = async () => {
5+
const allMDFiles = [...danger.git.modified_files, ...danger.git.created_files].filter(f => f.endsWith(".md")).filter(f => f.split("/").length > 2)
6+
console.log(allMDFiles)
7+
for (const file of allMDFiles) {
8+
const fileContents = await danger.github.utils.fileContents(file)
9+
const translation = await markdownTranslate({
10+
text: fileContents,
11+
from: file.split("/")[2],
12+
to: "en",
13+
subscriptionKey: process.env.AZURE_TRANSLATE_KEY,
14+
region: "eastus"
15+
})
16+
17+
message(`## Translation of ${danger.github.utils.fileLinks([file])}\n\n${translation}`)
18+
};
19+
}
20+
21+
go()

docs/documentation/ko/tutorials/Babel with TypeScript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Babel 사용의 단점은 TS를 JS로 전환하는 동안 타입 검사를 할
4040
"emitDeclarationOnly": true,
4141
// Babel이 TypeScript 프로젝트의 파일을 안전하게 트랜스파일할 수 있는지 확인합니다.
4242
"isolatedModules": true
43-
}
43+
}
4444
```
4545

4646
해당 플래그에 대한 자세한 내용은 다음을 참고해주세요:

docs/documentation/ko/tutorials/React.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ TypeScript는 [JSX](/docs/handbook/jsx.html)를 지원하며 `useState`와 같
2424

2525
- [React TypeScript Cheatsheets](https://react-typescript-cheatsheet.netlify.app)
2626
- [React & Redux in TypeScript](https://github.com/piotrwitek/react-redux-typescript-guide#react--redux-in-typescript---complete-guide)
27+
28+

docs/documentation/ko/tutorials/TypeScript Tooling in 5 minutes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ TypeScript의 클래스는 JavaScript에서 자주 사용되는 동일한 프로
172172
</html>
173173
```
174174

175+
175176
브라우저에서 `greeter.html`을 열어 첫 번째 간단한 TypeScript 웹 애플리케이션을 실행하세요!
176177

177178
추가로: Visual Studio에서 `greeter.ts`를 열거나, TypeScript playground에 코드를 복사해보세요.

0 commit comments

Comments
 (0)