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
-[Flexible Text Copy Adapter (FTCA)](#flexible-text-copy-adapter-ftca)
11
12
-[Table of Contents](#table-of-contents)
12
-
-[What is it?](#what-is-it)
13
-
-[Who is it for?](#who-is-it-for)
14
-
-[What problem does this program solve?](#what-problem-does-this-program-solve)
15
-
-[How does it work?](#how-does-it-work)
16
-
-[How to get started?](#how-to-get-started)
17
-
-[URL Parameters](#url-parameters)
18
-
-[How to use in GoldenDict (Single-line text)?](#how-to-use-in-goldendict-single-line-text)
13
+
-[Overview](#overview)
14
+
-[What is it?](#what-is-it)
15
+
-[Who is it for?](#who-is-it-for)
16
+
-[What problem does this program solve?](#what-problem-does-this-program-solve)
17
+
-[How does it work?](#how-does-it-work)
18
+
-[What are the advantages?](#what-are-the-advantages)
19
+
-[What inspired it?](#what-inspired-it)
20
+
-[Getting Started](#getting-started)
21
+
-[What are the system environment prerequisites?](#what-are-the-system-environment-prerequisites)
22
+
-[How to get started?](#how-to-get-started)
23
+
-[How to check functionality?](#how-to-check-functionality)
24
+
-[Configuration \& Usage](#configuration--usage)
25
+
-[URL Parameters](#url-parameters)
26
+
-[How to configure in the Lute v3 web interface?](#how-to-configure-in-the-lute-v3-web-interface)
27
+
-[How to use in GoldenDict (Single-line text)?](#how-to-use-in-goldendict-single-line-text)
19
28
-[Setup:](#setup)
20
-
-[How to use with multi-line text in GoldenDict?](#how-to-use-with-multi-line-text-in-goldendict)
29
+
-[How to use with multi-line text in GoldenDict?](#how-to-use-with-multi-line-text-in-goldendict)
21
30
-[Setup:](#setup-1)
22
-
-[What are the advantages?](#what-are-the-advantages)
23
-
-[What inspired it?](#what-inspired-it)
24
-
-[How to use Dark Mode or Dark Theme?](#how-to-use-dark-mode-or-dark-theme)
25
-
-[What are the technical features?](#what-are-the-technical-features)
26
-
-[What are the system environment prerequisites?](#what-are-the-system-environment-prerequisites)
27
-
-[In what environment was it tested?](#in-what-environment-was-it-tested)
28
-
-[How to configure in the Lute v3 web interface?](#how-to-configure-in-the-lute-v3-web-interface)
29
-
-[How to allow Clipboard Read Access (Chrome)?](#how-to-allow-clipboard-read-access-chrome)
30
-
-[How to check functionality?](#how-to-check-functionality)
31
-
-[What about the security of my buffer data?](#what-about-the-security-of-my-buffer-data)
32
-
-[Why doesn't it work?](#why-doesnt-it-work)
33
-
-[Kardenwort Ecosystem](#kardenwort-ecosystem)
34
-
-[License](#license)
35
-
-[Author's Disclaimer](#authors-disclaimer)
36
-
-[Stars](#stars)
37
-
38
-
## What is it?
31
+
-[How to allow Clipboard Read Access (Chrome)?](#how-to-allow-clipboard-read-access-chrome)
32
+
-[How to use Dark Mode or Dark Theme?](#how-to-use-dark-mode-or-dark-theme)
33
+
-[Technical Details](#technical-details)
34
+
-[What are the technical features?](#what-are-the-technical-features)
35
+
-[In what environment was it tested?](#in-what-environment-was-it-tested)
36
+
-[What about the security of my buffer data?](#what-about-the-security-of-my-buffer-data)
37
+
-[Troubleshooting](#troubleshooting)
38
+
-[Why doesn't it work?](#why-doesnt-it-work)
39
+
-[Legal \& Misc](#legal--misc)
40
+
-[Kardenwort Ecosystem](#kardenwort-ecosystem)
41
+
-[License](#license)
42
+
-[Author's Disclaimer](#authors-disclaimer)
43
+
-[Stars](#stars)
44
+
45
+
---
46
+
47
+
## Overview
48
+
49
+
### What is it?
39
50
This is a small utility that serves as an adapter, allowing to establish communication between a class of programs for assistance in reading in a foreign language and a local dictionary or translator, through the system clipboard.
40
51
41
52
In my case, it helps to easily connect local programs Lute (LWT) and GoldenDict for the ability to work locally, without an internet connection and automatically translate and view selected words from the Lute reading program in the GoldenDict-ng dictionary program.
@@ -48,7 +59,7 @@ In my case, it helps to easily connect local programs Lute (LWT) and GoldenDict
48
59
49
60
[Back to Top](#table-of-contents)
50
61
51
-
## Who is it for?
62
+
###Who is it for?
52
63
In general:
53
64
- Studying languages and mastering convenient tools for working with large texts.
54
65
@@ -58,19 +69,42 @@ In technical terms:
58
69
59
70
[Back to Top](#table-of-contents)
60
71
61
-
## What problem does this program solve?
72
+
###What problem does this program solve?
62
73
A utility for solving the problem of translating individual words in [Lute v3](https://github.com/LuteOrg/lute-v3).
63
74
64
75
[Issue #593 — Revision of the logic of copying a word and substring of text from the main panel](https://github.com/LuteOrg/lute-v3/issues/593)
-**Versatility**. Can be integrated into [Lute](https://github.com/LuteOrg/lute-v3) and similar programs where interaction with dictionaries is done through HTTP requests.
86
+
-**Offline operation**. Allows for an offline workflow between reading software and a local dictionary like GoldenDict-ng.
87
+
-**Multi-line text preservation**. Reliably handles text with line breaks from applications like GoldenDict, which is not possible with direct command-line calls.
88
+
-**Minimalism**. Minimal software dependencies.
89
+
-**Cross-platform compatibility**. Works wherever a Python interpreter and a browser can run.
90
+
-**Easy integration**. Can be easily included in an existing set of tools.
91
+
92
+
[Back to Top](#table-of-contents)
93
+
94
+
### What inspired it?
95
+
I accidentally discovered that when making a request like `https://m.dict.cc/deutsch-russisch/test.html`, the input field on the page loads with the search term already selected (as if by Ctrl+A). This JavaScript-powered feature allows for immediate copying to the clipboard, which inspired the core functionality of FTCA.
96
+
97
+
[Back to Top](#table-of-contents)
98
+
99
+
## Getting Started
100
+
101
+
### What are the system environment prerequisites?
102
+
- Python 3.x.
103
+
- Chrome or a browser that supports the Modern Clipboard API.
104
+
105
+
[Back to Top](#table-of-contents)
106
+
107
+
### How to get started?
74
108
- Download. You can perform a clone or visit the Releases page. The project consists of three main files: `ftca.py` (the server), `index.html` (the web page), and `launcher.py` (a helper script for multi-line support in GoldenDict).
75
109
76
110
- Check that the Python interpreter is installed on your system.
@@ -88,7 +122,27 @@ See the "URL Parameters" and "How to check functionality?" sections below for ex
The page should load with your text in the input field, fully selected. If `clipboard=true` is used and permission is granted, the text will also be automatically copied to your clipboard. For multi-line tests, use the GoldenDict setup described above.
140
+
141
+
[Back to Top](#table-of-contents)
142
+
143
+
## Configuration & Usage
144
+
145
+
### URL Parameters
92
146
The utility's behavior is controlled by parameters in the URL:
93
147
94
148
-**`s`**: The text content to display in the text area. The text should be standard URL-encoded.
@@ -107,7 +161,19 @@ The utility's behavior is controlled by parameters in the URL:
107
161
108
162
[Back to Top](#table-of-contents)
109
163
110
-
## How to use in GoldenDict (Single-line text)?
164
+
### How to configure in the Lute v3 web interface?
*(Note: You can adjust the `rows=8` value to your preferred initial height.)*
173
+
174
+
[Back to Top](#table-of-contents)
175
+
176
+
### How to use in GoldenDict (Single-line text)?
111
177
This utility can be used not only with Lute but also within GoldenDict as a "Program" dictionary. This allows you to send the current search term to a new browser tab for easier editing or further processing.
112
178
113
179
This is ideal for single words or short phrases without line breaks.
When passing long text with line breaks from GoldenDict, the standard command-line method will fail and merge everything into a single line.
132
198
133
199
To preserve line breaks, we must use the included `launcher.py` helper script. It safely encodes the text using Base64 before launching the browser. Additionally, it automatically sets the text area height to **20 rows** (`rows=20`) for better viewing of multi-line content.
-**Versatility**. Can be integrated into [Lute](https://github.com/LuteOrg/lute-v3) and similar programs where interaction with dictionaries is done through HTTP requests.
159
-
-**Offline operation**. Allows for an offline workflow between reading software and a local dictionary like GoldenDict-ng.
160
-
-**Multi-line text preservation**. Reliably handles text with line breaks from applications like GoldenDict, which is not possible with direct command-line calls.
161
-
-**Minimalism**. Minimal software dependencies.
162
-
-**Cross-platform compatibility**. Works wherever a Python interpreter and a browser can run.
163
-
-**Easy integration**. Can be easily included in an existing set of tools.
164
-
165
-
[Back to Top](#table-of-contents)
223
+
### How to allow Clipboard Read Access (Chrome)?
224
+
The script uses the Modern Clipboard API, which requires you to grant the page permission to interact with the clipboard.
166
225
167
-
## What inspired it?
168
-
I accidentally discovered that when making a request like `https://m.dict.cc/deutsch-russisch/test.html`, the input field on the page loads with the search term already selected (as if by Ctrl+A). This JavaScript-powered feature allows for immediate copying to the clipboard, which inspired the core functionality of FTCA.
If you use a browser extension like [Dark Reader](https://github.com/darkreader/darkreader), you can enable it for the FTCA page. Simply open a link like `http://127.0.0.1:5010/?s=test` and activate the plugin for this site.
The utility runs a lightweight, dependency-free HTTP server using Python's standard library. It serves a single HTML/JS page that acts as the adapter. For multi-line text, a helper script uses Base64 encoding to ensure data integrity during transmission via the command line.
181
-
182
-
[Back to Top](#table-of-contents)
237
+
## Technical Details
183
238
184
-
## What are the system environment prerequisites?
185
-
- Python 3.x.
186
-
- Chrome or a browser that supports the Modern Clipboard API.
239
+
### What are the technical features?
240
+
The utility runs a lightweight, dependency-free HTTP server using Python's standard library. It serves a single HTML/JS page that acts as the adapter. For multi-line text, a helper script uses Base64 encoding to ensure data integrity during transmission via the command line.
187
241
188
242
[Back to Top](#table-of-contents)
189
243
190
-
## In what environment was it tested?
244
+
###In what environment was it tested?
191
245
- Windows 11.
192
246
- Python 3.12.7.
193
247
- Chrome Version 122.0.6261.95 (Official Build) (64-bit).
@@ -196,70 +250,37 @@ The utility runs a lightweight, dependency-free HTTP server using Python's stand
The page should load with your text in the input field, fully selected. If `clipboard=true` is used and permission is granted, the text will also be automatically copied to your clipboard. For multi-line tests, use the GoldenDict setup described above.
233
-
234
-
[Back to Top](#table-of-contents)
235
-
236
-
## What about the security of my buffer data?
253
+
### What about the security of my buffer data?
237
254
This utility does not transmit your data to the internet. It operates locally on your PC, transmitting data between applications via the loopback network interface (`127.0.0.1`). While it doesn't store data on disk, it is processed in RAM. Assess your own risks when working with sensitive information. It is strongly recommended not to expose this server to any address other than the loopback address.
238
255
239
256
[Back to Top](#table-of-contents)
240
257
241
-
## Why doesn't it work?
258
+
## Troubleshooting
259
+
260
+
### Why doesn't it work?
242
261
- Ensure no other application is using port `5010`.
243
262
- Make sure you have only one instance of the `ftca.py` script running. Check your system's process manager for `python` processes related to `ftca`.
244
263
- If using the multi-line method, double-check that the paths to `python.exe` and `launcher.py` in your GoldenDict command are correct and enclosed in double quotes.
245
264
246
265
[Back to Top](#table-of-contents)
247
266
248
-
## Kardenwort Ecosystem
267
+
## Legal & Misc
268
+
269
+
### Kardenwort Ecosystem
249
270
250
271
This project is part of the **[Kardenwort](https://github.com/kardenwort)** environment, designed to create a focused and efficient learning ecosystem.
251
272
252
273
[Back to Top](#table-of-contents)
253
274
254
-
## License
275
+
###License
255
276
MIT License.
256
277
257
278
[Back to Top](#table-of-contents)
258
279
259
-
## Author's Disclaimer
280
+
###Author's Disclaimer
260
281
The software is provided "as is" without any warranties. The author is not responsible for any damages or issues arising from the use of this software. Users are advised to use it at their own risk.
261
282
262
283
[Back to Top](#table-of-contents)
263
284
264
-
## Stars
285
+
###Stars
265
286
If you find this utility helpful, please consider starring the repository to support the developer's efforts.
0 commit comments