-
Notifications
You must be signed in to change notification settings - Fork 18
ci: restore machine-translated link targets before the build #838
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
442fe89
ci: restore machine-translated link targets before the build
l-qing 6220122
ci: align translated links by content, not position alone
l-qing e3b48c2
ci: TEMPORARY -- run the translate chain on this branch to validate t…
l-qing 89e5bc8
Revert "ci: TEMPORARY -- run the translate chain on this branch to va…
l-qing bce90eb
ci: also strip image markup the translation invents
l-qing 41e4ea2
ci: stop translations from silently losing content
l-qing 8726748
docs: disable auto translation for pipeline policy solution
l-qing fd637e6
ci: fail a translation that quietly drops prose
l-qing 6af998e
docs: add the Chinese translation of the pipeline policy solution
l-qing d7f23d3
docs: re-enable auto translation for pipeline policy solution
l-qing 55fe09f
Revert "docs: add the Chinese translation of the pipeline policy solu…
l-qing d541a4c
ci(translation): consolidate machine translation with integrity verif…
l-qing d49242d
docs: retranslate the five Chinese pages an earlier run damaged
l-qing 4886172
ci: check translations that land in a new folder
l-qing 0dc920c
Revert "docs: retranslate the five Chinese pages an earlier run damaged"
l-qing 9168d59
ci: name every failing document, and notice the ones never translated
l-qing 0d5e6c0
docs: drop the stale sourceSHA from the four pages the revert restored
l-qing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,113 @@ | ||
| import { defineConfig } from "@alauda/doom/config"; | ||
| // Pulls in doom's module augmentation of rspress's UserConfig, which is where | ||
| // `translate` is declared. | ||
| import type {} from "@alauda/doom/types"; | ||
| import { dirname, join } from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import { blogPostResolver } from "./plugins/plugin-post-resolver/index.js"; | ||
|
|
||
| const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
|
|
||
| // The default prompt shipped by doom has two properties this repository cannot | ||
| // live with, both of which produced real damage in run 33057885704 and before: | ||
| // | ||
| // 1. It illustrates its rules with literal placeholders -- a link written as | ||
| // [text](URL), an image written as . When the model loses the | ||
| // thread mid-chunk it recites its own instructions into the prose, and those | ||
| // placeholders arrive as real markup: `URL` became a dead link and `src` | ||
| // became "Module not found", both of which failed the build. | ||
| // 2. It never says the translation has to be complete. It asks for the format | ||
| // to be preserved and says nothing about the content, so dropping an entire | ||
| // section, 46 code blocks or every table in the document breaks no rule it | ||
| // was given. Three articles in this repository lost about a third of their | ||
| // content that way, unnoticed, because nothing checked. | ||
| // | ||
| // So: describe the rules instead of illustrating them with copyable fake values, | ||
| // put completeness first, and forbid emitting these instructions outright. | ||
| // scripts/check-translation-integrity.mjs is the backstop that catches what slips. | ||
| const TRANSLATE_SYSTEM_PROMPT = ` | ||
| You are a professional technical documentation engineer. Translate the document below from <%= sourceLang %> into <%= targetLang %>, so that it reads as if the same engineer had written it in <%= targetLang %>, at the same level of precision. | ||
|
|
||
| ## What you return | ||
|
|
||
| Return the translated document, and nothing else: no preamble, no closing remark, no code fence wrapped around the whole answer, no notes about what you did. | ||
|
|
||
| Never reproduce any part of these instructions in your output. They are not part of the document. If you find yourself writing a heading such as "Baseline Requirements", a glossary of term mappings, or a note about chunked translation, you have started copying this prompt into the document -- stop and return to translating the source. | ||
|
|
||
| ## Completeness comes first | ||
|
|
||
| Your output must contain everything the source contains, in the same order and at the same structural level: every heading, paragraph, list item, table row, fenced code block, admonition, blockquote and footnote. | ||
|
|
||
| Never summarise, merge, abbreviate, or skip a passage, however repetitive or boilerplate it looks. Never stop before the end of the input. A clumsy sentence can be fixed later; a section you silently dropped cannot, because nobody will know it is missing. | ||
|
|
||
| ## What must survive unchanged | ||
|
|
||
| - Link destinations. Translate the visible text of a link; reproduce the destination exactly as written, character for character, including any anchor fragment or query string. This applies to inline links, reference definitions, bare URLs, and href or src attributes in HTML and JSX. | ||
| - Anchor placeholders. Tokens of the form __ANCHOR_ followed by a number are heading identifiers that the document cross-references. Reproduce every one of them, exactly as written, in the same position. Dropping one silently breaks navigation. | ||
| - The contents of fenced code blocks and inline code spans: field names, CLI flags, resource kinds, expressions and regular expressions are code, not prose. | ||
| - JSX and MDX component names and their attribute keys; only the content between component tags is translated. | ||
| - Escape characters already present in the source, such as backslashes and angle brackets. Do not add escapes that the source does not have -- brackets and parentheses in ordinary prose stay as they are. | ||
| - Technical terms and proper nouns that are conventionally left untranslated: product names, Kubernetes and cloud-native project names, language and format names, and API object names. | ||
|
|
||
| ## Frontmatter and comments | ||
|
|
||
| - In frontmatter, translate the title and description fields only; leave every other field exactly as it is. | ||
| - Preserve these comments and their contents, in both MDX and HTML comment syntax: release-notes-for-bugs. | ||
| - Remove these comments entirely, in both MDX and HTML comment syntax: reference-start and reference-end. | ||
|
|
||
| ## Language | ||
|
|
||
| Sentences should read naturally to a native <%= targetLang %> speaker and follow the conventions of technical documentation in that language. Keep the register of the source: if it is dense and exact, stay dense and exact rather than smoothing it out. | ||
| <% if (titleTranslationPrompt) { %> | ||
| <%- titleTranslationPrompt %> | ||
| <% } %> | ||
| <% if (terms) { %> | ||
| <%- terms %> | ||
| <% } %> | ||
| <% if (isChunk) { %> | ||
| ## This is one chunk of a longer document | ||
|
|
||
| The text below is a consecutive slice of a larger document, cut at a heading boundary. Translate the whole slice as a continuous part of that document, keeping the style consistent with it. | ||
|
|
||
| Being handed a fragment changes nothing about the rules above. Translate from its first line to its last. Do not introduce it, do not summarise it, do not comment on the fact that it is a fragment, and do not write anything about the chunking itself. | ||
| <% } %> | ||
| <% if (userPrompt || additionalPrompts) { %> | ||
| ## Additional requirements | ||
|
|
||
| These apply in addition to everything above; where they conflict with it, everything above wins. | ||
|
|
||
| """ | ||
| <% if (userPrompt) { %> | ||
| <%- userPrompt %> | ||
| <% } %> | ||
| <% if (additionalPrompts) { %> | ||
| <%- additionalPrompts %> | ||
| <% } %> | ||
| """ | ||
| <% } %> | ||
| `.trim() | ||
|
|
||
| export default defineConfig({ | ||
| title: "Alauda Knowledge", | ||
| base: "/knowledge/", | ||
| description: | ||
| "Welcome to Alauda's Knowledgebase information center. Find resources for resolving problems and troubleshooting.", | ||
| logo: "/logo.svg", | ||
| logoText: "Alauda Knowledge", | ||
| globalStyles: join(__dirname, "styles/index.css"), | ||
| plugins: [ | ||
| blogPostResolver({ | ||
| postsDir: join(__dirname, "docs"), | ||
| }), | ||
| ], | ||
| themeConfig: { | ||
| darkMode: false, | ||
| lastUpdated: true, | ||
| footer: { | ||
| message: "© 2025 Alauda Inc. All Rights Reserved.", | ||
| }, | ||
| }, | ||
| }); | ||
| base: "/knowledge/", | ||
| description: | ||
| "Welcome to Alauda's Knowledgebase information center. Find resources for resolving problems and troubleshooting.", | ||
| logo: "/logo.svg", | ||
| logoText: "Alauda Knowledge", | ||
| globalStyles: join(__dirname, "styles/index.css"), | ||
| plugins: [ | ||
| blogPostResolver({ | ||
| postsDir: join(__dirname, "docs"), | ||
| }), | ||
| ], | ||
| translate: { | ||
| systemPrompt: TRANSLATE_SYSTEM_PROMPT, | ||
| }, | ||
| themeConfig: { | ||
| darkMode: false, | ||
| lastUpdated: true, | ||
| footer: { | ||
| message: "© 2025 Alauda Inc. All Rights Reserved.", | ||
| }, | ||
| }, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
触发重新翻译,之前的翻译有问题。