Coder Social home page Coder Social logo

ablaze-mirai / consoletranslate Goto Github PK

View Code? Open in Web Editor NEW
20.0 1.0 4.0 36.05 MB

コンソール上で翻訳を行えるツール

License: MIT License

Go 100.00%
go golang google-translate deepl-translation-api translate cli-app commnadline console-app

consoletranslate's Introduction

ConsoleTranslate

翻訳をコンソール上で行えるツール

$ translate ja "Hello World"

> [Before] (DeepL)
>  Hello World
>> [After: ja]
> ハロー・ワールド

⚠ 1系(1.x.x)とは仕様が1部異なります

⭐ 使い方

# ヘルプを表示
translate help

# 翻訳先の言語を指定して翻訳
translate en こんにちは

# 空白のあるテキストを翻訳
translate en "こんにちは 世界"

# 結果をJSONで出力
translate json en こんにちは

対応している言語の言語コード一覧は 言語サポート | Cloud Translation | Google Cloud を参照

⚡ インストール

⚠ 設定ファイル(config.json)は1系(1.x.x)と同じなので1系をお使いの方はバイナリを置き換えるだけで使用できます

  1. Latest Release からビルド済みバイナリをダウンロード

  2. ダウンロードしたバイナリを解凍して好きなディレクトリへ移動

  3. バイナリを置いたディレクトリにパスを通す

  4. DeepL(v2.0.3より対応) または GoogleTranslate(GAS) のAPIキーを発行してください。

    APIキー発行の手順(DeepL・Google共通)を参考にしてください。

  5. config.jsonを同じ階層に作成し4.で発行したAPIキーを設定します。

  • Google Translate(GAS)でAPIキーを発行した場合
{"api": "<ここにAPIキーを設定>"}
  • DeepLでAPIキーを発行した場合

アカウントタイプはDeepL Freeの場合はfreeをDeepL Proの場合はproを設定してください。

APIキーはAPIキー発行の手順(DeepL・Google共通)で発行したAPIキー(認証キー)を設定してください

{"api": "deepl,<アカウントタイプ>,<APIキー>"}

お疲れ様でした。これでご使用いただけます🎉

🌠 開発

⚠ 開発は1系(1.x.x)から大きく変更があります

# Clone this repository

# Linux
cp config.go.sample config.go
cp config.json.sample config.json

# Windows (PowerShell 7.x)
copy config.go.sample config.go
copy config.json.sample config.json

go mod tidy

開発モードに切り替える (これを行わないとgo runが使用できません)

config.go以下のように書き換えてください

// config.go [Line: 6~9]

repo     = "https://github.com/Ablaze-MIRAI/ConsoleTranslate"
command  = "translate"
dev      = true //false

🔧 ビルド

開発モードに切り替えていた場合は戻してください

# Linux
cp config.go.sample config.go
cp config.json.sample config.json
go build -o translate *.go


# Windows (PowerShell 7.x)
copy config.go.sample config.go
copy config.json.sample config.json
go build -o translate.exe .

💌 Special thanks

Comamoca

お餅のCreeeper

nexryai

consoletranslate's People

Contributors

code-raisan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

consoletranslate's Issues

引数関連のバグが多すぎる

もともとの計画を破棄して実装した今このコマンドの設計に意味はないので、仕様修正をする。
コマンドに互換性が消えるのでv2.0.0としてリリース予定

DeepLなどへの対応

Google Translateでは言語の翻訳能力に限界があるので、DeepLに対応できたらより便利だと思います。

特に Google Translate と DeepL の結果を同時に表示できればより利便性が高くなると思います。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.