Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(mobile): pick Chinese by script and skip an unnamed invite intro

Tina30457915322
diff --git a/apps/mobile/src/app/(app)/workspace/[workspaceId]/members.tsx b/apps/mobile/src/app/(app)/workspace/[workspaceId]/members.tsx
index 9d73b78e5..1e2e8aae3 100644
--- a/apps/mobile/src/app/(app)/workspace/[workspaceId]/members.tsx
+++ b/apps/mobile/src/app/(app)/workspace/[workspaceId]/members.tsx
@@ -386,11 +386,15 @@ function InviteForm({
return (
<>
- <View style={{ paddingHorizontal: 20, marginTop: -8, paddingBottom: 16 }}>
- <Txt variant="meta" tone="muted" style={{ lineHeight: 18 }}>
- {t("mobile:members.inviteForm.intro", { workspace: workspaceName })}
- </Txt>
- </View>
+ {workspaceName ? (
+ <View
+ style={{ paddingHorizontal: 20, marginTop: -8, paddingBottom: 16 }}
+ >
+ <Txt variant="meta" tone="muted" style={{ lineHeight: 18 }}>
+ {t("mobile:members.inviteForm.intro", { workspace: workspaceName })}
+ </Txt>
+ </View>
+ ) : null}
<View style={{ paddingHorizontal: 20, paddingBottom: 12, gap: 16 }}>
<TextField
label={t("mobile:members.inviteForm.email")}
diff --git a/apps/mobile/src/lib/i18n/resolve-locale.test.ts b/apps/mobile/src/lib/i18n/resolve-locale.test.ts
index d679da405..353e3a28f 100644
--- a/apps/mobile/src/lib/i18n/resolve-locale.test.ts
+++ b/apps/mobile/src/lib/i18n/resolve-locale.test.ts
@@ -8,6 +8,14 @@ describe("resolveLocale", () => {
expect(resolveLocale(["pt_PT"])).toBe("pt-BR");
});
+ it("picks Chinese by script", () => {
+ expect(resolveLocale(["zh-Hant-TW"])).toBe("zh-TW");
+ expect(resolveLocale(["zh-Hant"])).toBe("zh-TW");
+ expect(resolveLocale(["zh-HK"])).toBe("zh-TW");
+ expect(resolveLocale(["zh_Hans_CN"])).toBe("zh-CN");
+ expect(resolveLocale(["zh"])).toBe("zh-CN");
+ });
+
it("falls back to the next candidate, then en-US", () => {
expect(resolveLocale([null, "fr-CA"])).toBe("fr-FR");
expect(resolveLocale(["xx-YY"])).toBe("en-US");
diff --git a/apps/mobile/src/lib/i18n/resolve-locale.ts b/apps/mobile/src/lib/i18n/resolve-locale.ts
index 043ec68fe..553224122 100644
--- a/apps/mobile/src/lib/i18n/resolve-locale.ts
+++ b/apps/mobile/src/lib/i18n/resolve-locale.ts
@@ -8,13 +8,22 @@ function languageCode(locale: string) {
return locale.toLowerCase().split(/[-_]/)[0];
}
+// Chinese splits by script, not region: iOS reports `zh-Hant-TW` or `zh-HK`, which must not fall
+// through to the first Chinese catalog (Simplified).
+function chineseCatalog(locale: string): AppLocale | null {
+ if (languageCode(locale) !== "zh") return null;
+ return /-(hant|tw|hk|mo)\b/.test(locale) ? "zh-TW" : "zh-CN";
+}
+
/** Picks the first candidate Kaneo has a catalog for, matching the region first, then the language. */
export function resolveLocale(
candidates: (string | null | undefined)[],
): AppLocale {
for (const candidate of candidates) {
if (!candidate) continue;
- const normalized = candidate.replace("_", "-").toLowerCase();
+ const normalized = candidate.replaceAll("_", "-").toLowerCase();
+ const chinese = chineseCatalog(normalized);
+ if (chinese) return chinese;
const exact = supportedLocales.find((l) => l.toLowerCase() === normalized);
if (exact) return exact;
const language = supportedLocales.find(