UNPKG

5.92 kBMarkdownView Raw
1# translate .md to \*.md[![explain](http://llever.com/explain.svg)](https://github.com/chinanf-boy/explain-translateMds) [![install size](https://packagephobia.now.sh/badge?p=translate-mds)](https://packagephobia.now.sh/result?p=translate-mds)
2
3like
4
5```bash
6.md to .「all-language」.md
7```
8
9[english](./README.en.md)
10
11---
12
13[![Build Status](https://travis-ci.org/chinanf-boy/translate-mds.svg?branch=master)](https://travis-ci.org/chinanf-boy/translate-mds)
14[![codecov](https://codecov.io/gh/chinanf-boy/translate-mds/branch/master/graph/badge.svg)](https://codecov.io/gh/chinanf-boy/translate-mds)
15[![GitHub license](https://img.shields.io/github/license/chinanf-boy/translate-mds.svg)](https://github.com/chinanf-boy/translate-mds/blob/master/License)
16![npm](https://img.shields.io/npm/v/translate-mds.svg)
17![GitHub release](https://img.shields.io/github/tag/chinanf-boy/translate-mds.svg)
18
19## life
20
21[help me live , live need money 💰](https://github.com/chinanf-boy/live-need-money)
22
23---
24
25<!-- START doctoc generated TOC please keep comment here to allow auto update -->
26<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
27
28- [This project is for all-of-markdown-writing-files translation`工具`](#this-project-is-for-all-of-markdown-writing-files-translation%E5%B7%A5%E5%85%B7)
29- [Demo](#demo)
30- [Command line options](#command-line-options)
31- [My-translate-list](#my-translate-list)
32- [common problem](#common-problem)
33 - [1. Sometimes the wind will get stuck and stagnate.](#1-sometimes-the-wind-will-get-stuck-and-stagnate)
34 - [2. There are a number of totals that have not been translated successfully](#2-there-are-a-number-of-totals-that-have-not-been-translated-successfully)
35- [Tips](#tips)
36 - [Welcome 👏 ISSUE and PULL](#welcome--issue-and-pull)
37- [characteristic](#characteristic)
38- [Split Code](#split-code)
39
40<!-- END doctoc generated TOC please keep comment here to allow auto update -->
41
42## This project is for all-of-markdown-writing-files translation`工具`
43
44```js
45npm install -g translate-mds
46```
47
48```js
49// all folder·
50translateMds md/
51
52//or single file
53
54translateMds test.md
55```
56
57## Demo
58
59![demo](./imgs/demo.gif)
60
61## Command line options
62
63```bash
64translate [folder/single] md file language to you want
65
66 Usage
67 $ translateMds [folder/file name] [options]
68
69 Example
70 $ translateMds md/
71
72 [options]
73 -a API : default < baidu > {google|baidu|youdao}
74 -f from : default < auto detect >
75 -t to : default < zh >
76 -N num : default < 1 > {async number}
77 -R rewrite : default < false > {yes/no rewrite translate file}
78
79 🌟[high user options]❤️
80
81 -D debug
82 -C cache : default: false cache in disk
83 -G google.com : default: false { cn => com with Google api }
84 -F force : default: false { If, translate result is no 100%, force wirte md file }
85 -M match : default [ ". ", "! "//...] {match this str, merge translate result }
86 -S skips : default ["... ", "etc. ", "i.e. "] {match this str will, skip merge translate result }
87 -T types : default ["html", "code"] {pass the md AST type}
88 --timewait : default < 80 > {each fetch api wait time}
89 --values [path] : default: false {write the original of wait for translate file} [single file]
90 --translate [path] : default: false {use this file translate} [single file]
91 --text-glob [pattern] : default: false {text must be match, then be transalte}
92 --no-disk : default: false {do not use cached Result}
93 --cache-name [filename] : default: "translateMds" named the cache file
94 --glob [pattern] : default: false {file must be match, then be transalte}
95 --ignore [relative file/folder] : default: false {ignore files/folders string, split with `,` }
96```
97
98## My-translate-list
99
100[Project test translation list](https://github.com/chinanf-boy/translate-mds-test-list)or[More Chinese 🇨🇳 translation list](https://github.com/chinanf-boy/chinese-translate-list)
101
102## common problem
103
104### 1. Sometimes the wind will get stuck and stagnate.
105
106```js
107If slow , may be you should try again or use -D
108```
109
110The problem comes from the API, you just have to run it again.
111
112### 2. There are a number of totals that have not been translated successfully
113
114> Quantity is no translation success / total is the total number of single file translations
115
116This problem occurs, usually from the shift of characters caused by unusual symbols or sentences that are too long.
117
118At this time, you can use`-D`Debug /`-F`Force write to file / Adjust unusual characters
119
120[Specific can be seen](https://github.com/chinanf-boy/translate-mds/issues/22)
121
122## Tips
123
1241. Diff file type, may try [pandoc converter](https://github.com/jgm/pandoc)
1252. May use cli without `-f **`,cause `translation.js` auto detect language
126
127- `--timewait [number]` can lengthen the time of each request translation, reduce the banned ip
128- `--values [file-path]` (single file usage) to get the original output file to be translated
129- `--translate [file-path]` (single file usage) replaces the request api and uses the translated content of this file instead
130
131### Welcome 👏 ISSUE and PULL
132
133## characteristic
134
135- [x] Improve the accuracy of md format such as http
136
137- [x] Automatic translation
138
139- [x] Enable md AST
140
141## Split Code
142
143- [files-list](https://github.com/chinanf-boy/files-list)
144- [what-time](https://github.com/chinanf-boy/what-time)
145- [zh-to-en-symbol](https://github.com/chinanf-boy/zh-to-en-symbol)
146
147---
148
149Use[`remark`](https://github.com/wooorm/remark)Improve accuracy
150
151Use[`translation.js`](https://github.com/Selection-Translator/translation.js)Complete interaction with the translation website
152
153There is another[Asynchronous Promise recursive example](https://github.com/chinanf-boy/translate-mds/blob/master/src/setObjectKey.js#L78)