File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 11name : " Update Translated Docs"
22
3+ # To add more languages, you will update the following:
4+ #
5+ # 1. Update this file
6+ # - Add '!docs/src/content/docs/{lang}/**' to `on.push.paths`
7+ #
8+ # 2. Update docs/astro.config.mjs
9+ # - Add the new language to `plugins.starlightLlmsTxt.exclude` array
10+ # - Update `translations` for `sidebar`'s items
11+ # - Add the new language to `integrations.starlight.locales` array
12+ #
13+ # 3. Update docs/src/scripts/translate.ts
14+ # - Various updates for the new language
15+ #
16+
317on :
418 push :
519 branches :
Original file line number Diff line number Diff line change 1- // How to run this script:
1+ // ----------------------------------------------------------------------------------
2+ // ### Translate document pages to non-English languages ####
3+ // If you want to add a new language, read .github/workflows/update-docs.yml first.
4+ //
5+ // For this file:
6+ // - Add the new language to `languages` object (required)
7+ // - Add the new language to `engToNonEngMapping` object (optional)
8+ // - Add the new language to `engToNonEngInstructions` object (optional)
9+ // - Add new items to LANGUAGE‑SPECIFIC section in the prompts (optional)
10+ //
11+ // ### How to run this script: ###
212// pnpm i && pnpm --filter docs run translate
13+ // ----------------------------------------------------------------------------------
314
415import fs from 'fs/promises' ;
516import path from 'path' ;
@@ -722,10 +733,11 @@ async function translateFile(
722733
723734function shouldSkipFile ( filePath : string ) : boolean {
724735 const rel = path . relative ( sourceDir , filePath ) ;
736+ const isLocalizedDoc = Object . keys ( languages ) . some ( ( code ) =>
737+ rel . startsWith ( `${ code } /` ) ,
738+ ) ;
725739 if (
726- rel . startsWith ( 'ja/' ) ||
727- rel . startsWith ( 'ko/' ) ||
728- rel . startsWith ( 'zh/' ) ||
740+ isLocalizedDoc ||
729741 ( ! filePath . endsWith ( '.md' ) && ! filePath . endsWith ( '.mdx' ) )
730742 ) {
731743 return true ;
You can’t perform that action at this time.
0 commit comments