mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
1 line
64 KiB
JSON
1 line
64 KiB
JSON
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Getting started","text":"<p>GoldenDict-ng is an advanced dictionary lookup program.</p>"},{"location":"#features","title":"Features","text":"<ul> <li>Supports many dictionary formats, such as MDX, DSL, StarDict, Zim...</li> <li>Presents lookup results of multiple dictionaries in the same page</li> <li>Supports special types of \"dictionaries\", such as external program, website, audio files...</li> <li>Lots of auxiliary features<ul> <li>Popup window</li> <li>Full text search</li> <li>Anki integration</li> <li>Transliteration for some languages</li> <li>Word stemming and spelling correction via Hunspell's morphology analysis </li> <li>Unicode case, diacritics, punctuation and whitespace folding (e.g. typing 'Grussen' would yield 'gr\u00fc\u00dfen' in German dictionaries).</li> <li>...</li> </ul> </li> </ul>"},{"location":"#screenshots","title":"Screenshots","text":"<p>On Windows 11 with default theme:</p> <p></p> <p>On macOS with dark reader mode and native system dark theme </p> <p></p> <p>On Linux with custom Qt color theme</p> <p></p>"},{"location":"#project-history","title":"Project history","text":"<p>This project is forked from the original GoldenDict which was developed at http://goldendict.org/</p> <p>The <code>-ng</code> in name means \"next generation\".</p>"},{"location":"architecture/","title":"Architecture","text":""},{"location":"architecture/#index-file","title":"Index file","text":"<p>Each index file have 4 sections.</p> <ol> <li><code>IdxHeader</code></li> <li><code>ExtraInfo</code> (Being used but unnamed in source code)</li> <li><code>Chunks</code></li> <li><code>BtreeIndex</code></li> </ol> <p>The <code>IdxHeader</code> are 32bits blocks of various meta info of the index. The most important info are <code>chunksOffset</code> and <code>indexRootOffset</code> pointing to the starting offset of <code>BtreeIndex</code> and <code>Chunks</code>.</p> <p>Some dicts only have one <code>ExtraInfo</code>: the <code>dictionaryName</code> which is an uint32 size of a string followed and the string.</p> <p>Each chunk contains uint32 size of uncompressed data, uint32 size of zlib compressed data, and the zlib compressed data.</p> <p>The <code>Chunks</code> maybe used by both <code>IdxHeader</code> and <code>BtreeIndex</code>.</p> <p>By adding new a new chunk to <code>Chunks</code> and store an offset to <code>IdxHeader</code>, <code>ExtraInfo</code> can store arbitrary long information.</p> <p><code>BtreeIndex</code> is a zlib compressed typical btree implementation in which each Node will include <code>word</code> info and a <code>offset</code> that pointing to corresponding <code>chunk</code>'s position.</p> <p>Note that a <code>chunk</code> only includes necessary data to find an article, and it does not contain the <code>word</code>.</p> <p>The exact data in <code>chunk</code> is decided and interpreted by dictionary implementations. For example, the starting and ending position of an article in a dictionary file.</p>"},{"location":"architecture/#whats-under-the-hood-after-a-word-is-queried","title":"What's under the hood after a word is queried?","text":"<p>After typing a word into the search box and press enter, the embedded browser will load <code>gdlookup://localhost?word=<wantted word></code>. This url will be handled by Qt webengine's Url Scheme handler. The returned html page will be composed in the ArticleMaker which will initiate some DataRequest on dictionary formats. Resource files will be requested via <code>bres://</code> or <code>qrc://</code> which will went through a similar process.</p> <p>TODO: other subsystems.</p>"},{"location":"custom_dictionary/","title":"Customize Dictionary","text":"<p>A <code>metadata.toml</code>, which uses toml format, can be used to customize or override some properties of a certain dictionary. It is also used in auto grouping by metadata</p> <p>The <code>metadata.toml</code> should be placed on each dictionary's root folder (beside dictionary files) like</p> <pre><code>.\n\u251c\u2500\u2500 Cambridge\n\u2502 \u251c\u2500\u2500 metadata.toml < here\n\u2502 \u251c\u2500\u2500 Cambridge.idx\n\u2502 \u251c\u2500\u2500 Cambridge.info\n\u2502 \u251c\u2500\u2500 Cambridge.syn\n\u2502 \u2514\u2500\u2500 Cambridge.dict.dz \n\u2514\u2500\u2500 Collins\n \u251c\u2500\u2500 metadata.toml < here\n \u251c\u2500\u2500 res.zip\n \u2514\u2500\u2500 Collins.dsl \n</code></pre>"},{"location":"custom_dictionary/#override-display-name","title":"Override display name","text":"<p>Some dictionary formats' display is embedded inside the dictionary, which cannot be easily changed, but you can add the following to override it.</p> <pre><code>[metadata]\nname = \"New Name\"\n</code></pre> <p>This <code>New Name</code> will be appeared as the dictionary name.</p>"},{"location":"custom_dictionary/#disable-full-text-search","title":"Disable full-text search","text":"<pre><code>fts=false\n\n[metadata]\nname=\"New Name\"\n</code></pre> <p>The <code>fts</code> field's value can be <code>on/off</code>, <code>1/0</code> ,<code>true/false</code> etc.</p> <p><pre><code>fts=false\n</code></pre> will disable the current dictionary's full-text search.</p> <p>You can check the full-text search status on each dictionary's info dialog.</p> <p></p> <p>Note that it is possible to enable full text for a single dictionary by disabling full-text search in the Preferences dialog, and set <code>fts=true</code> for that dictionary.</p>"},{"location":"developer/","title":"Start develop","text":"<p>If you know some C++ and optionally some Qt, you can start to modify GoldenDict right now.</p> <p>This page is a brief introduction on how to get started.</p> <p>For technical details see how to build from source.</p>"},{"location":"developer/#1-install-qt","title":"1. Install Qt","text":"<p>To install Qt on macOS or Windows, uses the Qt Online Installer. It can be downloaded from Qt for Open Source.</p> <p>Those Qt components are needed</p> <ul> <li>Qt</li> <li>6.7.2 (Or another version)<ul> <li>MSVC 2019 (or MSVC 2022)</li> <li>Qt5 Compatible Module</li> <li>Additional Libraries</li> <li>Qt Image formats</li> <li>Qt MultiMedia</li> <li>Qt Positioning</li> <li>Qt SerialPort (? super weird here, but it is needed.)</li> <li>Qt Speech</li> <li>Qt Webchannel</li> <li>Qt Webengine</li> </ul> </li> <li>Qt Creator (optional)<ul> <li>CMake</li> <li>Ninja</li> </ul> </li> </ul> <p>Note that MinGW is not supported.</p> <p>CMake and Ninja are needed.</p>"},{"location":"developer/#2-install-a-compiler","title":"2. Install a compiler","text":"<p>For windows, MSVC can be obtained by installing Visual Studio's \"Desktop development with C++\".</p> <p>For macOS, install XCode.</p>"},{"location":"developer/#3-obtain-dependencies","title":"3. Obtain dependencies","text":"<p>For Windows, prebuilt libraries will be automatically downloaded.</p> <p>For macOS, install Homebrew and install related packages as described in how to build from source or search <code>brew install</code> command in macOS release's build file.</p>"},{"location":"developer/#4-build","title":"4. Build","text":"<p>First, get GoldenDict's source code by Cloning a repository.</p> <p>Then choose your favorite IDE/editor and load the <code>CMakeLists.txt</code>. If unsure, just use Qt Creator.</p>"},{"location":"developer/#qt-creator","title":"Qt Creator","text":"<p>Open <code>CMakeLists.txt</code> from Qt Creator, then you wil choose a \"Kit\" which is pretty much a Qt installation.</p> <p>Qt Creator usually can auto detect your Qt installation. In case it doesn't, check out \"Kit\" settings. Note that, the compiler must be set to MSVC on Windows.</p> <p>By default everything will be built, you can disable ffmpeg, epwing...</p> <p></p> <p>Then, hit the \"Run\" button at bottom-right corner should build and run GoldenDict.</p>"},{"location":"developer/#command-line-only","title":"Command Line only","text":"<p>See how to build from source.</p> <p>Qt's doc: Building projects on the command line</p>"},{"location":"developer/#visual-studio","title":"Visual Studio","text":"<p>VS2022 has CMake support. After opening the source code folder, VS will starts to configure CMake but likely won't succeed.</p> <p>You need to add Qt's path and other options to \"CMake command arguments\". Then, \"save\" the dialog with Ctrl+S or click one of the many \"(re)configure cache\" buttons.</p> <p></p> <p>Click run will build the project, but the <code>.exe</code> would not run, because the dependencies are not copied.</p> <p>Simply click \"install\", which is actually copying dependencies.</p> <p></p>"},{"location":"developer/#visual-studio-code","title":"Visual Studio Code","text":"<p>Install CMake Tools.</p> <p>Then open GoldenDict's folder, and the CMake extension will kicks in.</p> <p>Then add Qt's path and various other options to configure arguments.</p> <pre><code>-DCMAKE_PREFIX_PATH={Your Qt install path}\\6.7.2\\msvc2019_64\n</code></pre> <p></p>"},{"location":"developer/#clion","title":"CLion","text":""},{"location":"developer/#xcode","title":"XCode","text":""},{"location":"developer/#cmake-gui","title":"CMake GUI","text":""},{"location":"developer/#lsp-editor","title":"LSP + Editor?","text":""},{"location":"developer/#related-things","title":"Related Things","text":"<p>Please follow C++ Core Guidelines and write modern C++ code.</p> <p>Qt's documentation</p>"},{"location":"dictformats/","title":"Dictionary Formats","text":"<p>Popular dictionary formats are all supported.</p>"},{"location":"dictformats/#local-dictionaries-sources","title":"Local Dictionaries Sources","text":"<ul> <li>MDict dictionaries (.mdx/.mdd)</li> <li>StarDict dictionaries (.ifo/.dict./.idx/.syn)</li> <li>DSL dictionaries (ABBYY Lingvo source files .dsl(.dz))</li> <li>XDXF dictionaries (.xdxf(.dz))</li> <li>Zim dictionaries (.zim)</li> <li>Slob (Aard 2) dictionaries (.slob)</li> <li>DictD dictionaries (.index/.dict(.dz))</li> <li>Epwing dictionaries</li> <li>Aard Dictionary dictionaries, outdated predecessor of Slob (.aar)</li> <li>SDictionary dictionaries (.dct)</li> <li>Babylon glossary builder source files (.gls(.dz))</li> <li>Babylon dictionaries, complete support with images and resources (.BGL)</li> <li> <p>ABBYY Lingvo sound archives (.lsa/.dat)</p> </li> <li> <p>Sound files in separate folders. File names are used as word</p> </li> <li>Zipped sound pack. Sound files zipped, but with extension changed from .zip to (.zips)</li> </ul>"},{"location":"dictformats/#network-sources","title":"Network Sources","text":"<ul> <li>Wikipedia and Wiktionary</li> <li>DICT protocol</li> <li>LinguaLibre/Forvo pronunciations</li> <li>Any sites which allow set target word in address line</li> </ul>"},{"location":"dictformats/#other-sources","title":"Other Sources","text":"<p>Various special \"dictionaries\" can be added, such as Programs, TTS, Morphology, Transliteration, etc... Their doc located at Sources Management</p>"},{"location":"dictformats/#additional-info","title":"Additional info","text":""},{"location":"dictformats/#converting-between-formats","title":"Converting between formats","text":"<p>GoldenDict-ng does not provide any dictionary modification functionality.</p> <p>To convert between formats, try tools like pyglossary.</p>"},{"location":"dictformats/#individual-dictionary-icons","title":"Individual Dictionary Icons","text":"<p>Every local dictionary can have individual icon. BMP, PNG, JPG or ICO files can be used for this icon.</p> <p>For Babylon, StarDict, DictD, ABBYY Lingvo, AardDictionary, SDictionary, Zim, MDict, Lsa, Zips, Slob, Gls dictionaries such graphics file must be named by main dictionary file name and places beside one. That is if main file of your dictionary, for example, named \"My_best_dictionary.dsl\" therefore icon file must be named \"My_best_dictionary.bmp\" (.png, .jpg etc.).</p> <p>For XDXF dictionaries, the icon file must be named \"icon16.png\" (for 16\u044516 images) or \"icon32.png\" (for 32\u044532 images) or \"dict.bmp\" and placed into the dictionary folder.</p> <p>For Epwing dictionaries icon file must be named by name of folder with dictionary data beside \"catalogs\" file (a few folders can be presented, every folder is separate dictionary) and placed beside \"catalogs\" file.</p> <p>If individual icon is not presented the default icon for this type of dictionaries will be used.</p>"},{"location":"dictformats/#stardict","title":"Stardict","text":"<p>Main file of Stardict dictionary (.dict) can be compressed by Dictzip program to reduce its size.</p> <p>Additional dictionary resources (images, style sheets, etc.) placed in \"res\" folder also can be compressed into zip archive. This archive must be named \"res.zip\" and placed beside other dictionary files or inside \"res\" folder.</p>"},{"location":"dictformats/#abbyy-lingvo-dsl","title":"ABBYY Lingvo (.dsl)","text":"<p>Main file of ABBYY Lingvo dictionary (.dsl) can be compressed by Dictzip program to reduce its size.</p> <p>Additional dictionary resources (images, sound files, etc.) also can be compressed into zip archive. This archive must be named on main dictionary file name (include extension) with adding \".files.zip\" and placed beside other dictionary files. If main file of your dictionary, for example, named \"My_best_dictionary.dsl\" therefore archive with resources must be named \"My_best_dictionary.dsl.files.zip\".</p> <p>GoldenDict supports the \"#SOUND_DICTIONARY\" directive. Sounds missing in the resources of the dictionary will be searched first in the dictionary specified in this directive.</p>"},{"location":"dictformats/#dictd-and-xdxf-compression","title":"DictD and XDXF compression","text":"<p>Main file of DictD dictionary (.dict) or XDXF dictionary (.xdxf) can be compressed into <code>*.dict.dz</code> or <code>*.xdxf.dz</code> by Dictzip program to reduce its size.</p>"},{"location":"dictformats/#slob","title":"Slob","text":"<p>GoldenDict can render TeX formulas when a slob dictionary bundles MathJax.</p>"},{"location":"dictformats/#gls","title":"GLS","text":"<p>Main file of Babylon source dictionary must be in UTF-8 (or UTF-16 with BOM) encoding. It can be compressed by Dictzip program to reduce its size. Golden Dict read from dictionary header \"### Glossary title:\", \"### Author:\", \"### Description:\", \"### Source language:\" and \"### Target language:\" fields only. Dictionary header must be concluded with \"### Glossary section:\" mark.</p>"},{"location":"dictformats/#abbyy-lingvo-sound-archives","title":"ABBYY Lingvo sound archives","text":"<p>ABBYY Lingvo sound archives are set of sound files packed into one file of some specific format. These files can be called directly from matches list or from dictionary articles.</p>"},{"location":"dictformats/#sound-files-in-separate-folders","title":"Sound files in separate folders","text":"<p>The separate folder with sound files can be added into GoldenDict dictionaries list. GoldenDict will handle this folders like ABBYY Lingvo sound archives (inapplicable in portable mode).</p>"},{"location":"dictformats/#zips-sound-packs","title":"Zips sound packs","text":"<p>Zips sound pack is zip archive with extension \".zips\" contains set of sound files. To create suck pack it needs to compress sound files into zip archive and change extension of this archive to \".zips\". GoldenDict will handle such sound packs like ABBYY Lingvo sound archives.</p>"},{"location":"dictformats/#general-notes","title":"General notes","text":"<p>At every launch GoldenDict scan folders with dictionaries to create dictionaries list. The more files in these folder is the more time for scanning. Therefore it is recommended to compress dictionary resources into zip archives and to use Zips sound packs instead of sound files in separate folders.</p>"},{"location":"feedbacks/","title":"Report Bugs & Feedbacks","text":""},{"location":"feedbacks/#suggestions-ideas","title":"Suggestions & Ideas","text":"<p>Send them to Discussions</p>"},{"location":"feedbacks/#bugs","title":"Bugs","text":"<p>Report any bugs & dysfunctions to issues list</p> <p>Attach your version info in menu \"About\" -> \"Copy version info\".</p> <p>GoldenDict-ng can be started with \"--log-to-file\" that will creates \"gd_log.txt\" in configuration folder and store various warnings, errors and debug messages.</p> <p>On windows, try open command line and starts goldendict with <code>goldendict --log-to-file</code>.</p> <p>If certain dictionary lead to problems, please attach the dict files in bug reports.</p>"},{"location":"feedbacks/#linuxsystemd","title":"Linux/Systemd","text":"<p>Most distros with systemd have systemd-coredump service enabled. Attach a core dump if possible.</p> <p>https://wiki.archlinux.org/title/Core_dump#Making_a_core_dump</p>"},{"location":"feedbacks/#macos","title":"macOS","text":"<p>macOS have a built-in crash reporter, copy all the info in the crash window.</p>"},{"location":"install/","title":"Download & Install","text":""},{"location":"install/#download","title":"Download","text":"<p>GoldenDict-ng is available pre-built for Windows and macOS. It is available in a few Linux/Unix repos and FlatHub.</p> <ul> <li>Latest stable version </li> <li>Pre-release test builds.</li> </ul> <p>Because it is open source, you can always build it for yourself.</p>"},{"location":"install/#windows","title":"Windows","text":"<p>Choose either</p> <ul> <li><code>****-installer.exe</code> for traditional installer experience</li> <li><code>****-installer.7z</code> for simply unzip and run experience</li> </ul> <p>If Qt's version is not changed, you can also download a single <code>goldendict.exe</code> and drop it into previous installation's folder (If uncertain, don't do this).</p> <p>Requires Windows 10 (1809 or later).</p>"},{"location":"install/#linux","title":"Linux","text":"<ul> <li>See the right side for available packages in various Linux distros.</li> <li>In Debian 12 and Ubuntu 23.04, <code>goldendict-webengine</code> is available (For later versions it is <code>goldendict-ng</code>).</li> <li>For ArchLinux, pre-built binary is available from archlinuxcn's repo.</li> <li>Gentoo package from PG_Overlay</li> </ul> <p>Minimum supported \"Linux\" version is supposedly the current Ubuntu LTS and Debian's oldstable.</p>"},{"location":"install/#macos","title":"macOS","text":"<p>Uses one of the <code>.dmg</code> installers in the Download.</p> <p>Requires at least macOS 13.</p>"},{"location":"install/#versioning-and-releasing","title":"Versioning and Releasing","text":"<p>This project uses Calendar Versioning: <code>YY.MM.Patch</code>.</p> <p>Releases will tentatively be done twice a year, considering factors like the major releases of Qt and the package freeze dates of Linux distros like Ubuntu.</p>"},{"location":"manage_groups/","title":"Groups","text":"<p>At <code>Edit</code> -> <code>Dictioanries</code> -> <code>Groups</code>, you can create and edit dictionary groups.</p> <p>To add a dictionary into a group, just drag it from the dictionary list into the group window on the right. To remove a dict, just drag it back to the dictionary list. Hold <code>Shift</code> to select a range of dictionaries or hold <code>Ctrl</code> to select multiple dictionaries.</p> <p>Additionally, multiple strategies of automatic grouping are provided:</p> <ul> <li>based on the language info embedded within dictionary files</li> <li>based on the folder structure</li> <li>based on customizable metadata files</li> </ul>"},{"location":"manage_groups/#auto-groups-by-dictionary-language","title":"Auto groups by dictionary language","text":"<p>For formats like DSL, which has embedded language from / to metadata, GoldenDict will use the dictionary's built-in metadata.</p> <p>For other formats, GoldenDict will try to extract languages from the dictionary's name or its file name by finding <code>{id}-{id}</code> pair. The <code>{id}</code> is 2 or 3 letters ISO 639 codes. For example, if a dictionary named <code>some name en-zh</code>, it will be automatically grouped into <code>en-zh</code>.</p> <p>Groups created in this method also include a context menu when right-click the group name, in which you can do additional dictionaries grouping by source or target language and combine dictionaries in more large groups.</p>"},{"location":"manage_groups/#auto-groups-by-folders","title":"Auto groups by folders","text":"<p>Click the \"Group by folders\" will group your dicts based on folder structure.</p> <p>Two dictionaries will be in the same group if their container folder's direct parent is the same.</p> <p></p> <p>For example, the structure below will be auto grouped into two groups:</p> <ul> <li><code>English<>Chinese</code> with <code>Cambridge</code>, <code>Collins</code> and <code>Oxford</code></li> <li><code>English<>Russian</code> with <code>dictA</code>, <code>dictB</code>, <code>Wikipedia_ru</code> and <code>Wikipedia</code></li> </ul> <pre><code>.\n\u251c\u2500\u2500 English<>Chinese\n\u2502 \u251c\u2500\u2500 Cambridge\n\u2502 \u2502 \u251c\u2500\u2500 Cambridge.dict.dz\n\u2502 \u2502 \u251c\u2500\u2500 Cambridge.idx\n\u2502 \u2502 \u251c\u2500\u2500 Cambridge.info\n\u2502 \u2502 \u2514\u2500\u2500 Cambridge.syn\n\u2502 \u251c\u2500\u2500 Collins\n\u2502 \u2502 \u251c\u2500\u2500 Collins.dsl\n\u2502 \u2502 \u2514\u2500\u2500 res.zip\n\u2502 \u2514\u2500\u2500 Oxford\n\u2502 \u251c\u2500\u2500 Oxford.css\n\u2502 \u251c\u2500\u2500 Oxford.mdd\n\u2502 \u2514\u2500\u2500 Oxford.mdx\n\u2514\u2500\u2500 English<>Russian\n \u251c\u2500\u2500 dsl\n \u2502 \u251c\u2500\u2500 dictA.dsl\n \u2502 \u2514\u2500\u2500 dictB.dsl\n \u2514\u2500\u2500 zim\n \u251c\u2500\u2500 Wikipedia_ru.slob\n \u2514\u2500\u2500 Wikipedia.zim\n</code></pre> <p>Note that if two groups share the same name but in different folder, then upper level's folder name will be prepended with group name. The Example below will be grouped into <code>epistularum/Japanese</code> and <code>Mastameta/Japanese</code>.</p> <p>More levels of folder nesting are not supported.</p> <pre><code>.\n\u251c\u2500epistularum\n\u2502 \u2514\u2500Japanese <- Group\n\u2502 \u2514\u2500DictA <- Dict Files's container folder\n| \u2514\u2500 DictA Files\n\u251c\u2500Mastameta\n\u2502 \u2514\u2500Japanese <- Group\n| \u2514\u2500DictB <- Dict Files's container folder\n| \u2514\u2500 DictB Files \n</code></pre>"},{"location":"manage_groups/#auto-groups-by-metadatatoml","title":"Auto groups by <code>metadata.toml</code>","text":"<p>Click the \"group by metadata\" will group your dicts based on <code>metadata.toml</code>.</p> <p>The <code>metadata.toml</code> should be placed beside dictionary files. One <code>metadata.toml</code> for each dictionary.</p> <p>The metadata file uses TOML format.</p> <pre><code>categories = [ \"English\", \"Russian\", \"Chinese\" ]\n\n# the following `langfrom` , `langto` fields have not been supported yet.\n[metadata]\nname = \"New Name\"\nlangfrom = \"English\"\nlangto = \"Russian\"\n</code></pre> <p>For example,</p> <pre><code>.\n\u251c\u2500\u2500 Cambridge\n\u2502 \u251c\u2500\u2500 metadata.toml (A)\n\u2502 \u251c\u2500\u2500 Cambridge.idx\n\u2502 \u251c\u2500\u2500 Cambridge.info\n\u2502 \u251c\u2500\u2500 Cambridge.syn\n\u2502 \u2514\u2500\u2500 Cambridge.dict.dz \n\u2514\u2500\u2500 Collins\n \u251c\u2500\u2500 metadata.toml\n \u251c\u2500\u2500 res.zip\n \u2514\u2500\u2500 Collins.dsl (B) \n</code></pre> <p>The content of the metadata <code>(A)</code> is <pre><code>categories = [\"en-zh\", \"\u6c49\u82f1\u8bcd\u5178\"]\n</code></pre></p> <p>The content of the metadata <code>(B)</code> is <pre><code>categories = [\"\u56fe\u7247\u8bcd\u5178\", \"en-zh\", \"\u6c49\u82f1\u8bcd\u5178\"]\n</code></pre></p> <p>The structure above will be auto grouped into three groups:</p> <ul> <li><code>en-zh</code> with <code>Cambridge</code>, <code>Collins</code></li> <li><code>\u56fe\u7247\u8bcd\u5178</code> with <code>Collins</code></li> <li><code>\u6c49\u82f1\u8bcd\u5178</code> with <code>Cambridge</code>,<code>Collins</code></li> </ul> <p>Note: Dictionaries without <code>metadata.toml</code> won't be auto-grouped.</p>"},{"location":"manage_sources/","title":"Sources","text":"<p>Dictionary management dialog can be opened via menu <code>Edit</code> -> <code>Dictionaries</code>.</p> <p>To use local dictionaries, add them via <code>Sources</code> -> <code>Files</code>.</p> <p>To inspect or disable individual dictionaries, go <code>Edit</code> -> <code>Dictionaries</code> -> <code>Dictionaries</code>.</p> <p>If you have too many dictionaries, consider use <code>Groups</code> to manage them.</p>"},{"location":"manage_sources/#files","title":"Files","text":"<p>Here you can add local dictionaries.</p> <p>Press the \"Add\" button and select folders that includes your local dictionaries. To search every subfolders, enable the \"Recursive\".</p> <p>GoldenDict will scan these folders and add found dictionaries into dictionaries list.</p> <p>\"Rescan\" button start forced scan of all folders in list.</p>"},{"location":"manage_sources/#sound-dirs","title":"Sound Dirs","text":"<p>Similar to Files, you can either add a folder which contains sound files or a <code>.zip</code> archive which contains the sound files.</p> <p>GD will search through the sound file names when querying words.</p>"},{"location":"manage_sources/#morphology","title":"Morphology","text":"<p>A word could have several forms, but sometimes a dictionary only contains one form that could not be found unless you search the normalized form.</p> <p>Morphology dictionary uses Hunspell's morphological analysis to obtain word's variant forms.</p> <p>You can specify a path that includes Hunspell format data files (<code>.aff</code> + <code>.dic</code>). GoldenDict scan this folder and create a list of available dictionaries.</p> <p>One possible source of Hunspell dictionaries is LibreOffice's dictionaries.</p> <p>The detailed document about the affix file (<code>.aff</code>) and the dict file (<code>.dic</code>) can be found at hunspell.5.</p> <p>Note that lots of Hunspell's dictionaries are for mostly for spell checking, and they may lack special morphological rules (For example, related words don't share the same stem in <code>.dic</code> file). There are some specially tailored hunspell dicts to use for Morphology. Such as</p> <ul> <li>https://sourceforge.net/projects/goldendict/files/better%20morphologies/1.0/</li> <li>https://github.com/Ajatt-Tools/hunspell-ja</li> </ul>"},{"location":"manage_sources/#websites","title":"Websites","text":"<p>Here you can add any website which allow to set target word in url. To add such site you should set it url with target word template, name for dictionaries list and set mark in \"Enabled\" column. In the \"Icon\" column you can set custom icon for this site. If you add icon file name without path GoldenDict will search this file in configuration folder. \"As link\" column define method of article insertion into common page. If this option is set article will be inserted as link inside <code><iframe></code> tag (preferable mode). If articles are not loaded in this mode turn this option off, then articles will be inserted as html-code.</p> <p>Target word can be inserted into url in next encodings::</p> Target word template Encoding %GDWORD% UTF-8 %GD1251% Windows-1251 %GDISO1% ... %GDISO16% ISO 8859-1 ... ISO 8859-16 respectively %GDBIG5% Big-5 %GDBIG5HKSCS% Big5-HKSCS %GDGBK% GBK and GB 18030 %GDSHIFTJIS% Shift-JIS"},{"location":"manage_sources/#dict-servers","title":"DICT servers","text":"<p>Here you can add servers which uses DICT protocol. To add such server you should set its url, name for dictionaries list, server bases list, search strategies list and set mark in \"Enabled\" column. If bases list is empty GoldenDict will use all server bases. If search strategies list is empty GoldenDict will use \"prefix\" strategy (comparing the first part of the word).</p> <p>In the \"Icon\" column you can set custom icon for every server. If you add icon file name without path GoldenDict will search this file in configuration folder.</p>"},{"location":"manage_sources/#programs","title":"Programs","text":"<p>Here you can add external applications. To add such an application, you should set the command line for its launch, name for the dictionary list and application type.</p> <p>The <code>%GDWORD%</code> in command line will be replaced by word from search line.</p> Program type Purpose Audio Play sound. Text Text printed by the program will be shown as separate article. HTML HTML printed by the program Will be shown as separate article. Prefix match A list of words printed by the program will be added to search bar's completion list. <p>Other than \"Audio\", the program should print the content to standard output.</p> <p>In the \"Icon\" column, you can set a custom icon for every application. If you add icon file name without a path, GoldenDict will search this file in the configuration folder.</p> <p>Note</p> <p>The word will be written to <code>stdin</code> in UTF-8 if the command line doesn't contain <code>%GDWORD%</code>.</p> <p>In rare situations on Windows, some programs may not read <code>stdin</code> as UTF-8. In this case, you need to do some adjustments.</p> <p>For Python3.6+, reading <code>stdin</code> as UTF-8 is the default behaviour. For older versions, you may need to change PYTHONIOENCODING.</p> <p>For Node.js, try <code>process.stdin.setEncoding('utf8');</code>.</p> <p>If you cannot change how your language handles stdin's encoding, try store the data read from the <code>stdin</code> as bytes and call related methods that interpret bytes as UTF-8 strings.</p> <p>If you cannot access the source code, try enable \"Beta: Use Unicode UTF-8 for worldwide language support.\" in Windows settings.</p>"},{"location":"manage_sources/#transliteration","title":"Transliteration","text":"<p>Here you can add transliteration algorithms. To add algorithm into dictionaries list just set mark beside it. When such dictionary added into current dictionaries group GoldenDict will search word in the input line as well as result of its handling by corresponding transliteration algorithm.</p>"},{"location":"manage_sources/#system-text-to-speech-engines","title":"System Text-to-speech engines","text":"<p>Its capability is provided via Qt Speech.</p> <p>On Windows & macOS, the system provides sounds.</p> <p>On Linux, speech-dispatcher and flite are the backends.</p>"},{"location":"topic_anki/","title":"Anki Integration","text":""},{"location":"topic_anki/#prerequisite","title":"prerequisite","text":"<ol> <li>install anki</li> <li>install ankiconnect</li> </ol>"},{"location":"topic_anki/#configure-anki","title":"configure anki","text":""},{"location":"topic_anki/#1-create-a-new-model-or-use-an-existing-model","title":"1. create a new model, or use an existing model","text":"<p>For example, the model could have <code>Front</code> and <code>Back</code> fields.</p> <p></p>"},{"location":"topic_anki/#2-configure-the-template","title":"2. configure the template","text":"<p>the front template</p> <p> the back template</p> <p></p>"},{"location":"topic_anki/#configure-goldendict","title":"configure goldendict","text":""},{"location":"topic_anki/#1-through-toolbarpreferencenetwork","title":"1. through toolbar=>preference=>network","text":"<ul> <li>Word - Vocabulary headword.</li> <li>Text - Selected definition.</li> <li>Sentence - Search string. You can leave it blank.</li> </ul> <p>Example for adding Japanese sentences: </p>"},{"location":"topic_anki/#2-action","title":"2. action","text":""},{"location":"topic_anki/#3-result","title":"3. result","text":"<p>Word and definition: </p> <p>Sentence, word, and definition: </p>"},{"location":"topic_anki/#using-uri-schemes","title":"Using URI schemes","text":"<p><code>goldendict://word</code> link can be use to query a word directly on GoldenDict-ng.</p> <p>On your Anki card's template, you can add the code below to have a \"1 click open in GoldenDict-ng\" card.</p> <pre><code><a href=\"goldendict://{{Front}}\">{{Front}}</a>\n</code></pre> <p>Note that this feature doesn't available on macOS </p>"},{"location":"topic_commandline/","title":"Command Lines","text":"<p>You can send word to mainwindow to popup via <code>goldendict <word></code>.</p>"},{"location":"topic_commandline/#command-line-options","title":"Command Line Options","text":"<pre><code>Usage: goldendict [options] [word]\n\nOptions:\n-h, --help Displays help on commandline\noptions.\n--help-all Displays help including Qt specific\noptions.\n-l, --log-to-file Save debug messages to gd_log.txt in\nthe config folder.\n-g, --group-name <groupName> Change the group of main window.\n-p, --popup-group-name <popupGroupName> Change the group of popup.\n\nArguments:\nword Word or sentence to query.\n</code></pre>"},{"location":"topic_flatpak/","title":"Flatpak/FlatHub","text":"<p>Flatpak is a software platform that runs on top of Linux. It has idiosyncrasies by design.</p> <p>This page provides some solutions to work with flatpak. Exactly how to use Flatpak needs to refer Flatpak's documentation</p> <p>These solutions use Flatseal, but directly using the <code>flatpak</code> command or KDE's flatpak-kcm works as well.</p> <p>Note</p> <p>Feel free to add new solutions by clicking the edit button on the top right.</p>"},{"location":"topic_flatpak/#add-external-programs","title":"Add external programs","text":"<p>Problem: Apps inside Flatpak cannot run programs on the host system directly.</p> <p>Solution: Use <code>flatpak-spawn --host</code>.</p> <p>First, add <code>org.freedesktop.Flatpak</code> to allowed session bus.</p> <p></p> <p>Then add application like <code>flatpak-spawn --host --directory=${the external program's pwd will be set to this value} ${The actual commands}</code>.</p> <p>For example, Translate Shell can be added to GoldenDict as <code>flatpak-spawn --host --directory=. trans -no-ansi %GDWORD%</code>.</p>"},{"location":"topic_flatpak/#uses-fixed-paths-instead-of-runuser1000doc","title":"Uses fixed paths instead of <code>/run/user/1000/doc/...</code>","text":"<p>Apps inside Flatpak don't have direct access to filesystem by default. A directory selected in file chooser will be exported to app as <code>/run/user/1000/doc/...</code>. The exported directories can be listed with <code>flatpak documents --columns=id,origin,application</code></p> <p>If you want to use fixed paths instead, just grant GolenDict either the whole file system, the whole home or a specific path.</p> <p>Note that some special paths in the host system like <code>\\tmp</code> cannot be accessed by flatpak apps in any way.</p> <p></p>"},{"location":"topic_move_index_folder/","title":"Move index folder","text":"<p>How to move the default index folder to other places?</p>"},{"location":"topic_move_index_folder/#windows","title":"Windows","text":"<p>Note</p> <p>the <code>mklink</code> is built-in tool in Windows.</p> <ol> <li>Open <code>cmd</code> as administrator</li> <li>copy the index folder to another place,take <code>D:\\gd-ng\\index_new</code> for example.</li> <li>Run <code>mklink /D \"C:\\Users\\USERNAME\\Application Data\\GoldenDict\\index\" \"D:\\gd-ng\\index_new\"</code></li> <li>Run GoldenDict</li> </ol>"},{"location":"topic_move_index_folder/#linux","title":"Linux","text":"<p>use <code>ln</code> to create a link.</p>"},{"location":"topic_portablemode/","title":"Portable mode","text":"<p>Usually GoldenDict store all program settings and dictionary indexes in home folder of current user. In portable mode program settings and dictionary indexes stored in <code>portable</code> folder beside the main program file. This mode suit for using of GoldenDict with common settings directly from flash drive on different computers.</p> <p>To turn on portable mode it needs only create <code>portable</code> folder beside the main program file. If such folder exists GoldenDict will launched in portable mode.</p> <p>In portable mode GoldenDict works with some limitations:</p> <p>You can't select folders with dictionaries. All dictionaries should be placed in <code>content</code> folder beside the main program file and/or its subfolders. You can't use sound files in separate folders.</p>"},{"location":"topic_transliteration/","title":"Custom Transliteration","text":"<p>This will enable users to configure their own transliteration if the provided transliteration can not meet the requirements.</p> <p></p> <p>This is the result after configured <code>ae;\u00e6</code></p> <p></p>"},{"location":"topic_userstyle/","title":"Custom Stylesheet & JavaScript","text":"<p>By creating <code>article-style.css</code> or <code>article-script.js</code> in GoldenDict's configuration folder (beside the <code>config</code> file), you can change dictionaries' presentation or inject javascript to dictionaries.</p> <pre><code>. <- GD's configuration folder\n\u251c\u2500\u2500 config\n\u251c\u2500\u2500 article-style.css\n\u251c\u2500\u2500 article-style-print.css (affecting styles when printing)\n\u251c\u2500\u2500 article-script.js\n\u2514\u2500\u2500 qt-style.css\n</code></pre> <p>The <code>article-style.css</code> is just standard HTML Style Sheets. To know class or id names used in article, you can open inspector by right click article's body and click <code>Inspect (F12)</code>. The inspector's documentation can be found at Chrome DevTools</p> <p>You can adjust dark reader mode's parameter by add those lines to <code>article-script.js</code></p> <pre><code>DarkReader.enable({\n brightness: 100,\n contrast: 100,\n sepia: 0,\n grayscale: 0,\n});\n</code></pre> <p>Also, you can tune GoldenDict's interface by creating <code>qt-style.css</code> style sheet file in GoldenDict configuration folder. It is a Qt Style Sheet loaded during startup.</p> <p>Samples of <code>article-style.css</code> and <code>qt-style.css</code> files can found in GoldenDict's source code at /src/stylesheets</p>"},{"location":"topic_userstyle/#addon-styles","title":"\"Addon\" Styles","text":"<p>Under GoldenDict's configuration folder, you can create a \"styles\" folder for \"Addon\" styles, so that you can switch between multiple <code>article-style.css</code> and <code>qt-style.css</code>.</p> <p>Folder structure like below will create two \u201caddon\u201d styles to switch in settings -> appearances.</p> <pre><code>. <- GD's configuration folder\n\u251c\u2500\u2500 config\n\u2514\u2500\u2500 styles\n \u251c\u2500\u2500 dark\n \u2502 \u251c\u2500\u2500 article-style.css\n \u2502 \u2514\u2500\u2500 qt-style.css\n \u2514\u2500\u2500 light\n \u251c\u2500\u2500 article-style.css\n \u2514\u2500\u2500 qt-style.css\n</code></pre>"},{"location":"topic_wayland/","title":"Wayland","text":"<p>Environment variable <code>GOLDENDICT_FORCE_WAYLAND</code> can be used to force GD to run in Wayland mode, like <code>env GOLDENDICT_FORCE_WAYLAND=1 goldendict</code>.</p> <p>Don't use unless you know!</p> <p>This flag only guarantees GD to run in wayland mode and won't crash, but nothing more.</p> <p>Enable this will break popup, global hotkeys and probably other things.</p>"},{"location":"topic_wayland/#current-reality","title":"Current reality","text":"<p>Help wanted</p> <p>Need help to redesign popup for wayland.</p> <p>Popup is implemented with <code>querying mouse cursor's position</code> and <code>setting a window's absolute global position</code>. Wayland does not support both by design and philosophy.</p> <p>Wayland does not support registering global hotkeys until very recently, but a reasonable wayland desktop environment should provide some way to bind keys to commands globally.</p>"},{"location":"ui_favorites/","title":"Favorites","text":"<p>Favorites is a hierarchical structure of folders and headers in them. Folders can be bound to specific groups of dictionaries. The folder is bound to the group if it is specified in the settings of the corresponding group. The headwords opened in that group will be stored to this folder. Accordingly headwords from this folder will be opened in that group. If the folder is not bound to any group of dictionaries then headwords from it will be opened in the current group.</p> <p>Favorites allows you to create folders manually via context menu, to move/add items to them simply by dragging and dropping as well as to delete selected items via context menu or by pressing the \"Del\" key.</p> <p>In addition to adding and removing items to/from the Favorites you can perform the following operations via context menu or the main menu:</p> <ul> <li>\"Export\" - the Favorites contents will be exported to the specified XML file while preserving the entire structure.</li> <li>\"Export to plain list\" - all headwords stored in the Favorites will be saved to the specified text file as plain list without saving the folder structure.* * \"Import\" - the current contents of the Favorites will be replaced by the contents of the specified XML file.</li> </ul>"},{"location":"ui_fulltextsearch/","title":"Full Text Search","text":"<p>The full-text search dialog can be opened via menu \"Search\" or \"Ctrl+Shift+F\".</p> <p>Full-text search allow to search words or sentences not in dictionary headwords but in articles text of dictionaries from current dictionaries group.</p> <p></p> <p>Type the desired word in \"Search line\" to search.</p> <p>Search modes</p> <ul> <li>\"Default\" \u2014 This follows the xapian search syntax. </li> <li>\"Wildcards\" - xpaian \"wildcard\" mode, which means it only supports the prefix wildcards like \"hell*\"(in English alike language).As CJK use NGRAM term generator,the <code>*</code> should be treated as a seperator while not quoted.</li> </ul> <p>\"Available dictionaries in group\" - here you can view how many dictionaries in the current group are suitable for full-text search, how many dictionaries already indexed and how many dictionaries wait for indexing.</p> <p>When you place mouse cursor over headword in results list, the tooltip with dictionary list contains such articles matched the search conditions will be shown.</p> <p>Note</p> <p>The dictionary will index for full-text search in background and started immediately after program start, name of the currently indexing dictionary is displayed in the status line. This process can take a long time and require many computing resources.You may turn off indexing for huge dictionaries like Wikipedias or Wiktionaries in preferences. To find dictionary which can't be indexed check GoldenDict with <code>--log-to-file</code> or check <code>stdout</code>.</p>"},{"location":"ui_headwords/","title":"Headwords Dialog","text":"<p>View the unique headwords list for local dictionary.</p> <p></p> <p>The headwords dialog can be opened via:</p> <ul> <li>context menu of dictionaries list</li> <li>context menu of icon on dictionaries bar in GoldenDict toolbar</li> <li>context menu of dictionaries list in navigation pane</li> </ul> <p>The filter line allow to filter dictionaries list to remain only necessary headwords. Such filtration can be completed in next modes:</p> Mode Filtration type Plain text Headword contains string from filter line. Wildcards Headword matched to Unix-like template from filter line. Such template can contain wildcard symbols <code>?</code> (matches any one character), <code>*</code> (matches any characters number) or ranges of characters <code>[...]</code> To find characters <code>?</code>, <code>*</code>, <code>[</code> and <code>]</code> it should be escaped by backslash - <code>\\?</code>, <code>\\*</code>, <code>\\[</code>, <code>\\]</code>. RegExp Headword matched to regular expression from filter line. <p>If option \"Auto apply\" is turned on any changes in filter line will be applied to headwords list immediately. Otherwise you should press \"Apply\" button to apply changes. If dictionary contains more than 150000 headwords the \"Auto apply\" option is disabled.</p> <p>If option \"Match case\" is turned on the matches search will be completed in the case-sensitive mode, otherwise in case-insensitive mode.</p> <p>The \"Export\" button allow to export the filtered headwords list to text file.</p> <p>Press \"Ctrl+N\" shortcut if you want to switch focus to main GoldenDict window. Press \"Ctrl+D\" to switch focus from main window to headwords dialog.</p>"},{"location":"ui_popup/","title":"Popup Window","text":"<p>Popup is a mini window for rapid translation.</p> <p>Enable it by clicking the \ud83d\udca1 (enable clipboard trakcing) on the toolbar or using the context menu of tray icon.</p> <p>A popup window will show up when copying text.</p>"},{"location":"ui_popup/#linux","title":"Linux","text":"<p>On linux/X11, the text selection can also trigger popup window. You have to enable it in preferences.</p>"},{"location":"ui_popup/#ocr","title":"OCR","text":"<p>See How to use GoldenDict with OCR.</p>"},{"location":"ui_shortcuts/","title":"Shortcuts","text":"Shortcut Action Alt++ Increase font size for matches list Alt+\u2013 Decrease font size for matches list Alt+0 Restore default font size for matches list Alt+Left, Backspace (In main and popup windows) history navigation: show previous founded results Alt+Right (In main and popup windows) history navigation: show next founded results Alt+Down Jump to article from next dictionary Alt+Up Jump to article from previous dictionary Alt+Enter, Ctrl+Enter (Search line) Show translation in new tab Alt+D, Ctrl+L (In main and popup windows) go to search line Alt+G (In main and popup windows) choose dictionaries group from group list Alt+S (In main and popup windows) playback pronunciation for current word Alt+W (In popup window) transfer word from search line to main window Alt+PgDown (In main and popup windows) switch to next dictionaries group Alt+PgUp (In main and popup windows) switch to previous dictionaries group Ctrl++ Increase articles font size Ctrl+\u2013 Decrease articles font size Ctrl+0 Set default articles font size Ctrl+MouseWheel Increase/decrease articles font size Ctrl+A Select all articles in current page Ctrl+C Copy selected Ctrl+D Switch to dictionary headwords dialog (if it is open) Ctrl+E Add current tab to Favorites Ctrl+F4 (Main window) minimize to system tray Ctrl+F5 Rescan dictionaries Ctrl+F (In main and popup windows) search in page / (In dictionaries dialog) go to filter line Ctrl+H Show/hide history pane Ctrl+I Show/hide Favorites pane Ctrl+M Show/hide main menu Ctrl+N (In dictionary headwords dialog and full-text search dialog) switch to main window Ctrl+O Above all windows Ctrl+P (In main window) print current article Ctrl+Q (In main window) close GoldenDict Ctrl+R Show/hide results pane Ctrl+S Show/hide search pane Ctrl+T (In main window) create new tab Ctrl+W (In main window) close current tab Ctrl+PgDown (In main window) switch to next tab Ctrl+PgUp (In main window) switch to previous tab Ctrl+Tab (In main window) switch to next tab (can be changed in preferences) Ctrl+Shift+A Select current article only Ctrl+Shift+C Copy selected as text Ctrl+Shift+F Open/switch to full-text search dialog Ctrl+Shift+W Close all tabs Ctrl+Shift+S Stop current playing sound Del (History) delete select line Enter (In main window) go to search line Esc (In main window) go to search line (the action for Esc key can be changed in preferences) / (in popup window) close popup window F1 GoldenDict reference F2 (In main window) save current page to html F3 Dictionaries dialog F4 GoldenDict preferences F12 Inspector"},{"location":"ui_toolbar/","title":"Tool & Dictionary Bar","text":""},{"location":"ui_toolbar/#toolbar","title":"Toolbar","text":"<p>Type your word in Search Box and press <code>Enter</code> to search word in the current selected group. You can also choose a variant from a matches list.</p> <p>Holding Ctrl or Shift will display the translation result in a new tab.</p>"},{"location":"ui_toolbar/#wildcard-matching","title":"Wildcard matching","text":"<p>The search line can use wildcard or glob symbols for matching words. </p> Wildcard Description <code>?</code> Matches any single character. <code>*</code> Matches zero or more of any characters. <code>[abc]</code> Matches one character given in the bracket. <code>[a-c]</code> Matches one character from the range given in the bracket. <code>[!abc]</code> Matches one character that is not given in the bracket. <code>[!a-c]</code> Matches one character that is not from the range given in the bracket. <code>\\</code> Escaping wildcard symbols, e.g. <code>\\?</code> to search <code>?</code> <p>Note</p> <p>The wildcard symbol in the first character leads to scanning of every dictionary's every word and may take a long time.</p> <p>More information about wildcard matching can be found in Wikipedia's glob article.</p>"},{"location":"ui_toolbar/#dictionary-bar","title":"Dictionary Bar","text":"<p>The dictionary bar contains all dictionaries from the current dictionaries group. Click the icons to disable/enable them.</p>"},{"location":"ui_toolbar/#solo-mode","title":"\"Solo\" mode","text":"<p>Temporally focus on a single dictionary and restore back to all dictionaries or previously selected dictionaries.</p> <p>To enter solo mode:</p> <p>Ctrl+Left Button -> Select a single dictionary.</p> <p>To exit solo mode:</p> <p>Ctrl+Left Button -> Reselect all dictionaries.</p> <p>Shift+Left Button -> Reselect dictionaries that were previously selected before entering solo mode.</p> <p>For example, there are 4 dictionaries A,B,C,D with ABC selected.</p> Cases Note Ctrl+Click A select A only Ctrl+Click A, Ctrl+Click B select B only Ctrl+Click A, Ctrl+Click A A,B,C,D selected (all dictionaries selected) Ctrl+Click A, Shift+Click any dictionary A,B,C selected <p>Note: This can also be used on the \"Found in dictionaries\" panel.</p>"},{"location":"howto/build_from_source/","title":"Build from source","text":"<p>The <code>release-*</code> and <code>PR-check-*</code> workflow files under <code>.github</code> in the source code has actual build & commands for reference.</p>"},{"location":"howto/build_from_source/#dependencies","title":"Dependencies","text":"<ul> <li>C++17 compiler (For windows it must be MSVC)</li> <li>Latest QT6</li> </ul> <p>For debian/ubuntu, those packages are needed</p> <pre><code>libavformat-dev libavutil-dev libbz2-dev libeb16-dev libhunspell-dev \\\nliblzma-dev liblzo2-dev libopencc-dev libvorbis-dev \\ \nlibx11-dev libxtst-dev libzim-dev libzstd-dev qt6-5compat-dev \\\nqt6-base-dev qt6-multimedia-dev qt6-speech-dev qt6-svg-dev \\\nqt6-tools-dev qt6-tools-dev-tools qt6-webchannel-dev \\\nqt6-webengine-dev x11proto-record-dev zlib1g-dev\n</code></pre> <p>In other words, those libraries</p> <ul> <li>ffmpeg</li> <li>libzim</li> <li>xapian</li> <li>hunspell</li> <li>opencc</li> <li>libeb</li> <li>libvorbis</li> <li>x11 (linux only)</li> </ul> <p>And a few compression libraries:</p> <ul> <li>xz (lzma)</li> <li>bzip2</li> <li>lzo2</li> <li>zlib</li> </ul>"},{"location":"howto/build_from_source/#build","title":"Build","text":"<p>Basically, you need those commands:</p> <pre><code>cd goldendict-ng && mkdir build_dir\n# config step\ncmake -S . -B build_dir\n -G \"Ninja\"/\"Unix Makefiles\"/\"Xcode\"... (Optional)\n --install-prefix=/usr/local/ (Optional)\n -DCMAKE_BUILD_TYPE=Release (Optional)\n\n# actual build\ncmake --build build_dir\n --parallel 7 (Optional if Ninja was chosen)\n\ncmake --install ./build_dir/\n</code></pre>"},{"location":"howto/build_from_source/#feature-flags","title":"Feature flags","text":"<p>Append <code>-D{flag_names}=ON/OFF</code> to cmake's config step.</p> <p>Available flags can be found on the top of <code>CMakeLists.txt</code></p>"},{"location":"howto/build_from_source/#windows","title":"Windows","text":"<p>Install Qt6 (MSVC) through Qt Online Installer and add Qt's path to CMake</p> <pre><code>-DCMAKE_PREFIX_PATH=F:\\Qt\\6.4.1\\msvc2019_64\n</code></pre>"},{"location":"howto/build_from_source/#make-the-exe-runable","title":"Make the <code>.exe</code> runable","text":"<p>Call <code>cmake --install {the cmake output folder}</code> will copy all necessary dependencies to correct locations.</p> <p>TODO: (untested) you can also <code>${Qt's install path}\\Qt\\6.5.2\\msvc2019_64\\bin</code> and vcpkg's bin paths to your PATH environment variable</p> <p>Note that using <code>-G Ninja</code> in CMake is assumed to be used. TODO: MSBuild has minor bugs for being \"Multi-Config\".</p>"},{"location":"howto/build_from_source/#vcpkg","title":"Vcpkg","text":"<p>vcpkg is the primary method to build GoldenDict-ng's dependencies.</p> <p>There are a few ways to use it.</p> <p>First, just do nothing. Without any additional CMake config options, a pre-built cached version of vcpkg will be automatically obtained and setup.</p> <p>Second, install vcpkg on your local machine, then set <code>CMAKE_TOOLCHAIN_FILE</code> as described here, which says append <code>-DCMAKE_TOOLCHAIN_FILE={Your vcpkg install location}/scripts/buildsystems/vcpkg.cmake</code> to CMake's config step. Note that this cost long time to build</p>"},{"location":"howto/build_from_source/#macos","title":"macOS","text":"<p>If you build in an IDE, then the created <code>GoldenDict.app</code> will be runnable from the IDE which set up necessary magics for you.</p> <p>To make the <code>.app</code> runnable elsewhere, you can run <code>cmake --install build_dir/</code> which will invoke macdeployqt, ad-hoc code signing and various other things. The produced app will end up in <code>build_dir/redist/goldendict-ng.app</code></p> <p>To create <code>.dmg</code> installer, you have to have create-dmg installed on your machine, then also <code>cmake --install build_dir/</code>.</p>"},{"location":"howto/how%20to%20add%20a%20program%20as%20dictionary/","title":"How to add a program or script to the goldendict-ng","text":"<p>GoldenDict has offered a program dictionary function that allow you to customize the user experience when using the this software.</p>"},{"location":"howto/how%20to%20add%20a%20program%20as%20dictionary/#an-example","title":"An example","text":"<p>tokenize the input german sentence into words.</p>"},{"location":"howto/how%20to%20add%20a%20program%20as%20dictionary/#use-python-script","title":"use python script","text":"<p>You can use any script language or program to implement this feature.</p>"},{"location":"howto/how%20to%20add%20a%20program%20as%20dictionary/#install-python","title":"install python","text":""},{"location":"howto/how%20to%20add%20a%20program%20as%20dictionary/#install-somajo","title":"install SoMaJo","text":"<p>you can follow the instructions in the documentation https://github.com/tsproisl/SoMaJo?tab=readme-ov-file#installation</p> <p><code>pip install -U SoMaJo</code></p>"},{"location":"howto/how%20to%20add%20a%20program%20as%20dictionary/#create-a-script","title":"create a script","text":"<pre><code>from somajo import SoMaJo\nimport sys\n\ntokenizer = SoMaJo(\"de_CMC\", split_camel_case=True)\n\n# note that paragraphs are allowed to contain newlines\nparagraphs = [sys.argv[1]]\nsentences = tokenizer.tokenize_text(paragraphs)\nfor sentence in sentences:\n for token in sentence:\n if token.token_class=='regular':\n print(f\"{token.text}\")\n</code></pre> <p>and save the script in the E:\\test.py for example.</p>"},{"location":"howto/how%20to%20add%20a%20program%20as%20dictionary/#add-the-script-to-the-program-dictionary","title":"add the script to the program dictionary","text":"<p> <code>python e:\\test.py %GDWORD%</code></p>"},{"location":"howto/how%20to%20add%20a%20program%20as%20dictionary/#the-result","title":"the result","text":""},{"location":"howto/how%20to%20customize%20the%20opencc/","title":"Customize the opencc","text":"<p>Under the opencc folder ,these are the opencc configuration files.</p> <p>the following three files are currently been used in GoldenDict. <pre><code>s2tw.json\ns2hk.json\nt2s.json\n</code></pre> - how to specify other configuration files?</p> <ol> <li>create a custom file ,such as custom.txt</li> </ol> <p></p> <ol> <li>modify the *.json file, add add the new custom.txt to the configuration .</li> </ol> <p></p> <ol> <li>search <code>\u4e11</code> in GoldenDict-ng will also show the result of <code>\u7f8e</code></li> </ol> <p>any other valid opencc configuration solutions should also work here.</p>"},{"location":"howto/how%20to%20debug%20dictionary%20js/","title":"Debug dictionary JS","text":""},{"location":"howto/how%20to%20debug%20dictionary%20js/#background","title":"background","text":"<p>When some js functions do not work as expected, this article tries to give a debug solution to pinpoint the problem.</p>"},{"location":"howto/how%20to%20debug%20dictionary%20js/#web-inspector-devtools","title":"Web inspector (DevTools)","text":"<p>GoldenDict-ng has embedded an inspector, which is actually chromium's DevTools. You can trigger it manually using <code>F12</code>.</p> <p>Screenshot: </p>"},{"location":"howto/how%20to%20debug%20dictionary%20js/#navigate-to-the-specified-element","title":"Navigate to the specified element","text":"<p>Click the find element and move mouse to the specified element, click the element will navigate the source panel to the very place. </p>"},{"location":"howto/how%20to%20debug%20dictionary%20js/#modify-the-css-style","title":"Modify the css style","text":"<p>you can play around with the css to modify the appearance of the html and check the results.</p> <p></p>"},{"location":"howto/how%20to%20debug%20dictionary%20js/#check-javascript-events","title":"Check javascript events","text":"<ul> <li>navigate to the specified element</li> <li>check eventlisterner panel</li> <li>pay attention to the click events</li> <li>in the following screenshot ,there are two registered event listeners, one from the goldendict <code>gd-custom.js</code> and one from the html itself.</li> <li>click the above event listener location will locate to the right place in the javascript.</li> </ul> <p>If some desired event does not triggered , it can first check does the event listeners has been successfully registered. then set a breakpoint in the right place to check whether the event has been triggered and if it can executed successfully. </p>"},{"location":"howto/how%20to%20debug%20dictionary%20js/#reproduce-the-issues","title":"Reproduce the issues","text":"<p>following your normal operations and debugging the javascript code and pay attention to the console output. Whether any errors happened. </p>"},{"location":"howto/how%20to%20update%20crowdin.ts%20file/","title":"Update the crowdin.ts file","text":"<p>This project uses crowdin to organize all the transactions.When some new transactions items are added.The crowdin.ts file needs to be updated to reflect the changes. Then crowdin will automatically generate all other transactions in different languages(Though all these translations still need to be translated manually or by Machine Translation).</p>"},{"location":"howto/how%20to%20update%20crowdin.ts%20file/#how-to-update-the-crowdints-file","title":"how to update the crowdin.ts file","text":"<pre><code>lupdate.exe -no-obsolete -no-ui-lines -locations none .\\src\\ -ts .\\locale\\crowdin.ts\n</code></pre> <p>the option <code>-no-obsolete</code> will remove obsolete items from crowdin.ts file.</p> <p>the option <code>-no-ui-lines</code> will not generate line numbers in the crowdin.ts file. The line numbers changes too often which will make too much code changes between commits.</p>"},{"location":"howto/how%20to%20use%20breadpad%20crash%20analysis/","title":"Breadpad crash analysis","text":""},{"location":"howto/how%20to%20use%20breadpad%20crash%20analysis/#introduction","title":"Introduction","text":"<p>GoldenDict-ng has provide an option to build the application with breakpad</p> <p><code>CONFIG+=use_breakpad</code> to enable this feature.</p> <p>Currently only Windows release has built with breakpad support,for other platforms , you can enable the feature manually.</p>"},{"location":"howto/how%20to%20use%20breadpad%20crash%20analysis/#how-to-analyze-the-dump-created-by-breakpad","title":"How to analyze the dump created by breakpad.","text":"<p>When a crash is encountered, a dump file is generated under the folder <code>crash</code>.Take the dump file as <code>a.dmp</code> for following example.</p> <ol> <li><code>dump_syms.exe GoldenDict.pdb > GoldenDict.sym</code> The content of GoldenDict.sym is like this: <pre><code>MODULE windows x86_64 904B2C52C1EC411D9D0271445CAD6DCD2 GoldenDict.pdb\nINFO CODE_ID 645510C96CC000 GoldenDict.exe\n</code></pre></li> <li>create a folder such as <code>symbols</code> and a series of folders like this: <pre><code>GoldDict.exe\na.dmp (A)\nsymbols\n\u2514\u2500GoldenDict.pdb (B)\n \u2514\u2500904B2C52C1EC411D9D0271445CAD6DCD2 (C)\n \u2514\u2500GoldenDict.sym\n</code></pre></li> <li><code>A</code> this is the dump file</li> <li><code>B</code> this is a folder name</li> <li> <p><code>C</code> this folder takes the name from the first line of <code>GoldenDict.sym</code> file</p> </li> <li> <p>anlaysis the dump file like this <pre><code>minidump_stackwalk.exe -s a.dmp symbols > a.txt\n</code></pre></p> </li> <li>check the a.txt file to find the possible crash reason. usually it will point to the actual crash line number of the source code.</li> </ol>"},{"location":"howto/how%20to%20use%20breadpad%20crash%20analysis/#note","title":"Note","text":"<p>The tools can be downloaded from minidump-tools</p>"},{"location":"howto/ocr/","title":"OCR Integration","text":""},{"location":"howto/ocr/#current-situation","title":"Current Situation","text":"<p>GoldenDict offered a functionality to translate the word under cursor on Windows in the past, but the technique used there is old and does not work crossplatformly.</p> <p>However, any OCR program that allows you to set \"after capturing action\" can be easily used in conjunction with GoldenDict.</p> <p>A few examples are provided below, but there are many options:</p>"},{"location":"howto/ocr/#capture2text","title":"Capture2Text","text":"<p>Capture2Text can call executable after capturing, and you can set the executable to GoldenDict.</p> <p>Detailed usage document: Capture2Text</p> <p>Capture2Text Download</p> <p>For example, change the Output action <code>Call Executable</code> to <code>path_to_the_GD_executable\\GoldenDict.exe \"${capture}\"</code></p> <p>Then press Win+Q and select a region. After capturing a word, Capture2Text will forward the word to GoldenDict. If GoldenDict's scanpopup is enabled, it will show up.</p> <p></p> <p>The hotkeys can be configured:</p> <p></p> <p>Capture2Text can also obtain word near cursor without selecting a region via the \"Forward Text Line Capture\" by pressing Win+W <p>you may want to enable \"First word only\" so that only a single word would be captured</p> <p></p>"},{"location":"howto/ocr/#use-capture2text-on-linux","title":"Use Capture2Text on Linux","text":"<p>Capture2Text does not have Linux version, but I have ported it to Linux https://github.com/xiaoyifang/Capture2Text thanks to Capture2Text Linux Port and sikmir.</p> <p></p>"},{"location":"howto/ocr/#shortcutsapp-apples-ocr","title":"Shortcuts.app & Apple's OCR","text":"<p>Enable the Clipboard monitoring of GoldenDict, then create a \"Shorcut\" that will interactively take screnshot and change the clipboard.</p> <p></p> <p>You may also add additional capiblities like only getting the first word</p> <p></p>"},{"location":"howto/ocr/#tesseract-via-command-line","title":"Tesseract via command line","text":"<p>On Linux, you can combine command line screenshot then pass the output image to Tesseract then pass the text result to <code>goldendict</code></p> <p>Example with spectacle (KDE) and grim (wayland/wlroots)</p> <pre><code>#!/usr/bin/env bash\n\nset -e\n\ncase $DESKTOP_SESSION in\n sway)\n grim -g \"$(slurp)\" /tmp/tmp.just_random_name.png\n ;;\n plasmawayland | plasma)\n spectacle --region --nonotify --background \\\n --output /tmp/tmp.just_random_name.png\n ;;\n *)\n echo \"Failed to know desktop type\"\n exit 1\n ;;\nesac\n\n# note that tesseract will apppend .txt to output file\ntesseract /tmp/tmp.just_random_name.png /tmp/tmp.just_random_name --oem 1 -l eng\n\ngoldendict \"$(cat /tmp/tmp.just_random_name.txt)\"\n\nrm /tmp/tmp.just_random_name.png\nrm /tmp/tmp.just_random_name.txt\n</code></pre>"}]} |