Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
"name": "com.appleple/google-translate",
"description": "a-blog cms extension.",
"scripts": {
"lint": "vendor/bin/phpcs --standard=phpcs.xml",
"format": "vendor/bin/phpcbf --standard=phpcs.xml",
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
"lint": "vendor/bin/phpcs --standard=phpcs.xml",
"format": "vendor/bin/phpcbf --standard=phpcs.xml",
"check:version": "vendor/bin/phpcs --standard=PHPCompatibility --runtime-set testVersion 8.1-8.4 --ignore=./src/vendor/* ./src",
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"post-update-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
},
"require-dev": {
"squizlabs/php_codesniffer": "3.*",
"phpcompatibility/php-compatibility": "*"
"squizlabs/php_codesniffer": "^3.13",
"phpcompatibility/php-compatibility": "^9.3",
"dealerdirect/phpcodesniffer-composer-installer": "^1.1"
},
"prefer-stable" : true,
"config": {
"platform": {
"php": "8.3"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
116 changes: 108 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 36 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,51 @@ a-blog cms のための「Google Translation API」連携拡張アプリにな

## 動作条件

* php 7.2.5 以上
* php: 8.1 – 8.4 (8.5+ not tested yet)
* a-blog cms for Professional or Enterprise のみ(現状スタンダードライセンスでの利用はライセンス違反となります)
* a-blog cms Ver. 3.1.0 以上
* a-blog cms: >= Ver. 3.2.11 (3.3+ not tested yet)

## ダウンロード

[Google Translate for a-blog cms](https://github.com/appleple/acms-google-translate/raw/master/build/GoogleTranslate.zip)

## 事前準備

### 「Google Translate API Key」の取得
### サービスアカウントの設定と JSON 取得(Cloud Translation API)

[Google API Console](https://console.developers.google.com/) にログインし、以下の作業を行います。
#### 1. プロジェクト作成

* ライブラリで **Cloud Translation API** の有効化
* 認証情報で **APIキー** の作成
- G[Google Cloud Console](https://console.developers.google.com/) にログイン
- 新規プロジェクトを作成
- プロジェクト ID(Project ID)をメモ

APIキーは必ず、**キーの制限** をかけるようにしてください。ただし、**HTTPリファラー** での制限はできませんので、IPアドレスによる制限をかけてください。
#### 2. Cloud Translation API を有効化

- 作成したプロジェクトを選択
- 「API とサービス」→「ライブラリ」
- Cloud Translation API を検索して 有効化

```
※ ここで課金が必要になる場合があります。GCP 側で 請求先アカウント(Billing) が未設定だと API 利用で弾かれることがあります(権限/有効化はできても実行時に失敗するケースがあるため、必要なら Billing も確認)。
```

#### 3. サービスアカウント作成

- 「IAM と管理」→「サービスアカウント」
- サービスアカウントを作成

#### 4. 権限(ロール)を付与

- 対象プロジェクトで、作成したサービスアカウントにロールを付与
- ロール: **Cloud Translation API ユーザー** を付与

#### 5. JSON キー発行(秘密鍵)

- サービスアカウント詳細 →「鍵」タブ
- 「鍵を追加」→「新しい鍵を作成」→ JSON
- ダウンロードした JSON を サーバーに設置
- Web 公開ディレクトリ外に配置(例: /var/app/credentials/translate-sa.json)
- 権限は最小限(例: chmod 600、所有者を実行ユーザーに)

### a-blog cms の設計

Expand Down Expand Up @@ -52,7 +79,8 @@ zipファイルをダウンロードし、解凍したディレクトリ(Googl
|設定項目|説明|
|:---|:---|
|ベース言語|翻訳元となる言語を設定します|
|Google Translate API Key|事前準備で用意した **APIキー** を設定します|
|プロジェクトID|事前準備で用意した **プロジェクトID** を設定します|
|サービスアカウントJSONパス|事前準備で用紙したJSONのパスを絶対パスで設定します|
|カテゴリー作成|翻訳先の記事を作成するときに、カテゴリーも自動で複製するか設定します|
|ベース言語(このブログ)と関連づける他言語ブログを設定|ベース言語のブログと翻訳先のブログの関連を設定します|
|訳対象のフィールドを設定します|翻訳対象のカスタムフィールド名を指定します|
Expand Down
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading