Home - gs-kikim/docs-trans-app GitHub Wiki
Docs Translate
Markdown(.md) , reStructuredText(.rst) λ¬Έμλ€μ μ€μ κ°μ λ°λΌ λ²μνλ CLI ν΄μ
λλ€.
{config}.json νμΌ μμ± μ€ "service_name": "Google_v2"
μ
λ ₯ μ [GOOGLE_API_KEY]κ° νμν©λλ€.
Installation
$ pip install docs-translate
Settings file
{config}.jsonνμΌ κΈ°λ³Έ μ€μ μ μλμ κ°μ΅λλ€.
Settings file content example:
{
"target_dir":"{language_convert_dir}",
"source_lang": "ko",
"target_lang": "en",
"service_name": "Google_v2",
}
μ€μ νμΌ μμ± ν CLI λͺ
λ Ήμ΄ μ΅μ
μμ -c CONFIG_PATH
λ₯Ό μΆκ°νμ
μΌ ν©λλ€.
Usage
μ€μ νμ§ μμλ μ μ΅μ μ ν΅ν΄ μ€μ κ°λ₯ν©λλ€.
$ docs-translate [-h] [-c CONFIG_PATH]
[-s {Google,Google_v2}] [-S] [-T]
[-path {source_path}] [-d {target_dir}]
μλ₯Ό λ€μ΄ ν΄λ κ΅¬μ‘°κ° μλμ κ°μ΅λλ€.
D:/
βββ ko/
β βββ example_folder/
β βββ ex1.md
β βββ ex2.py
β βββ ex3.rst
βββ en/
β βββ target_dir/
β
βββ config.json
[μμ 1] D:\ko\ νμ .md, .rst νμΌλ€μ D:\en νμ νμΌλ‘ λ²μ νκ³ μ ν©λλ€.
- config.jsonμ μλμ κ°μ΄ μ€μ ν©λλ€.
{
"target_dir":"D:\\en",
"source_lang": "ko",
"target_lang": "en",
"service_name": "Google_v2",
}
- CLIλ₯Ό ν΅ν΄ λͺ
λ Ήμ΄λ₯Ό μ
λ ₯ν©λλ€. target_dir μ€μ μ
-d D:\en
μ΅μ μ ν΅ν΄μλ κ°λ₯ν©λλ€.
> docs-translate -c D:\config.json -path D:\ko
- μλμ κ°μ΄ ν΄λ λ° νμΌμ΄ μμ°¨μ μΌλ‘ μμ± ν λ²μλ©λλ€.
D:/
βββ ko/
β βββ example_folder/
β βββ ex1.md
β βββ ex2.py
β βββ ex3.rst
βββ en/
β βββ target_dir/
β βββ example_folder/
β βββ ex1.md
β βββ ex3.rst
βββ config.json
[μμ 2] D:\ko\ νμ .md, .rst νμΌλ€μ D:\en\target_dir νμ νμΌλ‘ λ²μ νκ³ μ ν©λλ€.
- config.jsonμ [μμ 1]κ³Ό κ°μ΅λλ€.
- CLIλ₯Ό ν΅ν΄ λͺ
λ Ήμ΄λ₯Ό μ
λ ₯ν©λλ€. config μ€μ 보λ€
-d
μ΅μ κ°μ΄ λμ μ°μ μμλ₯Ό κ°μ΅λλ€.
> docs-translate -c D:\config.json -path D:\ko -d c:\en\target_dir
- μλμ κ°μ΄ ν΄λ λ° νμΌμ΄ μμ°¨μ μΌλ‘ μμ± ν λ²μλ©λλ€.
D:/
βββ ko/
β βββ example_folder/
β βββ ex1.md
β βββ ex2.py
β βββ ex3.rst
βββ en/
β βββ target_dir/
β βββ example_folder/
β βββ ex1.md
β βββ ex3.rst
βββ config.json
Positional arguments:
path
Path to folder to process. If not set, uses current folder-d TARGET_DIR, --target_dir TARGET_DIR
, If not set, the target_dir in config.json is set
Optional arguments:
-h, --help
, show this help message and exit-c CONFIG_PATH, --config_path CONFIG_PATH
, Path to config_file-s {Yandex,Google,Bing,Deepl}, --service_name {Yandex,Google,Bing,Deepl}
, Translating service-S SOURCE_LANG, --source_lang SOURCE_LANG
, Source language code-T TARGET_LANG, --target_lang TARGET_LANG
, Target language code
Translation services:
Now used Yandex
, Google
, Bing
, Deepl
, Google_v2
Some of them can be not working, try it and find the most suitable for you
Google --> It's free, but the translation isn't good.
Google_v2 --> need to google Cloud Translation API key.