{"id":19592889,"url":"https://github.com/fauu/coditra","last_synced_at":"2025-10-08T06:48:45.789Z","repository":{"id":72663304,"uuid":"512212973","full_name":"fauu/Coditra","owner":"fauu","description":"A translator’s companion for desktop. Select fragments of a text document and quickly look them up in online dictionaries","archived":false,"fork":false,"pushed_at":"2025-03-21T18:22:55.000Z","size":852,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-27T14:39:22.557Z","etag":null,"topics":["dictionary","french","go","gpl","italian","language-learning","nestedtext","reverso-context","svelte","translation","translation-tool"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fauu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-07-09T14:57:53.000Z","updated_at":"2025-03-21T18:22:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"8235607b-562b-4913-96b3-145119d90d37","html_url":"https://github.com/fauu/Coditra","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fauu/Coditra","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauu%2FCoditra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauu%2FCoditra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauu%2FCoditra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauu%2FCoditra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fauu","download_url":"https://codeload.github.com/fauu/Coditra/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauu%2FCoditra/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278903008,"owners_count":26065786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dictionary","french","go","gpl","italian","language-learning","nestedtext","reverso-context","svelte","translation","translation-tool"],"created_at":"2024-11-11T08:37:18.650Z","updated_at":"2025-10-08T06:48:45.761Z","avatar_url":"https://github.com/fauu.png","language":"Go","readme":"\u003c!-- vim: set textwidth=80 colorcolumn=80: --\u003e\n\u003c!-- markdownlint-configure-file\n{\n  \"line-length\": { \"code_blocks\": false },\n  \"no-inline-html\": false\n}\n--\u003e\n# Coditra\n\n\u003e A translator’s companion program for the desktop. Select fragments of a text\n\u003e document and quickly look them up in online dictionaries\n\nCoditra is a locally run web application intended as support in translation of\ntext. Its main feature is quick dictionary lookups, whereby results are pulled\nfrom various online dictionaries and presented in a clear form directly in the\nuser interface.\n\nCoditra comes with several built-in lookup sources. Adding a custom source\ncurrently requires writing an adapter for it, compiling it together with the\nserver portion of the program as well as writing the corresponding UI component\nfor the client portion of the program to display the results.\n\nTested on Linux and Windows. Should theoretically also work on macOS, FreeBSD,\nOpenBSD, NetBSD and Solaris.\n\nSupports Linux, Windows, and (theoretically — untested) macOS.\n\nBuilt with [Go](https://go.dev/) and [Svelte](https://svelte.dev/).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"media/screenshots.png\"\u003e\n\u003c/p\u003e\n\n## Installation\n\nBinary releases are not currently provided. The program must be built from\nthe source:\n\nRequirements: `pnpm` (or equivalent), `go`.\n\n1. Clone\n\n    ```sh\n    git clone \"https://github.com/fauu/Coditra\"\n    ```\n\n1. Build the client\n\n    ```sh\n    cd Coditra/client\n    pnpm install\n    pnpm build\n    ```\n\n1. Build the server\n\n    ```sh\n    cd .. # from `client` back to root\n    ./scripts/server-prebuild.sh\n    cd server\n    go build -o target/coditra cmd/coditra/main.go\n    ```\n\nThis produces a self-contained executable at `server/target/coditra[.exe]`.\n\nUpon running it, the web interface will be accessible at\n\u003chttp://localhost:1291\u003e.\n\n## Configuration\n\nOn first launch, the program will create a default configuration file\n([`config/config.sample.nt`](config/config.sample.nt)) in:\n\n**Linux**\u003cbr\u003e\n`$XDG_CONFIG_HOME/coditra/config.nt` (usually `~/.config/coditra/config.nt`)\n\n**Windows**\u003cbr\u003e\n`%APPDATA%\\coditra\\config.nt` (usually\n`C:\\Users\\\u003cusername\u003e\\AppData\\Roaming\\coditra\\config.nt`)\n\n**macOS**\u003cbr\u003e\n`~/Library/Application Support/coditra/config.nt`\n\nBefore using Coditra, this file must be edited: a value for the key\n`documentsDir` must be specified.\n\n### File format\n\nThe configuration file is a [NestedText](https://nestedtext.org/en/stable/)\nfile. Below is an annotated example describing its expected shape.\n\n```sh\n# Path of the directory containing HTML documents to be read by Coditra\ndocumentsDir: /home/\u003cuser\u003e/documents/translation-texts\n# The user agent used by the lookup adapters to access internet resources. When\n# this entry is absent, a defualt defined in the file `server/config.go` is\n# used\nuserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36\n# Simple lookup sources that do not need to be programmed as all they do is\n# open the specified URL in a new browser tab\nlookups:\n  -\n    # Used to refer to this source in other places in the configuration file\n    id: bob\n    # Displayed in the user interface\n    name: Bob\n    # {input} is substituted with the user’s query string and the resulting URL\n    # is navigated to in a new browser tab\n    url: https://www.google.com/search?q={input}\n    params:\n      # Determines the flag displayed in the corresponding button in the UI\n      sourceLang: fr\n# Sets of lookup buttons displayed on the left side of the lookup panel\nsetups:\n  -\n    # Displayed in the UI\n    name: Français 🡒 Polski\n    # List of buttons\n    lookups:\n      # Refers to the entry with id `bob` defined in the `lookups` field above\n      - bob\n      # Refers to the key referencing the wordreference.com lookup source as\n      # defined in the `LookupSources` map in the file `server/server.go`. \"fr\"\n      # and \"en\" refer, respectively, to the `sourceLang` and `targetLang`\n      # parameters which are handled in the lookup source implementation (in\n      # this case in the `server/lookups/wr.go` file).\n      - wr(fr, en)\n```\n\n## Input documents\n\nCoditra uses HTML files as input.\n\nIt is recommened to use specially formatted HTML files, which can be created by\nCoditra from Markdown files. This special formatting enables features that make\nit easier to orient yourself within the text while constantly context-switching\nbetween it and the lookup results. Specifically, those features are: 1)\ndisplaying each sentence in its own paragraph, 2) letting you highlight the\nsentence your are currently working on by clicking on it, 3) underlining\nemphasized portions of text so that the formatting is not overlooked.\n\nTo convert a Markdown file to a prepared HTML file, run:\n\n```sh\ncoditra --prepare \u003cfilename\u003e.md \u003cfilename\u003e.html\n```\n\n## Usage tips/notes\n\n* Initiating a browser text selection with a double click instead of a single\n  click makes it snap to full words.\n\n* You can use `pandoc` to easily create an input Markdown file directly from a\n  text selection made in web browser. For example (Linux Wayland version):\n\n  ```sh\n  wl-paste -t text/html | pandoc -r html -w markdown-raw_html-native_divs-native_spans-fenced_divs-bracketed_spans \u003e \u003cfilename\u003e.md\n  ```\n\n* Successful lookup requests are cached in memory until the program is\n  restarted.\n\n## Known issues\n\n* TREX and Reverso Context sources are broken in some circumstances (Cloudflare\n  challenge). Garzanti blocks VPNs.\n\n* SJP PWN lookup: some results as well as “internal” cross-references not\n  picked up. For an example of both see \u003chttps://sjp.pwn.pl/sjp/szukaj/mistrz\u003e\n  (under “wielki mistrz”).\n\n* Lingea lookup: unhandled cases:\n  \u003chttps://slowniki.lingea.pl/wlosko-polski/nella\u003e,\n  \u003chttps://slowniki.lingea.pl/francusko-polski/la\u003e (`lex_ful_desc2`).\n\n## Development\n\nTerminal #1:\n\n1. `go install github.com/air-verse/air@latest` or `pacman -S air-bin` etc.\n\n2. `cd server`\n\n3. `air`\n\nThe program will automatically rebuild and relaunch on any `.go` file change.\n\nTerminal #2:\n\n1. `cd client`\n\n2. `pnpm dev`\n\nThe client will be hot-reloaded on modification.\n\n**In development, be sure to access the web UI through the address\n\u003chttp://localhost:5000\u003e, and not localhost:1291**, as the latter address will\ncontain a stale version of the client, not the fresh one served by the\ndevelopment server.\n\n### Adding new Lookup Sources\n\n1. Create a new `.go` file in `server/lookup/`. You need to implement the type\n   `Source` defined in [`server/lookup/lookup.go`](server/lookup/lookup.go).\n   Refer to other files in [`server/lookup/`](server/lookup/) for examples.\n\n2. Add an entry for your source to the `LookupSources` map defined at the top of\n   the `RunServer()` function in the file\n   [`server/server.go`](server/server.go).\n\n3. Create a new `\u003cLookup Source Name\u003eLookupResult.svelte` file in\n   [`client/src/lookup`](client/src/lookup). You need to implement a Svelte\n   component that receives a `lookupResult` prop with the data returned by your\n   Go code. Refer to other files in [`client/src/lookup`](client/src/lookup) for\n   examples.\n\n4. Add your component to the `sourceToLookupResultComponent` map defined near\n   the top of the\n   [`client/src/LookupPanel.svelte`](client/src/LookupPanel.svelte) file.\n\n5. Build the program as described in the [Installation](#Installation) section.\n\n## License\n\nCoditra\\\nCopyright (C) 2020-2025 Piotr Grabowski\n\nThis program is free software: you can redistribute it and/or modify it under\nthe terms of the GNU Affero General Public License as published by the Free\nSoftware Foundation, either version 3 of the License, or (at your option) any\nlater version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License along\nwith this program. If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n\n### Third-party components\n\nCoditra includes the following third-party components:\n\n| Component                    | License      |\n|------------------------------|--------------|\n| [axios]                      | MIT          |\n| [bluemonday]                 | BSD-3-Clause |\n| [chi]                        | MIT          |\n| [goldmark]                   | MIT          |\n| [goquery]                    | BSD-3-Clause |\n| [Line Awesome]               | MIT          |\n| [nt-go]                      | MIT          |\n| [rs/cors]                    | MIT          |\n| [Svelte]                     | MIT          |\n\n[goquery]: https://github.com/PuerkitoBio/goquery\n[nt-go]: https://github.com/dolow/nt-go\n[chi]: https://github.com/go-chi/chi\n[bluemonday]: https://github.com/microcosm-cc/bluemonday\n[rs/cors]: https://github.com/rs/cors\n[goldmark]: https://github.com/yuin/goldmark/\n[axios]: https://github.com/axios/axios\n[Svelte]: https://svelte.dev/\n[Line Awesome]: https://icons8.com/line-awesome\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffauu%2Fcoditra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffauu%2Fcoditra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffauu%2Fcoditra/lists"}