Skip to content

Spell checker does not respect text.lang if the *.typ is not included in main.typ #675

Open

Description

@YDX-2147483647

Description

All Chinese characters are considered misspellings if text.lang ≠ "zh".

If I am previewing an English main.typ, and having another Chinese side.typ that is not included/imported in main.typ, then the content of side.typ will be considered misspellings even though I set text(lang: "zh") in side.typ.

// main.typ
#set text(lang: "en")

English
// #set text(lang: "zh")
// side.typ
#set text(lang: "zh")

中文
main.typ side.typ

The behavior is not stable. As shown in the following screenshots, the spell checking result of side.typ depends on whether and where I write #set text(lang: "zh") in main.typ.

Image Image Image

Reproduction URL

https://typst.app/project/rt7RCtMFgDLlFw4duOkfmE

Browsers

Firefox

OS

Windows

Activity

  1. added
    bug
    on Jul 23, 2025
  2. laurmaedje commented on Jul 23, 2025

    @laurmaedje
    Member

    The problem is that set rules are not well defined outside of the previewed document. All files for which no precise language is known are assumed to have the majority language of the document.

  3. YDX-2147483647 commented on Jul 23, 2025

    @YDX-2147483647
    Author

    I see…

    the majority language of the document.

    Is there a precise definition? I have another project whose main.typ contains #set text(lang: "zh") and a few lines generated from data, but the content of side.typ is still considered misspellings.

  4. YDX-2147483647 commented on Jul 23, 2025

    @YDX-2147483647
    Author

    A minimal example:

    // main.typ
    #set text(lang: "zh")
    #"汉字".clusters()
    
    // side.typ
    #set text(lang: "zh")
    中文
    
    Image

    Update: Interesting…

    Image Image Image Image
  5. changed the title [-]Spell checker sometimes does not respect `text.lang` if the `*.typ` is not included in `main.typ`[/-] [+]Spell checker does not respect `text.lang` if the `*.typ` is not included in `main.typ`[/+] on Jul 25, 2025
  6. added
    improve
    spellcheck
    on Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugimprovespellcheck

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions