Skip to content

[GH-2909] Translate documentation landing pages to Chinese#2922

Merged
jiayuasu merged 3 commits intoapache:masterfrom
jiayuasu:feature/docs-i18n-landing-pages
May 7, 2026
Merged

[GH-2909] Translate documentation landing pages to Chinese#2922
jiayuasu merged 3 commits intoapache:masterfrom
jiayuasu:feature/docs-i18n-landing-pages

Conversation

@jiayuasu
Copy link
Copy Markdown
Member

@jiayuasu jiayuasu commented May 7, 2026

Did you read the Contributor Guide?

Is this PR related to a ticket?

What changes were proposed in this PR?

Phase 2 of the Chinese-documentation EPIC (#2867). This PR translates the top-level landing pages and makes the homepage hero template locale-aware so Chinese visitors see translated content end-to-end on /zh/.

  • Add Chinese translations for the four product landing pages: docs/sedonaspark.zh.md, docs/sedonaflink.zh.md, docs/sedonasnow.zh.md, docs/download.zh.md.
  • Refactor docs-overrides/main.html to source all hardcoded English strings from a per-locale translation dict keyed off config.theme.language. The covered surfaces are:
    • hero subtitle and CTA
    • QUERY-and-JOIN typed-rotation strings
    • Get-started-in-seconds section
    • Deploy section (tags + per-runtime descriptions)
    • Industries tabs
    • Feature grid (six cards + benchmarks CTA)
    • Community section
    • Events section + decorative event line
    • Outdated-version banner
    • Top-of-page release announcement banner
  • Broaden the homepage detection in main.html so the hero template renders for both index.md and index.zh.md. mkdocs sets page.is_homepage only on the default-locale index, so /zh/ would otherwise fall through to plain markdown.
  • The English locale is unaffected — the default branch of the translation dict reproduces the existing copy verbatim.

How was this patch tested?

Built the docs locally with uv sync --group docs && uv run mkdocs build and verified:

  • Build succeeds with no new warnings.
  • site/zh/index.html renders the full hero template with translated strings (e.g. 让处理任意规模的空间数据变得轻而易举, 立即开始, 加入社区, 查看活动).
  • site/index.html is byte-identical in line count to the previous English-only build (6,299 lines) — no regression on the default locale.
  • site/zh/sedonaspark/index.html, site/zh/sedonaflink/index.html, site/zh/sedonasnow/index.html, site/zh/download/index.html render the new Chinese content.
  • The release announcement banner at the top of /zh/ reads the Chinese string (Apache Sedona 1.9.0 已正式发布…).

Did this PR include necessary documentation updates?

Phase 2 of apache#2867. Translates the top-level landing pages and makes the
homepage hero template locale-aware so Chinese visitors see translated
content end-to-end on /zh/.

- Add docs/sedonaspark.zh.md, sedonaflink.zh.md, sedonasnow.zh.md,
  download.zh.md
- Refactor docs-overrides/main.html to source all hardcoded English
  strings (hero subtitle and CTA, deploy section, feature grid,
  industries tabs, community + events sections, outdated-version
  banner, announcement banner, decorative event line) from a per-locale
  translation dict keyed off config.theme.language. The default 'en'
  rendering is unchanged.
- Broaden the homepage detection in main.html so the hero template is
  applied to both index.md and index.zh.md (mkdocs sets
  page.is_homepage only on the default-locale index).

Verified locally with `uv run mkdocs build`: the /zh/ homepage now
renders the full hero with Chinese strings, the four landing pages
render in Chinese, and the English /index.html stays byte-identical
in size to before.
@jiayuasu jiayuasu requested a review from Copilot May 7, 2026 05:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Translates key documentation landing pages into Chinese and refactors the docs homepage template to render localized hero/landing content on /zh/.

Changes:

  • Added Chinese versions of key landing pages (Spark/Flink/Snowflake/Download).
  • Refactored docs-overrides/main.html to use a per-locale translation dictionary driven by config.theme.language.
  • Adjusted homepage detection so the custom hero renders for both index.md and index.zh.md.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
docs/sedonaspark.zh.md Adds Chinese translation for the SedonaSpark landing page.
docs/sedonaflink.zh.md Adds Chinese translation for the SedonaFlink landing page.
docs/sedonasnow.zh.md Adds Chinese translation for the SedonaSnow landing page.
docs/download.zh.md Adds Chinese translation for the Download page, including version tables and links.
docs-overrides/main.html Makes homepage hero + global banners locale-aware and renders hero on /zh/.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs-overrides/main.html
{{ t.get_started_desc }}
</div>
<div class="bth-group">
<a href="/sedonadb" class="btn btn-red">
Comment thread docs-overrides/main.html
<div class="info-item__description editor">Standalone runtime for local processing and development.</div>
<div class="info-item__description editor">{{ t.sedonadb_desc }}</div>
<div class="info-item__cta">
<a href="/sedonadb" class="btn-link">
Comment thread docs-overrides/main.html Outdated
} -%}
<div style="background: #CA463A; color: white; text-align: center; padding: 0.5rem;">
<a href="setup/release-notes/" title="Announcement">Apache Sedona 1.9.0 is out now, featuring Spark 4.1 support, proj4sedona CRS transformation, Bing Tile functions, and more!</a>
<a href="setup/release-notes/" title="Announcement">{{ announcement[lang] }}</a>
Comment thread docs-overrides/main.html Outdated

{% block outdated %}
You're not viewing the latest stable version.
{%- set lang = config.theme.language if config.theme.language in ['en', 'zh'] else 'en' -%}
Comment thread docs-overrides/main.html Outdated
{% endblock %}

{% block header %}
{%- set lang = config.theme.language if config.theme.language in ['en', 'zh'] else 'en' -%}
Comment thread docs-overrides/main.html Outdated
{% if page.is_homepage %}
{% set is_home = page.is_homepage or (page.file and page.file.src_uri in ['index.md', 'index.zh.md']) %}
{% if is_home %}
{%- set lang = config.theme.language if config.theme.language in ['en', 'zh'] else 'en' -%}
Comment thread docs-overrides/main.html Outdated
<div>Sedona <strong>Events</strong></div>
<div>Sedona <strong>Events</strong></div>
<div>Sedona <strong>Events</strong></div>
{%- set events_decor = {'en': ['Sedona ', 'Events'], 'zh': ['Sedona ', '活动']} -%}
Comment thread docs-overrides/main.html Outdated
'feature_portable_title': 'Portable',
'feature_portable_desc': 'Easy to run locally, in the cloud, or with any data platform.',
'feature_fast_title': 'Fast',
'feature_fast_desc': 'Optimized execution for single node or distribute cluster environments.',
Comment thread docs/download.zh.md
Comment on lines +38 to +52
| | 从 ASF 下载 | 校验和 | 签名 |
|:-----------------:|:----------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------:|
| 源代码 | [src](https://www.apache.org/dyn/closer.lua/sedona/1.9.0/apache-sedona-1.9.0-src.tar.gz) | [sha512](https://downloads.apache.org/sedona/1.9.0/apache-sedona-1.9.0-src.tar.gz.sha512) | [asc](https://downloads.apache.org/sedona/1.9.0/apache-sedona-1.9.0-src.tar.gz.asc) |
| 二进制 | [bin](https://www.apache.org/dyn/closer.lua/sedona/1.9.0/apache-sedona-1.9.0-bin.tar.gz) | [sha512](https://downloads.apache.org/sedona/1.9.0/apache-sedona-1.9.0-bin.tar.gz.sha512) | [asc](https://downloads.apache.org/sedona/1.9.0/apache-sedona-1.9.0-bin.tar.gz.asc) |

### 1.8.1

| | 从 ASF 下载 | 校验和 | 签名 |
|:-----------------:|:----------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------:|
| 源代码 | [src](https://www.apache.org/dyn/closer.lua/sedona/1.8.1/apache-sedona-1.8.1-src.tar.gz) | [sha512](https://downloads.apache.org/sedona/1.8.1/apache-sedona-1.8.1-src.tar.gz.sha512) | [asc](https://downloads.apache.org/sedona/1.8.1/apache-sedona-1.8.1-src.tar.gz.asc) |
| 二进制 | [bin](https://www.apache.org/dyn/closer.lua/sedona/1.8.1/apache-sedona-1.8.1-bin.tar.gz) | [sha512](https://downloads.apache.org/sedona/1.8.1/apache-sedona-1.8.1-bin.tar.gz.sha512) | [asc](https://downloads.apache.org/sedona/1.8.1/apache-sedona-1.8.1-bin.tar.gz.asc) |

### 1.7.2

| | 从 ASF 下载 | 校验和 | 签名 |
Comment thread docs/sedonaflink.zh.md
Comment on lines +35 to +37
sedona.createTemporaryView("myTable", tbl)
Table geomTbl = sedona.sqlQuery("SELECT ST_GeomFromWKT(geom_polygon) as geom_polygon, name_polygon FROM myTable")
geomTbl.execute().print()
jiayuasu added 2 commits May 6, 2026 23:42
… paths

Two follow-up fixes for the Phase 2 landing-pages work:

1. Replace the default mkdocs-material dropdown language selector with
   a visible inline pill switch (English | 中文) so the Chinese build
   is discoverable from the orange header without opening a menu.
   - Override `partials/alternate.html` with two anchor pills, the
     active locale highlighted in white-on-brand-red.
   - Add `_lang-switch.scss` with the pill styling.
   - Set `target="_self"` on the anchors so mkdocs-material's
     `navigation.instant` does not intercept the click; clicking the
     switch now triggers a full page reload, which repaints the
     header's active highlight along with the rest of the page (the
     instant-nav DOM swap only refreshes a fixed list of components
     and the language switcher is not in that list).

2. Fix images that were missing on every /zh/ page:
   - In `docs-overrides/main.html` the homepage hero/deploy/feature/
     industries/community sections referenced assets via raw paths
     like `src="image/home/foo.svg"`, which under `/zh/` resolves to
     `/zh/image/...` and 404s. Wrap all 44 `src="image/..."` paths
     with the `| url` Jinja filter so mkdocs computes a properly
     relative URL from any page depth.
   - In `docs/sedonaspark.zh.md` the New York City water screenshot
     was linked as `../image/nyc_base_water.png`. Switch to the
     source-relative `image/nyc_base_water.png` so mkdocs auto-adjusts
     the depth of the rendered relative URL per locale (English
     renders `../image/...`, Chinese renders `../../image/...`, both
     resolving to `/image/nyc_base_water.png`).
Three follow-ups from PR review:

1. Hoist the locale detection to a single top-level set in main.html
   so the four blocks that need it stop recomputing
   `config.theme.language` independently. Renamed the variable to
   `cur_lang` to avoid the name collision with mkdocs-material's
   `lang` (which base.html imports as a TemplateModule from
   `partials/language.html`).

2. Fold the homepage `events_decor_pre`/`events_decor_strong`
   strings into the main `i18n` translation dict alongside the
   other locale-specific strings, instead of declaring them in
   their own per-block `set` block.

3. Fix two real bugs uncovered while reviewing:
   - The release-notes announcement banner used a relative href
     (`setup/release-notes/`) that 404'd from any non-home page.
     Wrap with the `| url` Jinja filter so mkdocs computes the
     correct relative URL from any page depth.
   - English `feature_fast_desc` had a grammar bug —
     "distribute cluster" → "distributed cluster".

The `outdated_msg` and `announcement` dicts stay scoped to their
respective blocks because they're only referenced once each and
locality is easier to read than a giant top-level dict.
@jiayuasu
Copy link
Copy Markdown
Member Author

jiayuasu commented May 7, 2026

Addressed in 1339c4b:

  • L34 (announcement banner relative URL): wrapped with | url filter.
  • L4/28/42/777 (lang recomputed in 4 blocks): hoisted to a single top-level set and renamed to cur_lang to avoid the name collision with mkdocs-material's lang (which base.html imports as a TemplateModule from partials/language.html). Folded events_decor into the main i18n dict.
  • L95 ("distribute cluster" → "distributed cluster"): fixed.

Skipped (pre-existing patterns, not introduced by this PR):

  • L307/L335 (/sedonadb absolute links): these point to a sister site at https://sedona.apache.org/sedonadb/, not into the current docs tree (see mkdocs.yml nav: SedonaDB: 'https://sedona.apache.org/sedonadb/'). The root-absolute path is intentional and works on production.
  • download.zh.md table | | syntax: preserved verbatim from the English download.md to keep the structure aligned. mkdocs-material renders it correctly.
  • sedonaflink.zh.md Java snippet missing semicolons: same code exists identically in the English sedonaflink.md. Fixing would require a separate PR that updates both locales (and arguably the original landing copy).

outdated_msg and announcement were left scoped to their respective blocks since each is referenced exactly once and locality reads more clearly than a giant top-level dict.

@jiayuasu jiayuasu merged commit 3048592 into apache:master May 7, 2026
11 checks passed
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

Successfully merging this pull request may close these issues.

[GH-2867] Translate documentation landing pages to Chinese (Phase 2)

2 participants