Skip to content

Commit

Permalink
feat: wiki/translate-glossary.md auto generation using lint-staged (#991
Browse files Browse the repository at this point in the history
)

husky 및 lint-staged를 이용한 wiki/translate-glossary.md 문서 생성 자동화 진행.
  • Loading branch information
lumirlumir committed Jul 19, 2024
1 parent 1dafd6b commit 85c952a
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,3 @@ public/fonts/**/Optimistic_*.woff2

# rss
public/rss.xml

# textlint
wiki/textlint/translate-glossary.md
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"check-all": "npm-run-all prettier lint:fix tsc rss",
"rss": "node scripts/generateRss.js",
"textlint-test": "yarn mocha ./textlint/tests/utils && yarn mocha ./textlint/tests/rules",
"textlint-docs": "node ./textlint/generators/genTranslateGlossaryDocs.js",
"textlint-docs": "node ./textlint/generators/genTranslateGlossaryDocs.js && git add wiki/translate-glossary.md",
"textlint-lint": "yarn textlint ./src/content --rulesdir ./textlint/rules -f pretty-error"
},
"dependencies": {
Expand Down Expand Up @@ -115,6 +115,8 @@
},
"lint-staged": {
"*.{js,ts,jsx,tsx,css}": "yarn prettier",
"src/**/*.md": "yarn fix-headings"
"src/**/*.md": "yarn fix-headings",
"textlint/data/rules/translateGlossary.js": "yarn textlint-docs",
"textlint/generators/genTranslateGlossaryDocs.js": "yarn textlint-docs"
}
}
9 changes: 8 additions & 1 deletion textlint/generators/genTranslateGlossaryDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
const data = require('../data/rules/translateGlossary');

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

class Markdown {
// Property
Expand All @@ -30,6 +30,9 @@ class Markdown {
h3(text) {
this.#add(`### ${text}\n\n`);
}
blockQuote(text) {
this.#add(`> ${text}\n\n`);
}
tableHeader(...headers) {
headers.forEach((header) => {
this.#add(header);
Expand Down Expand Up @@ -72,6 +75,10 @@ class Utils {
const genTranslateGlossaryDocs = () => {
const md = new Markdown('Translate Glossary');

md.blockQuote(
`해당 문서는 \`textlint/data/rules/translateGlossary.js\` 파일을 기반으로 자동 생성되므로, 임의 수정을 금지합니다.`
);

Object.keys(data).forEach((key1) => {
md.h2(Utils.keyToStr(key1));

Expand Down
58 changes: 58 additions & 0 deletions wiki/translate-glossary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translate Glossary

> 해당 문서는 `textlint/data/rules/translateGlossary.js` 파일을 기반으로 자동 생성되므로, 임의 수정을 금지합니다.
## 번역해야 하는 용어

### React

용어 `term`|정규표현식 `sources`|번역 `target`|논의 `discussions`|
---|---|---|---|
Tutorial|`/Tutorial/`, `/[듀튜]토리얼/`|자습서|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Declarative|`/Declarative/`|선언적인|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Component|`/Component/`, `/컴퍼넌트/`, `/컴포넌츠/`|컴포넌트|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Stateful|`/Stateful/`|유상태|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Stateless|`/Stateless/`|무상태|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Render|`/Render(?!er)(?:ing)?/`, `/랜더링/`, `/[렌랜]더(?!링)\s?[하한할함합]/`|렌더링(하다)|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Data|`/Data/`, `/대이터/`|데이터|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Application|`/Application/`, `/어플리케이[선션]/`, `/응용\s?프로그램/`|애플리케이션|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
External|`/External/`|외부|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Plugin|`/Plugin/`|플러그인|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Third|`/Third/`, `/써드/`|서드|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Syntax|`/Syntax/`, `/[신씬]택스/`|문법|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Embedding Expression|`/Embedding\s?Expression/`|표현식 포함하기|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Attribute|`/Attribute/`, `/애트리뷰트/`|어트리뷰트|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Element|`/Element/`, `/[엘앨]리먼츠/`, `/앨리먼트/`|엘리먼트|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Function|`/Function/`, `/Functional/`|함수|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Class|`/Class/`|클래스|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Composition|`/Composition/`, `/[컴콤][퍼포]지[선션]/`|합성|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Inheritance|`/Inheritance/`|상속|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Lifecycle|`/Life\s?Cycle/`, `/라이프\s?사이클/`, `/생명 주기/`|생명주기|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Handling|`/Handling/`, `/핸들링/`|처리|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Conditional|`/Conditional/`, `/컨디[서셔][날널]/`|조건부|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Operator|`/Operator/`, `/오퍼[레래]이터/`|연산자|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Reuse|`/Reuse/`|재사용|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Mock|`/Mock/`|모의|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Callback|`/Callback/`|콜백|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Synthetic|`/Synthetic/`|합성|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Event|`/Event/`|이벤트|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Higher Order|`/Higher\s?Order/`|고차|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Mount|`/(?<!Un)Mount/`|마운트|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Unmount|`/Unmount/`, `/언마운트/`|마운트 해제|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Form|`/Form/`|폼|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Wrapper|`/Wrapper/`|래퍼|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Children|`/Child(?:ren)?/`|자식|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Code-Splitting|`/Code[-\s]?Splitting/`|코드 분할|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Reconciliation|`/Reconciliation/`|재조정|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Property|`/Propert(?:y\|ies)/`|프로퍼티|[#2](https://github.com/reactjs/ko.react.dev/issues/2)|
Reference|`/Reference/`, `/래퍼런스/`|레퍼런스|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
User|`/User/`, `/유저/`|사용자|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
Interface|`/Interface/`|인터페이스|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
Markup|`/Markup/`, `/마크 업/`|마크업|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
Interactivity|`/Interacti(?:vity\|on)/`, `/인터[랙렉][선션]/`|상호작용|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
Architecture|`/Architecture/`, `/아키택처/`, `/아키[택텍]쳐/`|아키텍처|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
Full-Stack|`/Full[-\s]?Stack/`|풀스택|[#569](https://github.com/reactjs/ko.react.dev/issues/569)|
Browser|`/Browser/`|브라우저|[#610](https://github.com/reactjs/ko.react.dev/issues/610)|
Extension|`/Extension/`, `/확장프로그램/`|확장 프로그램|[#610](https://github.com/reactjs/ko.react.dev/issues/610)|
Escape Hatches|`/Escape[-\s]?Hatches/`|탈출구|[#738](https://github.com/reactjs/ko.react.dev/issues/738)|

0 comments on commit 85c952a

Please sign in to comment.