コモノExtendScript100本ノック

超初心者のDTPオペレーターが週にひとつスクリプトを書くブログ

GitHubやAdobeフォーラムでコード以外の箇所だけ日本語翻訳する方法

Webサイト上で外国語の文章を読む際は、コンテクストメニューからGoogle日本語翻訳を行っています。
素のままのChromeでこれを行うと、コードブロック内も翻訳されてしまうという難点があります。
「ScriptAutoRunner」というChrome拡張で解決できるので手順を記録しておきます。

ScriptAutoRunnerとは

chrome.google.com

Chrome拡張機能
指定したサイトを開くたびに任意のjavascriptを実行します。

設定

f:id:haraguai_is_bad:20211004132634p:plain

①部分をクリックします。
②実行内容のタイトルを入力します。
③実行内容を入力します。
Adobeフォーラム、GitHub、Indiscriptsの場合

Array.prototype.forEach.call(document.getElementsByTagName('pre'), x => x.classList.add('notranslate'))

・Gistの場合

Array.prototype.forEach.call(document.getElementsByClassName('js-gist-file-update-container js-task-list-container file-box'), x => x.classList.add('notranslate'))

④実行するサイトのホストを入力します。
Adobeフォーラム、GitHub、Indiscriptsの場合

community.adobe.com, github.com, indiscripts.com

・Gistの場合

gist.github.com

⑤プラグをクリックし、有効にします。

参考