使用 WPF、WebView2 和 SQLite 打造 FluentDock:Windows 11 翻譯應用程式與小工具式介面
Building a Small Windows 11 Translation App & Widget with WPF, WebView2 and SQLite
作者以 C#、.NET、WPF、WebView2 和 SQLite 開發 Windows 11 翻譯應用程式 FluentDock,串連翻譯、儲存詞彙與複習流程。應用程式透過 WebView2 嵌入 Google Translate 或 DeepL,並以 SQLite 在本機儲存詞彙及複習進度。翻譯仍需連接互聯網,並由所選服務處理。
I kept looking up the same words in Google Translate or DeepL, getting an answer, and then forgetting it. The translation wasn't the difficult part. The missing piece was having somewhere to save useful words and actually practise them later.
That led me to build FluentDock, a small Windows 11 desktop app using C#, .NET, WPF, WebView2 and SQLite.
The interesting part of the build wasn't creating another translator. It was connecting three everyday actions: translate → save → review.
1. WPF for a desktop-first workflow:
I wanted translation available without constantly opening browser tabs.
FluentDock runs as a standalone Windows application with notification-area access and a configurable global keyboard shortcut. Its compact window can also be pinned to the desktop, kept above other windows and locked in position.
WPF gave me the desktop application framework for building that experience in C# and .NET.
An important distinction: this isn't a Windows Widgets-panel extension. It's a regular desktop application with widget-style behaviour.
The interface has to work both as a temporary window you open for a quick translation and as something you leave visible while studying or working.
2. WebView2 instead of building a translation engine:
I was already using Google Translate and DeepL. I didn't need to invent a translation service or replace their familiar interfaces.
Instead, FluentDock uses Microsoft Edge WebView2 to bring those providers into the desktop application.
The responsibility is deliberately separated: WebView2 handles the embedded online translation experience. The application's own interface handles vocabulary saving and review. The selected translation provider processes the translation request.
That approach has a clear trade-off: translation still requires an internet connection, and the text being translated is handled under Google or DeepL's privacy practices.
Embedding an existing service doesn't magically make that service local or offline.
3. SQLite for the vocabulary library:
Looking up a translation is only useful for learning if I can find it again.
FluentDock lets me save a word or phrase with its translation and language information. The vocabulary library is searchable and editable, with SQLite storing the saved entries and learning progress locally.
The important architectural boundary is between online translation and local learning data.
FluentDock doesn't add its own usage telemetry. Settings, vocabulary and review progress remain on the PC, while translation requests still go to the chosen provider.
4. Making saved words useful again:
A list of saved vocabulary can easily become another collection you never revisit.
I added a review workflow where words return for practice. During a review, you try to recall the meaning and select Remembered or Forgot. That response influences when the word appears again.
For pronunciation, the app uses Windows' installed speech voices rather than requiring pronunciation to be part of the online translation step.
Voice availability depends on the languages and speech packages installed in Windows.
There are also optional review reminders, with configurable intervals.
The larger lesson for me: is that a useful application doesn't always require inventing new technology. Sometimes the work is in connecting existing pieces into a workflow that removes a small, repeated frustration.
Original build story: Why I Built FluentDock: A Translation Widget for Windows 11
來源:DEV Community · dev.to