Skip to content

Commit 466e51f

Browse files
committed
20251119193839
1 parent 6086f55 commit 466e51f

File tree

1 file changed

+83
-1
lines changed

1 file changed

+83
-1
lines changed

README.md

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
11
# Flexible Text Copy Adapter (FTCA)
2+
3+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4+
[![Python 3.x](https://img.shields.io/badge/python-3.x-blue.svg)](https://www.python.org/)
5+
[![Platform](https://img.shields.io/badge/platform-windows%20%7C%20linux%20%7C%20macos-lightgrey)](https://github.com/yourusername/ftca)
6+
27
<img width="407" alt="{2793AAE1-85B1-4A0C-9D16-D1161511C907}" src="https://github.com/user-attachments/assets/7798a69e-956c-4fdd-9f79-72f56b82332a" />
38

9+
## Table of Contents
10+
- [Flexible Text Copy Adapter (FTCA)](#flexible-text-copy-adapter-ftca)
11+
- [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)
19+
- [Setup:](#setup)
20+
- [How to use with multi-line text in GoldenDict?](#how-to-use-with-multi-line-text-in-goldendict)
21+
- [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+
438
## What is it?
539
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.
640

@@ -12,6 +46,8 @@ In my case, it helps to easily connect local programs Lute (LWT) and GoldenDict
1246
- Working with words. Copying the selected using Ctrl+C manually. The ability to select a separate morpheme of a word in the interface of the utility window.
1347
<img width="960" alt="{72069897-3D0F-426E-82BC-4FB5A598F76D}" src="https://github.com/user-attachments/assets/8b884fbe-0db1-4e4c-b47d-bec144fcc17a" />
1448

49+
[Back to Top](#table-of-contents)
50+
1551
## Who is it for?
1652
In general:
1753
- Studying languages and mastering convenient tools for working with large texts.
@@ -20,14 +56,20 @@ In technical terms:
2056
- Users of [Lute v3](https://github.com/LuteOrg/lute-v3) and similar programs for reading and translating selected portions of text, such as LWT, Readlang.org. Primarily aimed at use in local environments, without mandatory internet connectivity.
2157
- Users of GoldenDict.
2258

59+
[Back to Top](#table-of-contents)
60+
2361
## What problem does this program solve?
2462
A utility for solving the problem of translating individual words in [Lute v3](https://github.com/LuteOrg/lute-v3).
2563

2664
[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)
2765

66+
[Back to Top](#table-of-contents)
67+
2868
## How does it work?
2969
https://github.com/user-attachments/assets/4ae740ae-c729-4405-b80a-7b225c7641b1
3070

71+
[Back to Top](#table-of-contents)
72+
3173
## How to get started?
3274
- 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).
3375

@@ -44,6 +86,8 @@ See the "URL Parameters" and "How to check functionality?" sections below for ex
4486

4587
- Provide permission for the page to use the clipboard.
4688

89+
[Back to Top](#table-of-contents)
90+
4791
## URL Parameters
4892
The utility's behavior is controlled by parameters in the URL:
4993

@@ -61,6 +105,8 @@ The utility's behavior is controlled by parameters in the URL:
61105
- *Example:* `rows=15`
62106
- *Default:* If not specified, the height defaults to `4` lines.
63107

108+
[Back to Top](#table-of-contents)
109+
64110
## How to use in GoldenDict (Single-line text)?
65111
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.
66112

@@ -79,6 +125,8 @@ Command Line: "C:\Program Files\Google\Chrome\Application\chrome.exe" http://127
79125
```
80126
<img width="960" alt="{56ED9E95-983C-4660-A92A-3EA1E0E91033}" src="https://github.com/user-attachments/assets/25328302-f275-4130-892a-0f8b657489fb" />
81127

128+
[Back to Top](#table-of-contents)
129+
82130
## How to use with multi-line text in GoldenDict?
83131
When passing long text with line breaks from GoldenDict, the standard command-line method will fail and merge everything into a single line.
84132

@@ -104,6 +152,8 @@ cmd /c "C:\Users\User\AppData\Local\Programs\Python\Python312\python.exe" "D:\My
104152
```
105153
<img width="960" alt="{2A58A109-50DB-47F8-AB31-EC481A71A823}" src="https://github.com/user-attachments/assets/cf4e736a-25b5-4e6a-9805-798a4379cd50" />
106154

155+
[Back to Top](#table-of-contents)
156+
107157
## What are the advantages?
108158
- **Versatility**. Can be integrated into [Lute](https://github.com/LuteOrg/lute-v3) and similar programs where interaction with dictionaries is done through HTTP requests.
109159
- **Offline operation**. Allows for an offline workflow between reading software and a local dictionary like GoldenDict-ng.
@@ -112,28 +162,40 @@ cmd /c "C:\Users\User\AppData\Local\Programs\Python\Python312\python.exe" "D:\My
112162
- **Cross-platform compatibility**. Works wherever a Python interpreter and a browser can run.
113163
- **Easy integration**. Can be easily included in an existing set of tools.
114164

165+
[Back to Top](#table-of-contents)
166+
115167
## What inspired it?
116168
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.
117169

170+
[Back to Top](#table-of-contents)
171+
118172
## How to use Dark Mode or Dark Theme?
119173
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.
120174

121175
<img width="960" alt="image" src="https://github.com/user-attachments/assets/c4aabcf3-aead-41b9-bfa4-5582591a4a48" />
122176

177+
[Back to Top](#table-of-contents)
178+
123179
## What are the technical features?
124180
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.
125181

182+
[Back to Top](#table-of-contents)
183+
126184
## What are the system environment prerequisites?
127185
- Python 3.x.
128186
- Chrome or a browser that supports the Modern Clipboard API.
129187

188+
[Back to Top](#table-of-contents)
189+
130190
## In what environment was it tested?
131191
- Windows 11.
132192
- Python 3.12.7.
133193
- Chrome Version 122.0.6261.95 (Official Build) (64-bit).
134194
- LUTE: Learning Using Texts v3, Version: 3.10.1.
135195
- GoldenDict-ng 24.04.12-alpha.20240412.000451.
136196

197+
[Back to Top](#table-of-contents)
198+
137199
## How to configure in the Lute v3 web interface?
138200
Settings — Languages — [Your Language] — Edit
139201
Dictionaries — Add dictionary
@@ -144,11 +206,15 @@ Dictionaries — Add dictionary
144206

145207
*(Note: You can adjust the `rows=8` value to your preferred initial height.)*
146208

209+
[Back to Top](#table-of-contents)
210+
147211
## How to allow Clipboard Read Access (Chrome)?
148212
The script uses the Modern Clipboard API, which requires you to grant the page permission to interact with the clipboard.
149213

150214
<img width="407" alt="{2793AAE1-85B1-4A0C-9D16-D1161511C907}" src="https://github.com/user-attachments/assets/8b0186e3-1476-46c3-afa5-f80ebb59581a" />
151215

216+
[Back to Top](#table-of-contents)
217+
152218
## How to check functionality?
153219
Run the `ftca.py` server.
154220

@@ -165,19 +231,35 @@ http://127.0.0.1:5010/?s=This%20is%20a%20test%20in%20a%20taller%20box&rows=10
165231

166232
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.
167233

234+
[Back to Top](#table-of-contents)
235+
168236
## What about the security of my buffer data?
169237
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.
170238

239+
[Back to Top](#table-of-contents)
240+
171241
## Why doesn't it work?
172242
- Ensure no other application is using port `5010`.
173243
- 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`.
174244
- 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.
175245

246+
[Back to Top](#table-of-contents)
247+
248+
## Kardenwort Ecosystem
249+
250+
This project is part of the **[Kardenwort](https://github.com/kardenwort)** environment, designed to create a focused and efficient learning ecosystem.
251+
252+
[Back to Top](#table-of-contents)
253+
176254
## License
177255
MIT License.
178256

257+
[Back to Top](#table-of-contents)
258+
179259
## Author's Disclaimer
180260
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.
181261

262+
[Back to Top](#table-of-contents)
263+
182264
## Stars
183-
If you find this utility helpful, please consider starring the repository to support the developer's efforts.
265+
If you find this utility helpful, please consider starring the repository to support the developer's efforts.

0 commit comments

Comments
 (0)