Ciyue Documentation

repository·main·Indexed 20 days ago

https://github.com/mumu-lhl/ciyue

A multi-platform dictionary application for Android, Windows, and Linux supporting mdict formats (MDX/MDD). Features include multi-dictionary search, Material You design, audio playback, bookmarking, and AI-powered translation and writing checks via providers like OpenAI, Gemini, and Deepseek.

Tokens
12.5K
Snippets
44
Records
57
Agent score
69%

What's inside Ciyue

  1. Overview of Ciyue

    main

    Ciyue is a dictionary application that supports mdict formats across Android, Windows, and Linux. It allows users to search and display multiple dictionaries simultaneously and supports advanced features like AI translation and text-to-speech.

    Key Features

    • MDX/MDD Support: Supports MDX and MDD dictionary formats (Note: MDD support is currently unavailable on Linux).
    • Multi-Dictionary Search: Search across multiple dictionaries at once.
    • AI Translation: Integration with AI providers such as OpenAI, Gemini, and Deepseek.
    • Material You: Supports Material You design principles.
    • Text-to-Speech: Built-in support for reading words aloud.
    • Wordbook: Ability to bookmark and save words to a personal wordbook.
  2. Overview of Ciyue features

    main

    Ciyue is an mdict dictionary application with support for Android, Windows, and Linux. Key features include:

    • Dictionary Support: Supports MDX/MDD formats (Note: MDD support is currently unavailable on Linux).
    • Multi-Dictionary Search: Ability to search and display results from multiple dictionaries simultaneously.
    • AI Translation: Integration with third-party AI providers such as OpenAI, Gemini, and Deepseek.
    • UI/UX: Supports Material You design.
    • Audio: Support for reading aloud.
    • Bookmarking: Ability to bookmark words to a personal word book.
  3. Understand Ciyue's INTERNET permission requirement

    main

    Ciyue requires the INTERNET permission for the following reasons:

    1. WebView Rendering: Ciyue uses WebView to display dictionary entries. WebView requires internet permission to function correctly, even when displaying purely local data.
    2. Updates & Services: The permission is used when checking for application updates or communicating with third-party services, such as AI Translation providers.

    Note: Ciyue does not independently initiate network requests outside of these specific contexts.

  4. Use flutter_inappwebview_linux in your project

    main

    This package is an endorsed federated plugin implementation of flutter_inappwebview for Linux using WPE WebKit.

    Because it is an endorsed plugin, you do not need to manually add flutter_inappwebview_linux to your pubspec.yaml if you are only using the standard flutter_inappwebview API. The plugin will be automatically included in your Linux build when you depend on flutter_inappwebview.

    Note: If you need to import this specific package to access its Linux-specific APIs directly, you must add it to your pubspec.yaml manually.

    dependencies:
      flutter_inappwebview: ^latest_version
      # Only add the line below if you are importing flutter_inappwebview_linux directly
      # flutter_inappwebview_linux: ^latest_version
  5. Configure KOReader on Android to use Ciyue

    main

    To integrate Ciyue with KOReader on Android, you must create a dictionaries.lua file within the koreader directory. This file tells KOReader how to communicate with the Ciyue app using the package name org.eu.mumulhl.ciyue and the send action.

    {
        { "Ciyue", "Ciyue", false, "org.eu.mumulhl.ciyue", "send" }
    }
  6. Use LinuxHttpAuthCredentialDatabase for secure credential storage

    main

    On Linux, LinuxHttpAuthCredentialDatabase provides a way to store and manage HTTP authentication credentials securely. It delegates to native C++ code using libsecret, meaning passwords are stored in the system keyring (such as GNOME Keyring or KDE Wallet).

    Storage Details:

    • Passwords: Stored securely in the system keyring.
    • Enumeration: A JSON index file is maintained at ~/.local/share/flutter_inappwebview/<appId>/credential_index.json to allow listing stored credentials (this index contains usernames but not passwords).
    • App ID Resolution: The native appId is derived from GApplication.application_id. If unavailable, it falls back to a sanitized version of the executable filename.

    You can access the database via LinuxHttpAuthCredentialDatabase.instance() or LinuxHttpAuthCredentialDatabase.static().

    // Access the shared instance
    final db = LinuxHttpAuthCredentialDatabase.instance();
  7. Configure Ciyue themes and appearance

    main

    The Ciyue widget manages the application's visual configuration based on user settings:

    • Dynamic Color: If settings.enableDynamicColor is enabled and the platform is not desktop, it uses DynamicColorBuilder to apply system-themed colors.
    • Seed Color: If dynamic color is disabled, it uses settings.themeSeedColor to generate a ColorScheme via ColorScheme.fromSeed.
    • Pure Black Dark Mode: If settings.pureBlackDarkMode is enabled, the dark theme is modified to use Colors.black for all surface components (surface, surfaceDim, surfaceBright, etc.).
    • Desktop Accent Color: On desktop platforms, if dynamic color is not used, it falls back to accentColor if available.
    • Localization: The application locale is determined by settings.language. If set to "system", it uses the system default. Otherwise, it parses the string (e.g., "en_US") into a Locale object.