0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Mac】コマンドで翻訳する方法

Posted at

translate-shellを使用するとコマンドでGoogle Translateなどを利用して翻訳できます。

translate-shellをインストールする

Homebrewを使用する場合には以下のコマンドでインストールできます。

brew install translate-shell 

その他のインストール方法については以下をご参照ください。

翻訳する

transコマンドを使用して翻訳できます。

$ trans 'Hello World'
Hello World

こんにちは世界
(Kon'nichiwa sekai)

「Hello World」の翻訳
[ English -> 日本語 ]

Hello World
    こんにちは世界, ハローワールド, こんにちは、世界

特定の言語に翻訳する

英語を日本語に翻訳する場合には以下のようにします。

$ trans :ja 'Hello World'
Hello World

こんにちは世界
(Kon'nichiwa sekai)

「Hello World」の翻訳
[ English -> 日本語 ]

Hello World
    こんにちは世界, ハローワールド, こんにちは、世界

フランス語を日本語に翻訳する場合には以下のようにします。

$ trans fr:ja 'Bonjour'
Bonjour

おはよう
(Ohayō)

「Bonjour」の翻訳
[ Français -> 日本語 ]

Bonjour
    おはよう, おはようございます

翻訳結果のみ出力するには-bを使用します。

$ trans fr:ja -b 'Bonjour'
おはよう

ファイルを翻訳する

input.txtを翻訳する場合には以下のようにします。

trans :ja -i input.txt

結果をoutput.txtに出力するには以下のようにします。

trans :ja -i input.txt -o output.txt
0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?