{"id":13305790,"url":"https://github.com/fauu/Coditra","last_synced_at":"2025-03-10T14:31:56.875Z","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":"2022-10-27T12:28:45.000Z","size":803,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T09:44:43.084Z","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}},"created_at":"2022-07-09T14:57:53.000Z","updated_at":"2024-10-13T18:29:14.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,"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","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242868390,"owners_count":20198469,"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","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-07-29T17:54:34.869Z","updated_at":"2025-03-10T14:31:56.852Z","avatar_url":"https://github.com/fauu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"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 for desktop. Select fragments of a text document and\n\u003e 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 are 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\nrequires writing an adapter and compiling it together the server portion of the\nprogram as well as writing a UI component for the client portion of the program\nto display the results.\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 available. The program must be built from\nthe source:\n\nRequirements: `Yarn 1` (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    yarn install\n    yarn build\n    ```\n\n1. Build the server\n\n    ```sh\n    cd ..\n    ./scripts/server-prebuild.sh\n    cd server\n    go build -o target/coditra cmd/coditra/main.go\n    ```\n\nThe self-contained executable for the program is now ready at\n`server/target/coditra[.exe]`.\n\nThe web interface will be accessible at \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 `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. For best results, however, a Markdown file\nshould be fed to it first in order to produce a HTML file specifically tailored\nfor use with it. This enables features that make it easier for you to remain\noriented within the text while constantly context-switching between it and the\nlookup results. Specifically, those features are: displaying each sentence in\nits own paragraph and letting you highlight a sentence you are currently working\non by clicking on it.\n\nTo convert a Markdown input 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 text selection by with double click instead of a single click makes\n  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* SJP PWN lookup: some results as well as “internal” cross-references not\n  picked up. For 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/cortesi/modd/cmd/modd@latest` or `pacman -S modd` etc.\n\n2. `cd server`\n\n3. `modd`\n\nThe program will automatically rebuild and relaunch on any `.go` file change.\n\nTerminal #2:\n\n1. `cd client`\n\n2. `yarn 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-2022 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","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"}