Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to generate search index for zh-Hans #2800

Open
Gabirel opened this issue Feb 16, 2025 · 2 comments
Open

Failed to generate search index for zh-Hans #2800

Gabirel opened this issue Feb 16, 2025 · 2 comments

Comments

@Gabirel
Copy link

Gabirel commented Feb 16, 2025

Bug Report

Environment

Zola version: zola 0.20.0 (custom build with: cargo build --release --features indexing-ja --features indexing-zh)

Expected Behavior

Success to generate zh-Hans search index.

Current Behavior

It only works for Japanese, but not for zh-Hans. I believe it may be a bug for zola.

$ ls public/ | grep search_ 
search_index.en.json
search_index.ja.json

Build for zh-Hans

$ RUST_BACKTRACE=1 /Users/apple/zola/target/release/zola serve
Building site...
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 23 pages (0 orphan) and 11 sections
Error: Failed to serve the site
Error: Tried to build search index for language zh-Hans which is not supported

Step to reproduce

  1. enable zh-Hans language and its corresponding search index flag
  2. build zola with ja and zh index feature with: cargo build --release --features indexing-ja --features indexing-zh
$ cargo build --release --features indexing-ja --features indexing-zh
    Finished `release` profile [optimized] target(s) in 0.50s
warning: the following packages contain code that will be rejected by a future version of Rust: quick-xml v0.17.2
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
$ du -sh ./target/release/zola
110M	./target/release/zola
  1. run custom built zola serve, and get errors.

Reference

  • commit for building: 379f6c1f622ffeb2793c11301efbcf6f49b97138
  • theme I am using: tabi
@Keats
Copy link
Collaborator

Keats commented Feb 17, 2025

I think the library expects only zh as lang

@Gabirel
Copy link
Author

Gabirel commented Feb 18, 2025

Since I didn't find any specs for language code on this post, I assume Zola uses the same language code with tabi theme.

Currently tabi use ISO 639-1 Language Code List, which use zh-Hans.

Image

I suspect that the library only takes zh instead of zh-Hans or zh-Hant as well. However, tabi fails to show the correct translation to that language code. If it were a bug in tabi, I would create another issue there.

Image

Language code for tabi could be found in here: https://github.com/welpo/tabi/tree/main/i18n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants