You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-14Lines changed: 39 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,9 @@ CodeTranslateAI is a powerful Chrome extension that allows you to translate code
5
5
## ✨ Key Features
6
6
7
7
-**On-the-Fly Translation:** Instantly translate code on platforms like Stack Overflow, Medium, and technical blogs.
8
-
-**Secure Serverless Backend:** Uses a Cloudflare Worker so your AI API key is never exposed on the frontend.
8
+
-**Secure Serverless Backend:** Uses a Cloudflare Worker.
9
9
-**Multi-Language Tabs:** Translate the same code block into multiple languages and switch between them easily.
10
10
-**Smart Caching:** Translations are cached in your browser for 10 days to reduce API calls and provide instant results.
11
-
-**Elegant & Isolated UI:** A clean UI that matches the width of the original code block and uses a Shadow DOM to prevent any style conflicts with the host page.
12
11
-**Powered by Gemini:** Leverages Google's Gemini AI for high-quality code translations with syntax highlighting.
13
12
14
13
---
@@ -17,7 +16,7 @@ CodeTranslateAI is a powerful Chrome extension that allows you to translate code
17
16
18
17
-**Frontend:**
19
18
- Modular JavaScript (ES6+)
20
-
-**esbuild** (for bundling)
19
+
-**esbuild**& **dotenv**(for bundling and environment variables)
21
20
- HTML5 & CSS3
22
21
- Chrome Extension APIs (`storage`, `activeTab`)
23
22
- Shadow DOM for style isolation.
@@ -102,27 +101,55 @@ You must have **Node.js** and **npm** installed on your machine.
102
101
103
102
3. **Configure the Backend URL**
104
103
105
-
- Open the `background.js` file.
106
-
- Find the `BACKEND_URL` constant and **paste the Cloudflare Worker URL** you copied in the previous step.
104
+
- In the `frontend` folder, create a new file named `.env`.
105
+
- Add the Cloudflare Worker URL you copied in the previous step to this file:
106
+
107
+
<!-- end list -->
108
+
109
+
```
110
+
# .env file
111
+
BACKEND_URL="https://your-worker-url.workers.dev"
112
+
```
113
+
114
+
4. **Create the Build Configuration**
115
+
116
+
- In the `frontend` folder, create a file named `build.js` and add the following content. This file tells our build script how to use the `.env` variable.
117
+
118
+
<!-- end list -->
107
119
108
120
```javascript
109
-
// background.js
110
-
const BACKEND_URL = "https://backend.exampledinesh.workers.dev"; // PASTE YOUR URL HERE
0 commit comments