Skip to content

Commit 61b89bc

Browse files
authored
Merge pull request #14 from flashcatcloud/doc-review/2026-03-17
feat: incremental Meilisearch upload with batch and deletion support
2 parents cc3827c + a18155b commit 61b89bc

3 files changed

Lines changed: 270 additions & 139 deletions

File tree

.cursor/skills/translate-zh-to-en/SKILL.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,16 @@ If no uncommitted changes:
5353
| MDX components | Keep tags unchanged, translate inner text |
5454
| Code blocks | Keep code unchanged, translate comments only |
5555
| Internal links | Update path prefix to `en/` |
56-
| Image paths | Keep unchanged |
56+
| Image paths | See **Image Handling** below |
57+
58+
### Image Handling
59+
60+
When translating, check whether the target `en/` file already exists:
61+
62+
- **New translation** (no existing en/ file): Keep image paths from the zh/ source as-is.
63+
- **Retranslation** (en/ file already exists): Compare image paths between the zh/ source and the existing en/ file. Some docs use **language-specific screenshots** (English UI screenshots in en/, Chinese UI screenshots in zh/) with different CDN hashes. If the existing en/ file has a different image URL at the same position, **keep the en/ version** — it is likely an English screenshot that should not be replaced with the Chinese one. Only adopt the zh/ image path if it is a newly added image with no en/ counterpart.
64+
65+
**How to check**: Before writing the translated file, read the existing en/ file and diff the image URLs. Images with identical URLs across both versions are language-neutral and safe to keep. Images with different URLs (different hash in the CDN path) are language-specific — preserve the en/ version.
5766

5867
## Example
5968

@@ -115,5 +124,6 @@ Always read the full glossary before translating: [glossary.md](glossary.md)
115124
- [ ] Use correct terminology
116125
- [ ] Preserve MDX component structure
117126
- [ ] Update internal link paths
127+
- [ ] Check existing en/ file for language-specific images before overwriting
118128
- [ ] Apply Sentence case capitalization
119129
- [ ] Verify output path mirrors source path

.github/workflows/upload.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ name: Upload docs to Meilisearch
1515
on:
1616
push:
1717
branches: [main, test]
18+
paths:
19+
- 'zh/**'
20+
- 'en/**'
21+
- 'docs.json'
1822
workflow_dispatch:
1923
inputs:
2024
environment:
@@ -25,6 +29,11 @@ on:
2529
options:
2630
- production
2731
- development
32+
full_upload:
33+
description: 'Re-upload all docs (use after clearing index or changing settings)'
34+
required: false
35+
default: false
36+
type: boolean
2837

2938
jobs:
3039
upload:
@@ -33,6 +42,9 @@ jobs:
3342
steps:
3443
- name: Checkout
3544
uses: actions/checkout@v4
45+
with:
46+
# Need history for git diff in incremental mode
47+
fetch-depth: 2
3648

3749
- name: Install dependencies
3850
run: |
@@ -45,6 +57,7 @@ jobs:
4557
MEILI_ENDPOINT: ${{ secrets.MEILI_ENDPOINT }}
4658
MEILI_API_KEY: ${{ secrets.MEILI_API_KEY }}
4759
MEILI_INDEX: ${{ secrets.MEILI_INDEX }}
60+
FULL_UPLOAD: ${{ github.event.inputs.full_upload || 'false' }}
4861
run: |
4962
chmod +x ./scripts/upload.sh
5063
bash ./scripts/upload.sh

0 commit comments

Comments
 (0)