Skip to content

Commit a82b93f

Browse files
committed
Merge branch 'localization' into develop
2 parents 6136c70 + 7b2aca1 commit a82b93f

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

scripts/translate.mjs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,13 @@ async function translateFileWithSections(client, file, systemPrompt, localesDir,
460460
let storedData = null;
461461
try {
462462
storedData = JSON.parse(await fs.readFile(hashFile, 'utf-8'));
463+
// Detect old-format positional paragraph IDs (e.g. "h2-foo-p1", "preamble-p3").
464+
// Paragraph IDs now use 8-char content hashes (e.g. "h2-foo-pa3f7c1b2") so any
465+
// cache entry ending in -p<digits> is stale — discard it to trigger re-seeding.
466+
if (storedData?.sections) {
467+
const hasOldIds = Object.keys(storedData.sections).some(id => /-p\d+$/.test(id));
468+
if (hasOldIds) storedData = { fileHash: storedData.fileHash };
469+
}
463470
} catch { /* no cache */ }
464471

465472
// Seed section cache from existing translation when no section-level cache exists.
@@ -1539,10 +1546,11 @@ function postProcessTranslation(content, lang) {
15391546
`from '../../../components/$1'`
15401547
);
15411548

1542-
// Ensure a blank line between import statements and headings.
1549+
// Ensure a blank line after the last import statement.
15431550
// The model sometimes strips the trailing blank line from the preamble section,
1544-
// which causes MDX/acorn parse errors when an import is directly followed by ##.
1545-
content = content.replace(/^(import [^\n]+)\n(#{1,6} )/gm, '$1\n\n$2');
1551+
// causing MDX/acorn parse errors when an import is directly followed by content
1552+
// (a heading, a paragraph, a callout, a component, etc.).
1553+
content = content.replace(/^(import [^\n]+)\n([^\n])/gm, '$1\n\n$2');
15461554

15471555
return content;
15481556
}

src/locales/zh/_sidebar-labels.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -978,10 +978,10 @@
978978
"value": "在 Google Play 管理中心生成服务账号密钥文件"
979979
},
980980
"google-play-store-connection-configuration": {
981-
"value": "Google Play Store 凭据"
981+
"value": "配置 Google Play Store 集成"
982982
},
983983
"enable-real-time-developer-notifications-rtdn": {
984-
"value": "Google 实时开发者通知 (RTDN)"
984+
"value": "Google Play Console 中启用实时开发者通知 (RTDN)"
985985
},
986986
"payment-integrations": {
987987
"value": "网页"
@@ -1524,7 +1524,7 @@
15241524
"value": "Airbridge"
15251525
},
15261526
"apple-search-ads": {
1527-
"value": "Apple Search Ads"
1527+
"value": "Apple Ads"
15281528
},
15291529
"appsflyer": {
15301530
"value": "AppsFlyer"

0 commit comments

Comments
 (0)