-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f865219
commit c025a27
Showing
1 changed file
with
27 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,41 @@ | ||
# yaml-translater | ||
Google Cloud Translation APIを使ったYamlファイル翻訳するPythonスクリプト | ||
## Setup | ||
サービスアカウントキーの設定(windows) | ||
``` | ||
setx GOOGLE_APPLICATION_CREDENTIALS <json_key_path> -m | ||
``` | ||
[公式ドキュメント](https://cloud.google.com/translate/docs/setup) | ||
## Requirements | ||
* Python 3.9 | ||
* pyyaml 5.4.1 | ||
* google-cloud-translate 2.0.1 | ||
## Example | ||
before | ||
クォーテーションで囲まれている部分だけ翻訳されます | ||
* before | ||
``` | ||
a: Hello | ||
a: false | ||
b: | ||
a: Good Night | ||
b: I am Fine | ||
a: 'Good Night' | ||
b: "I am Fine" | ||
c: | ||
- What are you doing? | ||
- a: Hey Guys! | ||
b: We have a gift for you | ||
``` | ||
after | ||
* after | ||
``` | ||
a: こんにちは | ||
a: false | ||
b: | ||
a: おやすみ | ||
b: 私は元気です | ||
a: 'おやすみ' | ||
b: "私は元気です" | ||
c: | ||
- 何してるの? | ||
- a: やあみんな! | ||
b: 私たちはあなたへの贈り物を持っています | ||
- What are you doing? | ||
- a: Hey Guys! | ||
b: We have a gift for you | ||
``` | ||
## Setup | ||
サービスアカウントキーの設定(windows) | ||
``` | ||
setx GOOGLE_APPLICATION_CREDENTIALS <json_key_path> -m | ||
``` | ||
[公式ドキュメント](https://cloud.google.com/translate/docs/setup) | ||
## Requirements | ||
* Python 3.9 | ||
* pyyaml 5.4.1 | ||
* google-cloud-translate 2.0.1 | ||
## Usage | ||
``` | ||
python main.py <target_file> | ||
``` | ||
同じディレクトリに対象ファイル名_translated.ymlが生成されます |