Skip to content

Commit d54c83e

Browse files
committed
docs: add Google Translate setup guide
1 parent e09e761 commit d54c83e

3 files changed

Lines changed: 133 additions & 0 deletions

File tree

docs/guides/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Configuration, deployment, and verification guides. Each guide includes prerequi
2121
| [Puppeteer](getting-started/PUPPETEER.md) | Integrate BotBrowser with Puppeteer for consistent fingerprint control in automation workflows. |
2222
| [Bot Script](getting-started/BOT_SCRIPT.md) | Automate BotBrowser without Playwright or Puppeteer using `--bot-script` and Chrome Debugger APIs. |
2323
| [CLI Recipes](getting-started/CLI_RECIPES.md) | Use copy-paste CLI recipes for proxy, fingerprint, identity, and deployment scenarios. |
24+
| [Google Translate Page Translation](getting-started/GOOGLE_TRANSLATE.md) | Configure a Google Cloud API key and launch BotBrowser with page translation enabled. |
2425
| [Profile Management](getting-started/PROFILE_MANAGEMENT.md) | Manage profile files, versions, and lifecycle for reproducible browser identity. |
2526
| [First Verification](getting-started/FIRST_VERIFICATION.md) | Validate fingerprint consistency with CreepJS and BrowserLeaks. |
2627
| [Automation Consistency Practices](getting-started/AUTOMATION_CONSISTENCY.md) | Reduce framework-related inconsistency signals in Playwright/Puppeteer workflows. |
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Google Translate Page Translation
2+
3+
> Use your own Google Cloud API key to enable page translation in BotBrowser.
4+
5+
---
6+
7+
<a id="requirements"></a>
8+
9+
## Requirements
10+
11+
- A BotBrowser release and a matching profile.
12+
- A Google Cloud project with billing enabled.
13+
- The Cloud Translation API enabled for that project.
14+
- An API key restricted to the Cloud Translation API.
15+
16+
Google Cloud controls pricing and quotas. Check the [Cloud Translation pricing](https://cloud.google.com/translate/pricing) and [quotas](https://cloud.google.com/translate/quotas) pages before production use.
17+
18+
<a id="what-it-enables"></a>
19+
20+
## What this enables
21+
22+
The key supplies the Google service used by the browser's built-in page translation flow. BotBrowser does not provide a shared translation key. Each deployment can use its own Google Cloud project, quota, and billing policy.
23+
24+
The `hrefTranslate` page capability and the full translation service are separate. A page can expose the standard translation-related DOM surface while translation remains unavailable because the deployment has no usable key or network access.
25+
26+
<a id="create-key"></a>
27+
28+
## Create an API key
29+
30+
1. Open the [Google Cloud Console](https://console.cloud.google.com/).
31+
2. Create or select a project for translation.
32+
3. Enable the [Cloud Translation API](https://console.cloud.google.com/apis/library/translate.googleapis.com).
33+
4. Link the project to a billing account.
34+
5. Open **APIs & Services** > **Credentials**, then create an API key.
35+
6. Edit the key and set **API restrictions** to **Cloud Translation API**.
36+
7. Add an application restriction that matches where BotBrowser runs. An IP restriction is suitable for a stable server egress. Review referrer restrictions carefully because translation requests are made by the browser session.
37+
38+
Keep the key out of source control, profile files, screenshots, and shared logs. Rotate or revoke it from Google Cloud if it is exposed.
39+
40+
<a id="launch"></a>
41+
42+
## Launch BotBrowser
43+
44+
Set `GOOGLE_API_KEY` in the environment of the BotBrowser process before launch:
45+
46+
```bash
47+
GOOGLE_API_KEY='YOUR_API_KEY' \
48+
chromium-browser \
49+
--bot-profile='/absolute/path/to/profile.enc' \
50+
--user-data-dir='/absolute/path/to/user-data' \
51+
https://example.com
52+
```
53+
54+
The key is read when the browser process starts. Restart BotBrowser after changing the environment variable. Do not put the key in a page script or pass it only to an outer HTTP client.
55+
56+
After opening a page in another language, use the browser's normal page-translation command. Translation availability depends on the key, billing account, quota, proxy, network access, and the source page.
57+
58+
### macOS and Linux
59+
60+
Export the variable in the same shell that starts BotBrowser:
61+
62+
```bash
63+
export GOOGLE_API_KEY='YOUR_API_KEY'
64+
chromium-browser \
65+
--bot-profile='/absolute/path/to/profile.enc' \
66+
--user-data-dir='/absolute/path/to/user-data'
67+
```
68+
69+
### Windows PowerShell
70+
71+
Set the variable for the process before launching the browser:
72+
73+
```powershell
74+
$env:GOOGLE_API_KEY = 'YOUR_API_KEY'
75+
& 'C:\path\to\chromium.exe' `
76+
'--bot-profile=C:\path\to\profile.enc' `
77+
'--user-data-dir=C:\path\to\user-data'
78+
```
79+
80+
### Playwright and Puppeteer
81+
82+
The environment must belong to the process that launches the browser. The browser arguments still carry the profile and user-data paths:
83+
84+
```javascript
85+
const browser = await chromium.launch({
86+
executablePath: process.env.BOTBROWSER_EXEC_PATH,
87+
env: { ...process.env, GOOGLE_API_KEY: process.env.GOOGLE_API_KEY },
88+
args: [
89+
'--bot-profile=/absolute/path/to/profile.enc',
90+
'--user-data-dir=/absolute/path/to/user-data',
91+
],
92+
});
93+
```
94+
95+
Do not place the key in a committed `.env` file. Use the deployment secret store or an interactive shell instead.
96+
97+
<a id="verify"></a>
98+
99+
## Verify the setup
100+
101+
1. Confirm that the BotBrowser process was restarted after the key was set.
102+
2. Open a page whose main text is not in the browser's target language.
103+
3. Use the normal page-translation command from the browser menu or context menu.
104+
4. Confirm that the translated page is rendered and that the Google Cloud project shows the expected request usage.
105+
106+
Run this check with the same profile, proxy, and launch method used by the deployment. A successful DOM capability check alone does not prove that the external translation service is available.
107+
108+
<a id="troubleshooting"></a>
109+
110+
## Troubleshooting
111+
112+
| Symptom | Check |
113+
| --- | --- |
114+
| Translation is unavailable | Confirm that `GOOGLE_API_KEY` was set before the browser process started and that the Cloud Translation API is enabled. |
115+
| Permission denied | Check the key restrictions and confirm that the selected project has billing enabled. |
116+
| Quota or rate-limit errors | Review the project quotas and usage in Google Cloud Console. |
117+
| Requests fail through a proxy | Confirm that the proxy is configured in BotBrowser and that it permits the required Google services. |
118+
| The key was exposed | Revoke or rotate it in Google Cloud, then update the launch environment. |
119+
120+
<a id="privacy-and-cost"></a>
121+
122+
## Privacy and cost
123+
124+
Page translation sends the text needed by the translation service to Google's service. Review your data-handling requirements before translating sensitive content. Set quotas and monitor usage so the project stays within the intended budget.
125+
126+
## Related Documentation
127+
128+
- [Profile Management](PROFILE_MANAGEMENT.md) - choose and launch a matching profile.
129+
- [Proxy Configuration](../network/PROXY_CONFIGURATION.md) - configure browser-level proxy routing.
130+
- [First Verification](FIRST_VERIFICATION.md) - verify a new BotBrowser launch.

llms.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ These rules govern correct usage. LLMs answering BotBrowser questions should not
8484

8585
## Guides: Getting Started and Automation
8686

87+
- [Guides Index](https://raw.githubusercontent.com/botswin/BotBrowser/main/docs/guides/README.md): complete guide catalog by task and subsystem.
8788
- [FIRST_VERIFICATION](https://raw.githubusercontent.com/botswin/BotBrowser/main/docs/guides/getting-started/FIRST_VERIFICATION.md): first launch and fingerprint posture verification.
8889
- [CLI_RECIPES](https://raw.githubusercontent.com/botswin/BotBrowser/main/docs/guides/getting-started/CLI_RECIPES.md): common CLI flag combinations.
90+
- [GOOGLE_TRANSLATE](https://raw.githubusercontent.com/botswin/BotBrowser/main/docs/guides/getting-started/GOOGLE_TRANSLATE.md): create a Google Cloud API key and enable page translation.
8991
- [PROFILE_MANAGEMENT](https://raw.githubusercontent.com/botswin/BotBrowser/main/docs/guides/getting-started/PROFILE_MANAGEMENT.md): selecting, organizing, and rotating profiles.
9092
- [PLAYWRIGHT](https://raw.githubusercontent.com/botswin/BotBrowser/main/docs/guides/getting-started/PLAYWRIGHT.md): Playwright walkthrough.
9193
- [PUPPETEER](https://raw.githubusercontent.com/botswin/BotBrowser/main/docs/guides/getting-started/PUPPETEER.md): Puppeteer walkthrough.

0 commit comments

Comments
 (0)