Skip to content

Commit 85c952a

Browse files
authored
feat: wiki/translate-glossary.md auto generation using lint-staged (#991)
husky 및 lint-staged를 이용한 wiki/translate-glossary.md 문서 생성 자동화 진행.
1 parent 1dafd6b commit 85c952a

File tree

4 files changed

+70
-6
lines changed

4 files changed

+70
-6
lines changed

Diff for: .gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,3 @@ public/fonts/**/Optimistic_*.woff2
3939

4040
# rss
4141
public/rss.xml
42-
43-
# textlint
44-
wiki/textlint/translate-glossary.md

Diff for: package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"check-all": "npm-run-all prettier lint:fix tsc rss",
2323
"rss": "node scripts/generateRss.js",
2424
"textlint-test": "yarn mocha ./textlint/tests/utils && yarn mocha ./textlint/tests/rules",
25-
"textlint-docs": "node ./textlint/generators/genTranslateGlossaryDocs.js",
25+
"textlint-docs": "node ./textlint/generators/genTranslateGlossaryDocs.js && git add wiki/translate-glossary.md",
2626
"textlint-lint": "yarn textlint ./src/content --rulesdir ./textlint/rules -f pretty-error"
2727
},
2828
"dependencies": {
@@ -115,6 +115,8 @@
115115
},
116116
"lint-staged": {
117117
"*.{js,ts,jsx,tsx,css}": "yarn prettier",
118-
"src/**/*.md": "yarn fix-headings"
118+
"src/**/*.md": "yarn fix-headings",
119+
"textlint/data/rules/translateGlossary.js": "yarn textlint-docs",
120+
"textlint/generators/genTranslateGlossaryDocs.js": "yarn textlint-docs"
119121
}
120122
}

Diff for: textlint/generators/genTranslateGlossaryDocs.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const data = require('../data/rules/translateGlossary');
44

55
const urlIssues = 'https://github.com/reactjs/ko.react.dev/issues/';
6-
const pathExport = '../../wiki/textlint/translate-glossary.md';
6+
const pathExport = '../../wiki/translate-glossary.md';
77

88
class Markdown {
99
// Property
@@ -30,6 +30,9 @@ class Markdown {
3030
h3(text) {
3131
this.#add(`### ${text}\n\n`);
3232
}
33+
blockQuote(text) {
34+
this.#add(`> ${text}\n\n`);
35+
}
3336
tableHeader(...headers) {
3437
headers.forEach((header) => {
3538
this.#add(header);
@@ -72,6 +75,10 @@ class Utils {
7275
const genTranslateGlossaryDocs = () => {
7376
const md = new Markdown('Translate Glossary');
7477

78+
md.blockQuote(
79+
`해당 문서는 \`textlint/data/rules/translateGlossary.js\` 파일을 기반으로 자동 생성되므로, 임의 수정을 금지합니다.`
80+
);
81+
7582
Object.keys(data).forEach((key1) => {
7683
md.h2(Utils.keyToStr(key1));
7784

Diff for: wiki/translate-glossary.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Translate Glossary
2+
3+
> 해당 문서는 `textlint/data/rules/translateGlossary.js` 파일을 기반으로 자동 생성되므로, 임의 수정을 금지합니다.
4+
5+
## 번역해야 하는 용어
6+
7+
### React
8+
9+
용어 `term`|정규표현식 `sources`|번역 `target`|논의 `discussions`|
10+
---|---|---|---|
11+
Tutorial|`/Tutorial/`, `/[듀튜]토리얼/`|자습서|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
12+
Declarative|`/Declarative/`|선언적인|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
13+
Component|`/Component/`, `/컴퍼넌트/`, `/컴포넌츠/`|컴포넌트|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
14+
Stateful|`/Stateful/`|유상태|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
15+
Stateless|`/Stateless/`|무상태|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
16+
Render|`/Render(?!er)(?:ing)?/`, `/랜더링/`, `/[렌랜]더(?!링)\s?[하한할함합]/`|렌더링(하다)|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
17+
Data|`/Data/`, `/대이터/`|데이터|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
18+
Application|`/Application/`, `/어플리케이[선션]/`, `/응용\s?프로그램/`|애플리케이션|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
19+
External|`/External/`|외부|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
20+
Plugin|`/Plugin/`|플러그인|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
21+
Third|`/Third/`, `/써드/`|서드|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
22+
Syntax|`/Syntax/`, `/[신씬]택스/`|문법|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
23+
Embedding Expression|`/Embedding\s?Expression/`|표현식 포함하기|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
24+
Attribute|`/Attribute/`, `/애트리뷰트/`|어트리뷰트|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
25+
Element|`/Element/`, `/[엘앨]리먼츠/`, `/앨리먼트/`|엘리먼트|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
26+
Function|`/Function/`, `/Functional/`|함수|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
27+
Class|`/Class/`|클래스|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
28+
Composition|`/Composition/`, `/[컴콤][퍼포]지[선션]/`|합성|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
29+
Inheritance|`/Inheritance/`|상속|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
30+
Lifecycle|`/Life\s?Cycle/`, `/라이프\s?사이클/`, `/생명 주기/`|생명주기|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
31+
Handling|`/Handling/`, `/핸들링/`|처리|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
32+
Conditional|`/Conditional/`, `/컨디[서셔][날널]/`|조건부|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
33+
Operator|`/Operator/`, `/오퍼[레래]이터/`|연산자|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
34+
Reuse|`/Reuse/`|재사용|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
35+
Mock|`/Mock/`|모의|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
36+
Callback|`/Callback/`|콜백|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
37+
Synthetic|`/Synthetic/`|합성|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
38+
Event|`/Event/`|이벤트|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
39+
Higher Order|`/Higher\s?Order/`|고차|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
40+
Mount|`/(?<!Un)Mount/`|마운트|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
41+
Unmount|`/Unmount/`, `/언마운트/`|마운트 해제|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
42+
Form|`/Form/`|폼|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
43+
Wrapper|`/Wrapper/`|래퍼|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
44+
Children|`/Child(?:ren)?/`|자식|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
45+
Code-Splitting|`/Code[-\s]?Splitting/`|코드 분할|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
46+
Reconciliation|`/Reconciliation/`|재조정|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
47+
Property|`/Propert(?:y\|ies)/`|프로퍼티|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
48+
Reference|`/Reference/`, `/래퍼런스/`|레퍼런스|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
49+
User|`/User/`, `/유저/`|사용자|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
50+
Interface|`/Interface/`|인터페이스|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
51+
Markup|`/Markup/`, `/마크 업/`|마크업|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
52+
Interactivity|`/Interacti(?:vity\|on)/`, `/인터[랙렉][선션]/`|상호작용|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
53+
Architecture|`/Architecture/`, `/아키택처/`, `/아키[택텍]쳐/`|아키텍처|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
54+
Full-Stack|`/Full[-\s]?Stack/`|풀스택|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
55+
Browser|`/Browser/`|브라우저|[#610](https://github.com/reactjs/ko.react.dev/issues/610)|
56+
Extension|`/Extension/`, `/확장프로그램/`|확장 프로그램|[#610](https://github.com/reactjs/ko.react.dev/issues/610)|
57+
Escape Hatches|`/Escape[-\s]?Hatches/`|탈출구|[#738](https://github.com/reactjs/ko.react.dev/issues/738)|
58+

0 commit comments

Comments
 (0)