Skip to content

Commit 31542bc

Browse files
authored
fix(i18n): refresh native locales when locale inventory changes (#129438)
1 parent 9b7c95a commit 31542bc

4 files changed

Lines changed: 24 additions & 5 deletions

File tree

‎.github/workflows/native-app-locale-refresh.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ on:
1919
- scripts/android-app-i18n.ts
2020
- scripts/apple-app-i18n.ts
2121
- scripts/native-app-i18n.ts
22+
- scripts/native-i18n-locales.ts
2223
- ui/src/i18n/.i18n/glossary.*.json
2324
- .github/actions/create-generated-pr-tokens/action.yml
2425
- .github/actions/publish-generated-pr/action.yml
@@ -334,6 +335,7 @@ jobs:
334335
scripts/android-app-i18n.ts
335336
scripts/apple-app-i18n.ts
336337
scripts/native-app-i18n.ts
338+
scripts/native-i18n-locales.ts
337339
ui/src/i18n/.i18n/glossary.*.json
338340
.github/actions/create-generated-pr-tokens/action.yml
339341
.github/actions/publish-generated-pr/action.yml

‎scripts/ci-changed-scope.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class NativeGeneratedArtifactsMixedError extends Error {}
103103
const CHROMIUM_UI_TEST_SCOPE_RE =
104104
/^(ui\/|extensions\/browser\/chrome-extension\/|test\/vitest\/vitest\.(?:shared|ui-e2e)\.config\.ts$|scripts\/ensure-playwright-chromium\.mts$|package\.json$|\.github\/workflows\/ci\.yml$)/;
105105
const NATIVE_I18N_SCOPE_RE =
106-
/^(?:apps\/\.i18n\/|apps\/android\/(?:app\/src\/(?:main|play|thirdParty)\/|wear\/src\/main\/)|apps\/ios\/|apps\/macos\/Sources\/|apps\/shared\/OpenClawKit\/Sources\/|scripts\/(?:android-app-i18n|apple-app-i18n|native-app-i18n)\.ts$|test\/scripts\/(?:android-app-i18n|apple-app-i18n|native-app-i18n)\.test\.ts$|\.github\/workflows\/(?:ci|native-app-locale-refresh)\.yml$)/;
106+
/^(?:apps\/\.i18n\/|apps\/android\/(?:app\/src\/(?:main|play|thirdParty)\/|wear\/src\/main\/)|apps\/ios\/|apps\/macos\/Sources\/|apps\/shared\/OpenClawKit\/Sources\/|scripts\/(?:android-app-i18n|apple-app-i18n|native-(?:app-i18n|i18n-locales))\.ts$|test\/scripts\/(?:android-app-i18n|apple-app-i18n|native-app-i18n)\.test\.ts$|\.github\/workflows\/(?:ci|native-app-locale-refresh)\.yml$)/;
107107
// Android base resources are co-owned: source PRs edit their English content,
108108
// while the generator rewrites managed sections. Treat them as generated only
109109
// alongside a hard-generated artifact so neither ownership path blocks the other.

‎src/scripts/ci-changed-scope.native-i18n.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ const { assertNativeGeneratedArtifactsIsolated, shouldRunNativeI18n, shouldStric
44
await import("../../scripts/ci-changed-scope.mjs");
55

66
describe("native i18n changed scope", () => {
7+
it.each([
8+
"scripts/android-app-i18n.ts",
9+
"scripts/apple-app-i18n.ts",
10+
"scripts/native-app-i18n.ts",
11+
"scripts/native-i18n-locales.ts",
12+
])("routes native locale source %s without requiring generated parity", (sourcePath) => {
13+
expect(shouldRunNativeI18n([sourcePath])).toBe(true);
14+
expect(shouldStrictNativeI18n([sourcePath])).toBe(false);
15+
});
16+
717
it("routes Android flavor sources through native i18n", () => {
818
expect(
919
shouldRunNativeI18n([

‎test/scripts/ci-workflow-guards.test.ts‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,8 +2131,17 @@ NODE
21312131
expect(workflow.on.push.paths).toContain("apps/android/app/src/play/**");
21322132
expect(workflow.on.push.paths).toContain("apps/android/app/src/thirdParty/**");
21332133
expect(workflow.on.push.paths).toContain("apps/android/wear/src/main/**");
2134-
expect(workflow.on.push.paths).toContain("scripts/android-app-i18n.ts");
2135-
expect(workflow.on.push.paths).toContain("scripts/apple-app-i18n.ts");
2134+
for (const generatorInput of [
2135+
"scripts/android-app-i18n.ts",
2136+
"scripts/apple-app-i18n.ts",
2137+
"scripts/native-app-i18n.ts",
2138+
"scripts/native-i18n-locales.ts",
2139+
]) {
2140+
expect(workflow.on.push.paths).toContain(generatorInput);
2141+
expect(nativePublishStep.with["invalidation-paths"].trim().split("\n")).toContain(
2142+
generatorInput,
2143+
);
2144+
}
21362145
expect(refreshStep.run).toContain("run_refresh anthropic");
21372146
expect(refreshStep.run).toContain("retrying with OpenAI");
21382147
expect(refreshStep.run).toContain("run_openai_refresh");
@@ -2167,8 +2176,6 @@ NODE
21672176
"apps/ios/ShareExtension/*.lproj/InfoPlist.strings",
21682177
"apps/ios/ActivityWidget/*.lproj/InfoPlist.strings",
21692178
]);
2170-
expect(nativePublishStep.with["invalidation-paths"]).toContain("scripts/android-app-i18n.ts");
2171-
expect(nativePublishStep.with["invalidation-paths"]).toContain("scripts/apple-app-i18n.ts");
21722179
expect(nativePublishStep.with["invalidation-paths"]).toContain("apps/.i18n/native-source.json");
21732180
expect(nativePublishStep.with["invalidation-paths"]).toContain("apps/android/app/src/play");
21742181
expect(nativePublishStep.with["invalidation-paths"]).toContain(

0 commit comments

Comments
 (0)